# Create your models here.
class Event(models.Model):
- name = models.CharField(max_length=50)
- title = models.CharField(max_length=100)
- slots = models.IntegerField()
+ name = models.CharField(max_length=50)
+ title = models.CharField(max_length=100)
+ slots = models.IntegerField()
- def __str__(self):
- if (self.title):
- return self.name + ' - ' + self.title
- else:
- return self.name
+ def __str__(self):
+ if (self.title):
+ return self.name + ' - ' + self.title
+ else:
+ return self.name
- class Admin:
- fields = (
- (None, {'fields' : ('name', 'title')} ),
- ('Registrations', {'fields' : ('slots',)} ),
- )
+ class Admin:
+ fields = (
+ (None, {'fields' : ('name', 'title')} ),
+ ('Registrations', {'fields' : ('slots',)} ),
+ )
class Person(models.Model):
- first_name = models.CharField(max_length=255)
- last_name = models.CharField(max_length=255)
+ first_name = models.CharField(max_length=255)
+ last_name = models.CharField(max_length=255)
- def __str__(self):
- return self.first_name + ' ' + self.last_name
+ def __str__(self):
+ return self.first_name + ' ' + self.last_name
- class Admin:
- list_display = ('first_name', 'last_name')
- list_filter = ['last_name']
- search_fields = ['first_name', 'last_name']
+ class Admin:
+ list_display = ('first_name', 'last_name')
+ list_filter = ['last_name']
+ search_fields = ['first_name', 'last_name']
class Registration(models.Model):
- person = models.ForeignKey(Person, edit_inline=models.STACKED, num_in_admin=3)
- event = models.ForeignKey(Event, core=True)
+ person = models.ForeignKey(Person, edit_inline=models.STACKED, num_in_admin=3)
+ event = models.ForeignKey(Event, core=True)
# Create your models here.
class Character(models.Model):
- created = models.DateField(auto_now_add=1, verbose_name = _("Creation time"))
- modified = models.DateField(auto_now=1, verbose_name = _("Modification time"))
- name = models.CharField(max_length=255, verbose_name = _("Name"))
- player = models.ForeignKey(User, verbose_name = _("Player"))
+ created = models.DateField(auto_now_add=1, verbose_name = _("Creation time"))
+ modified = models.DateField(auto_now=1, verbose_name = _("Modification time"))
+ name = models.CharField(max_length=255, verbose_name = _("Name"))
+ player = models.ForeignKey(User, verbose_name = _("Player"))
- def __str__(self):
- return self.name
+ def __str__(self):
+ return self.name
- class Admin:
- pass
+ class Admin:
+ pass
- class Meta:
- verbose_name = _("Character")
- verbose_name_plural = _("Characters")
+ class Meta:
+ verbose_name = _("Character")
+ verbose_name_plural = _("Characters")
class Influence(models.Model):
- STATUS_CHOICES = (
- ('N', 'New'),
- ('U', 'Under discussion'),
- ('P', 'Processing'),
- ('D', 'Done'),
- )
- created = models.DateField(auto_now_add=1, verbose_name = _("Creation time"))
- modified = models.DateField(auto_now=1, verbose_name = _("Modification time"))
-
- character = models.ForeignKey(Character, edit_inline=models.TABULAR, num_in_admin=3, core=True, verbose_name = _("Character"))
- contact = models.CharField(max_length=255, verbose_name = _("Contact"))
- description = models.TextField(verbose_name = _("Description"))
- status = models.TextField(max_length=1, choices=STATUS_CHOICES, default='N', verbose_name = _("Status"))
- longterm = models.BooleanField(default=False, verbose_name = _("Long term"))
-
- def __str__(self):
- return self.description[0:10]
-
- class Admin:
- list_filter=('character', 'status', 'longterm')
- search_fields=('character', 'description', 'contact')
-
- class Meta:
- verbose_name = _("Influence")
- verbose_name_plural = _("Influences")
+ STATUS_CHOICES = (
+ ('N', 'New'),
+ ('U', 'Under discussion'),
+ ('P', 'Processing'),
+ ('D', 'Done'),
+ )
+ created = models.DateField(auto_now_add=1, verbose_name = _("Creation time"))
+ modified = models.DateField(auto_now=1, verbose_name = _("Modification time"))
+
+ character = models.ForeignKey(Character, edit_inline=models.TABULAR, num_in_admin=3, core=True, verbose_name = _("Character"))
+ contact = models.CharField(max_length=255, verbose_name = _("Contact"))
+ description = models.TextField(verbose_name = _("Description"))
+ status = models.TextField(max_length=1, choices=STATUS_CHOICES, default='N', verbose_name = _("Status"))
+ longterm = models.BooleanField(default=False, verbose_name = _("Long term"))
+
+ def __str__(self):
+ return self.description[0:10]
+
+ class Admin:
+ list_filter=('character', 'status', 'longterm')
+ search_fields=('character', 'description', 'contact')
+
+ class Meta:
+ verbose_name = _("Influence")
+ verbose_name_plural = _("Influences")
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
- '/home/matthijs/docs/src/django/ee/templates',
+ '/home/matthijs/docs/src/django/ee/templates',
)
INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
- 'ee.events',
- 'ee.influences',
- 'ee.base',
+ 'ee.events',
+ 'ee.influences',
+ 'ee.base',
)
TEMPLATE_CONTEXT_PROCESSORS = (
- "django.core.context_processors.auth",
- "django.core.context_processors.debug",
- "django.core.context_processors.i18n",
- # Add STATIC_URL_PREFIX to the context
- "ee.tools.context_processors.static",
+ "django.core.context_processors.auth",
+ "django.core.context_processors.debug",
+ "django.core.context_processors.i18n",
+ # Add STATIC_URL_PREFIX to the context
+ "ee.tools.context_processors.static",
)
LOGIN_URL = "/accounts/login/"
# Allow authentication against the phpb user accounts
AUTHENTICATION_BACKENDS = (
- 'ee.auth.PhpBBBackend',
- 'django.contrib.auth.backends.ModelBackend',
+ 'ee.auth.PhpBBBackend',
+ 'django.contrib.auth.backends.ModelBackend',
)
from ee.influences.models import Character
chars_dict = {
- 'queryset': Character.objects.all(),
+ 'queryset': Character.objects.all(),
}
urlpatterns = patterns('',
(r'^admin/', include('django.contrib.admin.urls')),
- (r'^events/event/(?P<event_id>\d+)/$', 'ee.events.views.event.detail'),
- (r'^events/event/(?P<event_id>\d+)/regs$', 'ee.events.views.event.regs'),
- (r'^influences/add/(\d+)?/?$', 'ee.influences.views.add'),
- (r'^influences/$', 'ee.influences.views.index'),
- (r'^influences/character/$', 'django.views.generic.list_detail.object_list', chars_dict),
- (r'^influences/character/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', chars_dict),
- (r'^influences/character/add/$', 'ee.influences.views.addCharacter'),
- (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'base/login.html'}),
- (r'^accounts/logout/$', 'django.contrib.auth.views.logout_then_login'),
+ (r'^events/event/(?P<event_id>\d+)/$', 'ee.events.views.event.detail'),
+ (r'^events/event/(?P<event_id>\d+)/regs$', 'ee.events.views.event.regs'),
+ (r'^influences/add/(\d+)?/?$', 'ee.influences.views.add'),
+ (r'^influences/$', 'ee.influences.views.index'),
+ (r'^influences/character/$', 'django.views.generic.list_detail.object_list', chars_dict),
+ (r'^influences/character/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', chars_dict),
+ (r'^influences/character/add/$', 'ee.influences.views.addCharacter'),
+ (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'base/login.html'}),
+ (r'^accounts/logout/$', 'django.contrib.auth.views.logout_then_login'),
)
if settings.DEBUG: