Dear all
I'm completely stuck with the following problem.
What I'm trying to accomplish is: I have an app with the model
"Project" and another model "Contacts". In "Contacts" I have a m2m
field called "projects_involved" relating to the "Project" model which
allows to select projects the contact is involved with.
In my "Project" model I have some m2m fields like "client" and
"collaborators" where I want to store a relation to some of the
contacts. In the admin interface the user should be provided with
contacts related to the actual "Project" only.
class Contact(models.Model):
projects_involved = models.ManyToManyField('Project', blank=True)
class Project(models.Model):
title = models.CharField(max_length=100)
client = models.ManyToManyField(Contact, related_name='client',
blank=True)
collaborators = models.ManyToManyField(Contact,
related_name='collaborators', blank=True)
What I tried so far is to use a filter for constructing a choices list
within the “Project” model.
related_contacts = Contact.objects.filter
(projects_involved__title__starts_with=title)
This gives me the following error in
"/django/db/models/fields/__init__.py" line 102, in __cmp__
return cmp(self.creation_counter, other.creation_counter)
AttributeError: 'str' object has no attribute 'creation_counter'
I would be very thankful for any pointers into which direction to go
and if this approach altogether makes sense.
Thanks and best regards
Silvan
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---