cleanup in info/

This commit is contained in:
Stephan Telling 2018-03-04 15:56:11 +01:00
parent f20695094e
commit d20a964793
3 changed files with 19 additions and 20 deletions

View file

@ -1,5 +1,8 @@
from django.contrib import admin from django.contrib import admin
from .models import * from .models import (
InfoItem,
InfoCategory
)
@admin.register(InfoItem) @admin.register(InfoItem)

View file

@ -1,5 +1,3 @@
from django.apps import AppConfig from django.apps import AppConfig

View file

@ -11,22 +11,22 @@ class InfoCategory(CampRelatedModel):
camp = models.ForeignKey( camp = models.ForeignKey(
'camps.Camp', 'camps.Camp',
related_name = 'infocategories', related_name='infocategories',
on_delete = models.PROTECT on_delete=models.PROTECT
) )
headline = models.CharField( headline = models.CharField(
max_length = 100, max_length=100,
help_text = "The headline of this info category" help_text="The headline of this info category"
) )
anchor = models.SlugField( anchor = models.SlugField(
help_text = "The HTML anchor to use for this info category." help_text="The HTML anchor to use for this info category."
) )
weight = models.PositiveIntegerField( weight = models.PositiveIntegerField(
help_text = 'Determines sorting/ordering. Heavier categories sink to the bottom. Categories with the same weight are ordered alphabetically. Defaults to 100.', help_text='Determines sorting/ordering. Heavier categories sink to the bottom. Categories with the same weight are ordered alphabetically. Defaults to 100.',
default = 100, default=100,
) )
def clean(self): def clean(self):
@ -45,26 +45,26 @@ class InfoItem(CampRelatedModel):
category = models.ForeignKey( category = models.ForeignKey(
'info.InfoCategory', 'info.InfoCategory',
related_name = 'infoitems', related_name='infoitems',
on_delete = models.PROTECT on_delete=models.PROTECT
) )
headline = models.CharField( headline = models.CharField(
max_length = 100, max_length=100,
help_text = "Headline of this info item." help_text="Headline of this info item."
) )
anchor = models.SlugField( anchor = models.SlugField(
help_text = "The HTML anchor to use for this info item." help_text="The HTML anchor to use for this info item."
) )
body = models.TextField( body = models.TextField(
help_text = 'Body of this info item. Markdown is supported.' help_text='Body of this info item. Markdown is supported.'
) )
weight = models.PositiveIntegerField( weight = models.PositiveIntegerField(
help_text = 'Determines sorting/ordering. Heavier items sink to the bottom. Items with the same weight are ordered alphabetically. Defaults to 100.', help_text='Determines sorting/ordering. Heavier items sink to the bottom. Items with the same weight are ordered alphabetically. Defaults to 100.',
default = 100, default=100,
) )
@property @property
@ -78,5 +78,3 @@ class InfoItem(CampRelatedModel):
def __str__(self): def __str__(self):
return '%s (%s)' % (self.headline, self.category) return '%s (%s)' % (self.headline, self.category)