ManyToMany Manager

2009-10-25 Thread Steven Stelmach

Hi all,

I'm working with a content model (say, for simplicity, that we have
articles and images) that has a published status of either "Published"
or "Draft". In the admin interface, I have a widget to associate
images with articles as related content (a manytomany field).

On my site, I currently have a default manager for content that
filters out these draft items, so in the admin, it is not possible for
the field to show or select these draft items in the related content
lookup field. Is there any possible way to either prepopulate the
manytomany field in admin with the correct value or to make the
default manytomany manager for admin different than the default for
the rest of the site?

Thanks,
Steven
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---



Cascade Soft Delete

2009-07-22 Thread Steven Stelmach

Hi all,

I'm working with models (for a newspaper site) similar to this:

- Abstract class Content with child class Article.
- Each Content object is related one-to-one with a ContentGeneric,
which has a published_status field.
- Articles have related_content, which is a M2M field with
ContentGeneric.

I've implemented a soft delete on ContentGeneric by overriding the
get_queryset method on my manager to only fetch content with active
published_statuses, but when I ask an article for its related_content
via the ORM, references to soft deleted content are obviously still
valid and are returned.

My question is basically: is there a way to make a default m2m manager
that fetches only active content? I'd like to be able to do something
like Articles.related_content.all() and have it return only active
related_content content instances.

Thanks,
Steve

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---