Hello,
I try to get User objects from a SiteUser queryset. I have following
models:
class SiteUser(models.Model):
user = models.ForeignKey(User, unique = True)
company = models.ForeignKey(Company, db_index = True) # that is
absolutely needed
class Team(models.Model):
name = models.CharField(max_length = 500, db_index = True)
company = models.ForeignKey(Company, db_index = True, default = 1)
members = models.ManyToManyField(User, blank = True)
This Model has a TeamForm
class TeamForm(forms.ModelForm):
members = forms.ModelMultipleChoiceField(widget =
forms.CheckboxSelectMultiple,
queryset =
User.objects.all(),
required = False)
class Meta:
model = Team
fields = ('name', 'email', 'members')
within a view I need to do this:
project_members = request.customer.siteuser_set.filter(company =
request.customer)
TeamForm.base_fields['members'].queryset = project_members #<--- here
is a problem, I need to have a query set holding User objects.
Does someone know how i can have a User queryset instead of a SiteUser
queryset?
thanks, tom
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.