Hi brother, so, I don't know if understand very well. but I think that this is answer for your problems.
https://docs.djangoproject.com/en/dev/ref/contrib/admin/ vlw. 2014-05-05 14:52 GMT+01:00 Vibhu Rishi <vibhu.ri...@gmail.com>: > 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 > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAPiONwkfs%3DcTc5dMVVKdZAeRvR0vOTz6%2B03oL1FiG_%2BumJBOeg%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAPiONwkfs%3DcTc5dMVVKdZAeRvR0vOTz6%2B03oL1FiG_%2BumJBOeg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABcoSmBRvoSWK8ueEtj8o5gfzgczq8vYnYz2-KVGVy88BwguJQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.