Hi
I have Users and based on some requirements, I have created a few User Groups . e.g. I have a group of moderators.
Now, I am trying to create a form where a normal user can message the moderators.
So, I have a model to be used by the form something like :
class Message(models.Model):
moderator = models.ForeignKey(User)
user= models.ForeignKey(User)
text = models.TextField(max_length=1000)
date = models.DateField(default=datetime.now())
I want the moderator field to have keys to only those people who are in the group where name='Moderator'
I am not sure how to filter the ForeignKey in this case.
Why I want to do this --> is so that the form will have a dropdown list of moderators to choose from by the user when it is displayed. User selects the moderator, and enteres the message text - and sends it.
Regards,
Vibhu
--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius