Hi,

I'm struggling to find any useful tutorials on how best to achieve
this so a nudge in the right direction would be greatly appreciated.

I've set up a model which references django_content_type. My idea is
to use this model to reference other models so that they can be marked
as "featured" content, without me having to put a new "isFeatured"
field on every model.

All I want to be able to do is have a check box appear on the forms of
my admin for each model, which indicates if the content is featured or
not. If you check it, it's added to the table, if you un-check it
removes it.

    class FeaturedContent(models.Model):
        content_type = models.ForeignKey(ContentType)
        object_id = models.PositiveIntegerField()
        content_object = generic.GenericForeignKey('content_type',
'object_id')

An example model I would like to use with this is:

    class Institute(models.Model):
        name = models.CharField(max_length=200)
        slug = models.SlugField(max_length=200,unique=True)

Firstly, is this the right approach?

Do I need to create a custom form/model field? and how do I introduce
this field to the admin template?

I've been looking inside of (django.contrib.contenttypes) generic.py
and you can clearly see where the template data is being loaded and
also which template is being used. I'm wondering if perhaps I just
need to extend this class rather than write my own field?

Thanks for any help,

James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to