Skip to content
Snippets Groups Projects
Commit cfc60783 authored by Rachel TORCHET's avatar Rachel TORCHET
Browse files

Update Django admin page and Admin session. Create forms needed and update css...

Update Django admin page and Admin session. Create forms needed and update css file for forms elements
parent 4a569d06
No related branches found
No related tags found
No related merge requests found
Showing with 190 additions and 30 deletions
from django.forms import ModelForm
from django import forms
from django.db import models
from .models import Bibliography, Protein, ProteinDomainComplex, Ppi
class IdForm(forms.Form):
id = forms.CharField(label="",max_length=100, widget=forms.TextInput(attrs={'placeholder': 'PubMed ID / DOI / Patent ID'}))
class BibliographyForm(ModelForm):
class Meta:
model = Bibliography
exclude = ['title','journal_name', 'authors_list', 'biblio_year']
class PDBForm(forms.Form):
pdb_id = forms.CharField(label="PDB ID",max_length=100, widget=forms.TextInput(attrs={'placeholder': '123456'}))
class ProteinForm(ModelForm):
class Meta:
model = Protein
exclude = ['recommended_name_long', 'short_name']
class ProteinDomainComplexForm(ModelForm):
class Meta:
model = ProteinDomainComplex
fields = ['protein_id', 'domain_id', 'ppc_copy_nb']
class PpiForm(ModelForm):
class Meta:
model = Ppi
fields = ['complex_id', 'cc_nb', 'pdb_id', 'symmetry_id']
from __future__ import unicode_literals
from django.db import models
from django.forms import ModelForm
from .ws import get_pubmed_info, get_epo_info, get_uniprot_info, get_taxonomy_info, get_go_info, get_pfam_info
......@@ -41,10 +40,7 @@ class Bibliography(models.Model):
class Meta:
verbose_name_plural = "bibliographies"
class BibliographyForm(ModelForm):
class Meta:
model = Bibliography
exclude = ['title','journal_name', 'authors_list', 'biblio_year']
class Taxonomy(models.Model):
taxonomy_id = models.DecimalField('NCBI TaxID', unique=True, max_digits=9, decimal_places=0)
......
......@@ -328,6 +328,17 @@ text-align: center;
display: inline-block;
}
.secondary-nav ul li a:active {
font-size: 11px;
font-family: "BrandonGrotesqueBlk";
color:#000;
text-transform: uppercase;
text-decoration: none;
padding: 0px 0px;
position: relative;
display: inline-block;
}
.secondary-nav ul li a:focus::after {
content: "";
position: absolute;
......@@ -337,6 +348,7 @@ text-align: center;
height: 2px;
background: #414144 none repeat scroll 0% 0%;
text-decoration: none;
color: #000;
}
.secondary-nav ul li a:active::after {
......@@ -348,6 +360,7 @@ text-align: center;
height: 2px;
background: #414144 none repeat scroll 0% 0%;
text-decoration: none;
color: #000;
}
.secondary-nav ul li a:hover::after {
......@@ -361,6 +374,7 @@ text-align: center;
text-decoration: none;
}
/* -- Breadcrumb -- */
......@@ -585,6 +599,32 @@ display:block;
border: 1px solid;
padding: 10px;
min-height: 150px;
text-align: center;
}
form {
width : 400px;
}
button, input, select, textarea {
line-height: inherit;
font-family: "BrandonGrotesqueReg";
width: 400px;
border-bottom: 1px solid #2d96fa;
border-top: 1px solid #E3E9EB;
border-left: 1px solid #E3E9EB;
border-right: 1px solid #E3E9EB;
text-align: center;
}
[type="reset"], [type="submit"], button, html [type="button"] {
-webkit-appearance: button;
margin-top: 5px;
border-radius: 0px;
background-color: #2d96fa;
border: none;
color: #fff;
width: inherit;
}
/* CONTENT */
......
......@@ -9,13 +9,13 @@
<div class="inner-wrap">
<ul>
<li>
<a hfref="/admin/view">View Content</a>
<a hfref="/admin-session/view">View Content</a>
</li>
<li>
<a href="/admin/add">Add New Content</a>
<a href="/admin-session/add">Add New Content</a>
</li>
<li>
<a hfref="/admin/update">Update Content</a>
<a hfref="/admin-session/update">Update Content</a>
</li>
</ul>
</div>
......@@ -44,7 +44,7 @@
To achieve this process, you need : </br>
<ul>
<li> Your bibliographic source (PubMed article or Patents), </li>
<li> Its ID number (e.g Pubmed ID), </li>
<li> Its ID number (e.g PubMed ID), </li>
<li> And a reference PDB code that contains the structure of the macromolecular complex of the PPI target for which you have data. </li>
</ul>
E.g for a heterodimer, the structure needs to contain both partners. This will help you to describe the PPI architecture. </br>
......@@ -56,8 +56,13 @@
<div class="content">
<div class="view-content">
<div id="Form">
ICI Formulaires
<form action="/admin-session/add" method="post">
{% csrf_token %}
{{ ID.as_p}}
<input type="submit" value="Next" />
</form>
</div>
</div>
</div>
</div>
......
{% extends "base.html" %}
{% block title %}inhibitors of Protein-Protein Interaction Database{% endblock %}
{% block content %}
<div id="mainnav">
<nav class="secondary-nav">
<div class="inner-wrap">
<ul>
<li>
<a hfref="/admin-session/view">View Content</a>
</li>
<li>
<a href="/admin-session/add">Add New Content</a>
</li>
<li>
<a hfref="/admin-session/update">Update Content</a>
</li>
</ul>
</div>
</nav>
</div>
Here the template of admin session
{% endblock %}
{% extends "base.html" %}
{% block title %}inhibitors of Protein-Protein Interaction Database{% endblock %}
{% block content %}
Here the template of admin session
{% endblock %}
......@@ -52,13 +52,13 @@
<a href="/about">About</a>
</li>
<li>
<a href="/submit">Submit</a>
<a href="/query">Query</a>
</li>
<li>
<a href="/tutorials">Tutorials</a>
</li>
<li>
<a href="/admin">Admin</a>
<a href="/admin-session">Admin</a>
</li>
</ul>
</div>
......
{% extends "base.html" %}
{% load i18n %}
{% block head %}
{{ wizard.form.media }}
{% endblock %}
{% block content %}
<p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</p>
<form action="" method="post">{% csrf_token %}
<table>
{{ wizard.management_form }}
{% if wizard.form.forms %}
{{ wizard.form.management_form }}
{% for form in wizard.form.forms %}
{{ form }}
{% endfor %}
{% else %}
{{ wizard.form }}
{% endif %}
</table>
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
{% endif %}
<input type="submit" value="{% trans "submit" %}"/>
</form>
{% endblock %}
\ No newline at end of file
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^about$', views.about, name='about'),
url(r'^submit$', views.submit, name='submit'),
url(r'^query$', views.query, name='query'),
url(r'^tutorials$', views.tutorials, name='tutorials'),
url(r'^admin/add$', views.add, name='add'),
url(r'^admin-session$', views.adminSession, name='admin-session'),
url(r'^admin-session/add$', views.add, name='add'),
]
from django.shortcuts import render
from formtools.wizard.views import SessionWizardView
from django.http import HttpResponseRedirect
from .forms import IdForm, BibliographyForm, PDBForm, ProteinForm, ProteinDomainComplexForm, PpiForm
def index(request):
return render(request, 'index.html')
def about(request):
return render(request, 'about.html')
def submit(request):
return render(request, 'submit.html')
def query(request):
return render(request, 'query.html')
def tutorials(request):
return render(request, 'tutorials.html')
def adminSession(request):
return render(request, 'admin-session.html')
def add(request):
return render(request, 'add.html')
# if this is a POST request we need to process the form data
if request.method == 'POST':
# create a form instance and populate it with data from the request:
form = IdForm(request.POST)
# check whether it's valid:
if form.is_valid():
# process the data in form.cleaned_data as required
# ...
# redirect to a new URL:
return HttpResponseRedirect('/admin-session/add')
# if a GET (or any other method) we'll create a blank form
else:
form = IdForm()
return render(request, 'add.html', {'ID': form})
# def add(request):
# # if this is a POST request we need to process the form data
# if request.method == 'POST':
# # create a form instance and populate it with data from the request:
# form = BibliographyForm(request.POST)
# # check whether it's valid:
# if form.is_valid():
# # process the data in form.cleaned_data as required
# # ...
# # redirect to a new URL:
# return HttpResponseRedirect('/admin-session/add')
# # if a GET (or any other method) we'll create a blank form
# else:
# form = BibliographyForm()
# return render(request, 'add.html', {'Biblio': form})
......@@ -39,7 +39,8 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'django_extensions',
'bootstrap3',
'ippidb'
'ippidb',
'formtools',
]
MIDDLEWARE = [
......
......@@ -18,5 +18,5 @@ from django.contrib import admin
urlpatterns = [
url(r'^', include('ippidb.urls')),
url(r'^admin/', admin.site.urls),
url(r'^admin-django/', admin.site.urls),
]
......@@ -5,3 +5,4 @@ django-extensions
pygraphviz
pydot
pyparsing
django-formtools
\ No newline at end of file
{% extends "admin/base_site.html" %}
{% extends "admin-django/base_site.html" %}
{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
......@@ -11,7 +11,7 @@
{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('Django administration') }}</a></h1>
<h1 id="site-name"><a href="{% url 'admin-django:index' %}">{{ site_header|default:_('Django administration') }}</a></h1>
{% endblock %}
{% block nav-global %}{% endblock %}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment