Hi all, 

I have a question about a complicated query I need to do. I have a model for
an event like this:

class Events(models.Model):
    default_group = models.ForeignKey(Group, related_name='default_group',
null=True)
    group = models.ManyToManyField(Group)
    users = models.ManyToManyField(User)
    title = models.CharField(max_length=255)
    shortname = models.SlugField(max_length=25, unique=True) 

plus some more fields that are not relevant to this question.

This is for a event registration site. The default group must be chosen from
the event creator's groups. group can be any group and users can be any
users. 

I need to do a query that selects all Events that a logged in user can edit.
They can edit an event if they are in the default group, if they are in any
of the other groups, or they are one of the users added to the event. 

I've read the docs and am still missing something. How can I do this query
as elegantly as possible? 

Thanks,
A Django Newbie. 
-- 
View this message in context: 
http://old.nabble.com/Complex-Query-Question-tp26451658p26451658.html
Sent from the django-users mailing list archive at Nabble.com.

--

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=.


Reply via email to