Migrated project to Python 3
This commit is contained in:
parent
5f501caeb2
commit
e7ce5ccc5c
5 changed files with 19 additions and 24 deletions
|
|
@ -5,7 +5,7 @@ from django.views.generic import RedirectView
|
|||
from stages import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', RedirectView.as_view(url='/admin/'), name='home'),
|
||||
url(r'^$', RedirectView.as_view(url='/admin/', permanent=True), name='home'),
|
||||
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
url(r'^data-import/', include('tabimport.urls')),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Django >= 1.8
|
||||
-e git+https://github.com/claudep/tabimport.git#egg=tabimport
|
||||
openpyxl==2.2.2
|
||||
Django==1.8.6
|
||||
tabimport
|
||||
openpyxl==2.2.6
|
||||
xlrd
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.contrib import admin
|
||||
from django.db import models
|
||||
|
|
@ -15,7 +12,7 @@ class KlassAdmin(admin.ModelAdmin):
|
|||
|
||||
|
||||
class StudentAdmin(admin.ModelAdmin):
|
||||
list_display = ('__unicode__', 'pcode', 'city', 'klass', 'archived')
|
||||
list_display = ('__str__', 'pcode', 'city', 'klass', 'archived')
|
||||
ordering = ('last_name', 'first_name')
|
||||
list_filter = ('klass', 'archived')
|
||||
search_fields = ('last_name', 'first_name', 'pcode', 'city', 'klass__name')
|
||||
|
|
@ -37,11 +34,11 @@ class StudentAdmin(admin.ModelAdmin):
|
|||
|
||||
|
||||
class ReferentAdmin(admin.ModelAdmin):
|
||||
list_display = ('__unicode__', 'abrev', 'email')
|
||||
list_display = ('__str__', 'abrev', 'email')
|
||||
|
||||
|
||||
class CorpContactAdmin(admin.ModelAdmin):
|
||||
list_display = ('__unicode__', 'corporation', 'role')
|
||||
list_display = ('__str__', 'corporation', 'role')
|
||||
ordering = ('last_name', 'first_name')
|
||||
search_fields = ('last_name', 'first_name', 'role')
|
||||
fields = (('corporation', 'is_main', 'always_cc'),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
from datetime import date
|
||||
|
||||
from django.db import models
|
||||
|
|
@ -22,7 +20,7 @@ class Section(models.Model):
|
|||
class Meta:
|
||||
verbose_name = "Filière"
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
|
|
@ -33,7 +31,7 @@ class Level(models.Model):
|
|||
verbose_name = "Niveau"
|
||||
verbose_name_plural = "Niveaux"
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def delta(self, diff):
|
||||
|
|
@ -53,7 +51,7 @@ class Klass(models.Model):
|
|||
class Meta:
|
||||
verbose_name = "Classe"
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
|
|
@ -76,7 +74,7 @@ class Student(models.Model):
|
|||
class Meta:
|
||||
verbose_name = "Étudiant"
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return '%s %s' % (self.last_name, self.first_name)
|
||||
|
||||
@classmethod
|
||||
|
|
@ -108,7 +106,7 @@ class Referent(models.Model):
|
|||
verbose_name = "Référent"
|
||||
ordering = ('last_name', 'first_name')
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return '%s %s' % (self.last_name, self.first_name)
|
||||
|
||||
|
||||
|
|
@ -130,7 +128,7 @@ class Corporation(models.Model):
|
|||
verbose_name = "Institution"
|
||||
ordering = ('name',)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
sect = ' (%s)' % self.sector if self.sector else ''
|
||||
return "%s%s, %s %s" % (self.name, sect, self.pcode, self.city)
|
||||
|
||||
|
|
@ -150,7 +148,7 @@ class CorpContact(models.Model):
|
|||
class Meta:
|
||||
verbose_name = "Contact"
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return '%s %s' % (self.last_name, self.first_name)
|
||||
|
||||
|
||||
|
|
@ -161,7 +159,7 @@ class Domain(models.Model):
|
|||
verbose_name = "Domaine"
|
||||
ordering = ('name',)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
|
|
@ -177,7 +175,7 @@ class Period(models.Model):
|
|||
verbose_name = "Période de stage"
|
||||
ordering = ('-start_date',)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return '%s (%s)' % (self.dates, self.title)
|
||||
|
||||
@property
|
||||
|
|
@ -215,7 +213,7 @@ class Availability(models.Model):
|
|||
class Meta:
|
||||
verbose_name = "Disponibilité"
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return '%s - %s (%s) - %s' % (self.period, self.corporation, self.domain, self.contact)
|
||||
|
||||
@property
|
||||
|
|
@ -237,5 +235,5 @@ class Training(models.Model):
|
|||
class Meta:
|
||||
verbose_name = "Stage"
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return '%s chez %s (%s)' % (self.student, self.availability.corporation, self.availability.period)
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ def period_students(request, pk):
|
|||
).order_by('last_name')
|
||||
trainings = dict((t.student_id, t.id) for t in Training.objects.filter(availability__period=period))
|
||||
data = [{
|
||||
'name': unicode(s),
|
||||
'name': str(s),
|
||||
'id': s.id,
|
||||
'training_id': trainings.get(s.id),
|
||||
'klass': s.klass.name} for s in students]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue