Hi Daniel,

Thank you very much for your reply. That cleared quite a lot of stuff
for me. I was wondering if you have any links on how to populate
models through the admin interface. I would like to have it editable
from admin (makes it much easier to handle). If you have any links or
ideas on how to do this please let me know.

I already setup the admin backend so that I can add the six different
fields defined in the model (country, language, practice, profdesgn,
sector and profession) <-- the manytomany fields in models.

Thanks for your help! :)

Daxal

On Apr 9, 5:46 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Apr 9, 9:42 am, Daxal <daxal.someone...@gmail.com> wrote:
>
>
>
> > Basically, I am starting to create a view called "cvdetails" and it is
> > linked to "cvdetails.html" link for template.
>
> > The form is supposed to use is:
>
> > class cvForm(forms.Form):
> >   Language =
> > forms.ModelMultipleChoiceField(queryset=C.Language.objects.all())
> >   ProfDesgn =
> > forms.ModelMultipleChoiceField(queryset=C.ProfDesgn.objects.all(),
> > required=False)
> >   Practice =
> > forms.ModelMultipleChoiceField(queryset=C.Practice.objects.all(),
> > required=False)
> >   Sector =
> > forms.ModelMultipleChoiceField(queryset=C.Sector.objects.all(),
> > required=False)
> >   Profession =
> > forms.ModelMultipleChoiceField(queryset=C.Profession.objects.all(),
> > required=False)
> >   Country =
> > forms.ModelMultipleChoiceField(queryset=C.Country.objects.all(),
> > required=False)
>
> > and the model for this form is:
>
> > class ProfDesgn(models.Model):
> >   Name = models.CharField(max_length=15)
> >   def __unicode__(self):
> >     return self.Name
>
> > class Practice(models.Model):
> >   Name = models.CharField(max_length=50)
> >   def __unicode__(self):
> >     return self.Name
>
> > class Sector(models.Model):
> >   Name = models.CharField(max_length=30)
> >   def __unicode__(self):
> >     return self.Name
>
> > class Profession(models.Model):
> >   Name = models.CharField(max_length=80)
> >   def __unicode__(self):
> >     return self.Name
>
> > class Country(models.Model):
> >   Name = models.CharField(max_length=40)
> >   def __unicode__(self):
> >     return self.Name
>
> > class Language(models.Model):
> >   Language = models.CharField(max_length=30)
> >   def __unicode__(self):
> >     return self.Language
>
> > class cvdb(models.Model):
> >   user = models.ForeignKey(User)
> >   language_set = models.ManyToManyField(Language,
> > db_table='cm_cvdb_language', verbose_name="languages")
> >   profdesgn_set = models.ManyToManyField(ProfDesgn,
> > db_table='cm_cvdb_profdesgn', verbose_name="professional designation",
> > blank=True)
> >   practice_set = models.ManyToManyField(Practice,
> > db_table='cm_cvdb_practice', verbose_name="Practice", blank=True)
> >   sector_set = models.ManyToManyField(Sector,
> > db_table='cm_cvdb_sector', verbose_name="Sector", blank=True)
> >   profession_set = models.ManyToManyField(Profession,
> > db_table='cm_cvdb_profession', verbose_name="Profession", blank=True)
> >   country_set = models.ManyToManyField(Country,
> > db_table='cm_cvdb_country', verbose_name="Country", blank=True)
>
> > Now I am wondering how do I start off the view for a
> > modelmultiplechoice fields. I would imagine they require some populate
> > definition using the MySQLdb library in pythong but should it be
> > defined under forms or views? I am completely lost as to how to
> > approach this. I searched and searched but I cannot find information
> > on it at all (even in the django references)
>
> > Thanks in advance!   (:
>
> It's not really clear what you are asking. What view do you mean?
> Fields don't have views, views are for displaying information on the
> front end.
>
> If you want to populate your models, an easy way would be via the
> admin interface - or you can do it programmatically, or define your
> own views with forms.
>
> A couple of tips: you probably want to use a modelform, not a plain
> form. Also you shouldn't use '_set' in the names, that's used for
> reverse relations in foreign keys and is likely to get confusing.
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to