Steven Stelmach
2009-07-22 18:57:53 UTC
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-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
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-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---