X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/2b808329bca3af8d614aa13af7b6ccf24092d4ce..77f783071cd3c6246a90dc6aa869b4efe7610379:/models/collections.py?ds=sidebyside diff --git a/models/collections.py b/models/collections.py index 61b2608..539ecdb 100644 --- a/models/collections.py +++ b/models/collections.py @@ -1,8 +1,9 @@ from django.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic -from philo.models.base import register_value_model +from philo.models.base import value_content_type_limiter, register_value_model from philo.utils import fattr +from django.template import add_to_builtins as register_templatetags class Collection(models.Model): @@ -31,7 +32,7 @@ class CollectionMember(models.Model): objects = CollectionMemberManager() collection = models.ForeignKey(Collection, related_name='members') index = models.PositiveIntegerField(verbose_name='Index', help_text='This will determine the ordering of the item within the collection. (Optional)', null=True, blank=True) - member_content_type = models.ForeignKey(ContentType, verbose_name='Member type') + member_content_type = models.ForeignKey(ContentType, limit_choices_to=value_content_type_limiter, verbose_name='Member type') member_object_id = models.PositiveIntegerField(verbose_name='Member ID') member = generic.GenericForeignKey('member_content_type', 'member_object_id') @@ -42,4 +43,5 @@ class CollectionMember(models.Model): app_label = 'philo' +register_templatetags('philo.templatetags.collections') register_value_model(Collection) \ No newline at end of file