Friday, April 20, 2018

issue with django model and form

I have "user" Model

username email phonenumber

I want to access all "user" model emails in other model "B" and make user to select more than one email and store it has commaseperatedvalues

"B" colums are

  organization Designation share_knowledge_with      abc           manager   (here all emails which user selected                                       to be stored with commaseperated)   

I tried like this but not working:

MODEL

class B(models.Model):     organization=models.CharField(max_length=200,blank=False,null=True)     emails_for_help = models.TextField(null=True,help_text="select with whom      you want to share knowledge") 

form

class Bform(ModelForm):    emails_for_help=forms.ModelMultipleChoiceField(queryset=User.objects.all(),   widget=forms.CheckboxSelectMultiple)   class Meta:      model=B      fields=["organization","emails_for_help"]

I tried like this but it is taking null value in "emails_for_help"

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/67f9dbe0-e0ec-448f-b63d-9049eae551d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment