'sorl.thumbnail',
'timezones',
'jqchat',
- 'ipauth',
+ # 'ipauth',
'extra_views',
'debug_toolbar',
'bootstrap3',
collection_code_regex = '(?:%s|%s)' % (collection_published_code_regex,
collection_unpublished_code_regex)
+
+def is_valid_collection_code(value):
+ "Check if the collection code is well formed"
+ regex = '^' + collection_code_regex + '$'
+ if not re.match(regex, value):
+ raise ValidationError(u'%s is not a valid collection code' % value)
+
+
class MediaCollection(MediaResource):
"Describe a collection of items"
element_type = 'collection'
- def is_valid_collection_code(value):
- "Check if the collection code is well formed"
- regex = '^' + collection_code_regex + '$'
- if not re.match(regex, value):
- raise ValidationError(u'%s is not a valid collection code' % value)
-
# General informations
title = CharField(_('title'), required=True)
alt_title = CharField(_('original title / translation'))
children = models.ManyToManyField(MediaCollection, related_name="corpus",
verbose_name=_('collections'), blank=True)
+
recorded_from_year = IntegerField(_('recording year (from)'), help_text=_('YYYY'))
recorded_to_year = IntegerField(_('recording year (until)'), help_text=_('YYYY'))
kwargs['max_length'] = 250
super(CharField, self).__init__(*args, **normalize_field(kwargs, ''))
- def deconstruct(self):
- name, path, args, kwargs = super(CharField, self).deconstruct()
- print kwargs
- del kwargs["max_length"]
- return name, path, args, kwargs
-
class IntegerField(models.IntegerField):
"""IntegerField normalized with normalize_field()"""
from telemeta.models.core import *
from telemeta.models.resource import *
from telemeta.models.corpus import *
+from django.db import models
class MediaFonds(MediaBaseResource):
class MediaBaseResource(MediaResource):
"Describe a media base resource"
- title = CharField(_('title'), required=True)
- description = CharField(_('description_old'))
- descriptions = TextField(_('description'))
- code = CharField(_('code'), unique=True, required=True)
- public_access = CharField(_('public access'), choices=PUBLIC_ACCESS_CHOICES, max_length=16, default="metadata")
+ title = models.CharField(_('title'), max_length=250)
+ description = models.CharField(_('description_old'), max_length=250, blank=True, null=True)
+ descriptions = models.TextField(_('description'), blank=True)
+ code = models.CharField(_('code'), unique=True, max_length=250)
+ public_access = models.CharField(_('public access'), choices=PUBLIC_ACCESS_CHOICES, max_length=16, default="metadata")
def __unicode__(self):
return self.code