Add some more db fields
This commit is contained in:
parent
42d5c6ba2c
commit
a273df0538
7 changed files with 15 additions and 6 deletions
|
|
@ -10,7 +10,7 @@ class StudentAdmin(admin.ModelAdmin):
|
|||
list_display = ('__unicode__', 'pcode', 'city', 'klass')
|
||||
list_filter = ('klass',)
|
||||
search_fields = ('last_name', 'first_name', 'pcode', 'city', 'klass')
|
||||
fields = (('last_name', 'first_name'), ('pcode', 'city'),
|
||||
fields = (('last_name', 'first_name'), ('pcode', 'city'), ('email', 'tel'),
|
||||
'birth_date', 'klass', 'archived')
|
||||
|
||||
def get_readonly_fields(self, request, obj=None):
|
||||
|
|
@ -26,12 +26,12 @@ class ReferentAdmin(admin.ModelAdmin):
|
|||
|
||||
class CorpContactAdmin(admin.ModelAdmin):
|
||||
list_display = ('__unicode__', 'corporation', 'role')
|
||||
fields = ('corporation', ('title', 'last_name', 'first_name'),
|
||||
fields = (('corporation', 'is_main'), ('title', 'last_name', 'first_name'),
|
||||
'role', ('tel', 'email'))
|
||||
|
||||
class ContactInline(admin.StackedInline):
|
||||
model = CorpContact
|
||||
fields = (('title', 'last_name', 'first_name'),
|
||||
fields = ('is_main', ('title', 'last_name', 'first_name'),
|
||||
('role', 'tel', 'email'))
|
||||
extra = 1
|
||||
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@
|
|||
"corporation": 1,
|
||||
"title": "Monsieur",
|
||||
"first_name": "Jean",
|
||||
"is_main": true,
|
||||
"last_name": "Horner",
|
||||
"role": "Responsable formation",
|
||||
"tel": "",
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ class Student(models.Model):
|
|||
birth_date = models.DateField(verbose_name='Date de naissance')
|
||||
pcode = models.CharField(max_length=4, verbose_name='Code postal')
|
||||
city = models.CharField(max_length=40, verbose_name='Localité')
|
||||
tel = models.CharField(max_length=40, blank=True, verbose_name='Téléphone')
|
||||
email = models.EmailField(verbose_name='Courriel', blank=True)
|
||||
klass = models.ForeignKey(Klass, verbose_name='Classe')
|
||||
archived = models.BooleanField(default=False, verbose_name='Archivé')
|
||||
|
||||
|
|
@ -107,6 +109,7 @@ class Corporation(models.Model):
|
|||
|
||||
class Meta:
|
||||
verbose_name = "Institution"
|
||||
ordering = ('name',)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
|
@ -114,6 +117,7 @@ class Corporation(models.Model):
|
|||
|
||||
class CorpContact(models.Model):
|
||||
corporation = models.ForeignKey(Corporation, verbose_name='Institution')
|
||||
is_main = models.BooleanField(default=False, verbose_name='Contact principal')
|
||||
title = models.CharField(max_length=40, blank=True, verbose_name='Civilité')
|
||||
first_name = models.CharField(max_length=40, blank=True, verbose_name='Prénom')
|
||||
last_name = models.CharField(max_length=40, verbose_name='Nom')
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ function update_periods(section_id) {
|
|||
sel.append($("<option />").val('').text('-------'));
|
||||
if (data.length > 0) {
|
||||
$.each(data, function() {
|
||||
sel.append($("<option />").val(this[0]).text(this[1]));
|
||||
sel.append($("<option />").val(this.id).text(this.dates + ' ' + this.title));
|
||||
})
|
||||
}
|
||||
update_students('');
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ class AttributionView(TemplateView):
|
|||
def section_periods(request, pk):
|
||||
""" Return all periods from a section (JSON) """
|
||||
section = get_object_or_404(Section, pk=pk)
|
||||
periods = [(p.id, p.dates) for p in section.period_set.all().order_by('start_date')]
|
||||
periods = [{'id': p.id, 'dates': p.dates, 'title': p.title}
|
||||
for p in section.period_set.all().order_by('-start_date')]
|
||||
return HttpResponse(json.dumps(periods), content_type="application/json")
|
||||
|
||||
def section_classes(request, pk):
|
||||
|
|
@ -137,6 +138,9 @@ def stages_export(request):
|
|||
('Classe', 'student__klass__name'), ('Filière', 'student__klass__section__name'),
|
||||
('Début', 'availability__period__start_date'), ('Fin', 'availability__period__end_date'),
|
||||
('Institution', 'availability__corporation__name'),
|
||||
('Rue Inst.', 'availability__corporation__street'),
|
||||
('NPA Inst.', 'availability__corporation__pcode'),
|
||||
('Ville Inst.', 'availability__corporation__city'),
|
||||
('Domaine', 'availability__domain__name'),
|
||||
('Prénom référent', 'referent__first_name'), ('Nom référent', 'referent__last_name')
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue