Many thanks for the answer! Very Now I made a big step forwards:
class CustomInterestsInline(admin.TabularInline):
model = models.CustomInterests
extra = 9
class CustomSportsInlilne(admin.TabularInline):
model = models.CustomSports
extra = 9
class CustomMusicInline(admin.TabularInline):
model = models.CustomMusic
extra = 9
class CustomUserprofileAdmin(admin.ModelAdmin):
inlines = (CustomInterestsInline, CustomSportsInlilne,
CustomMusicInline,)
The 'extra' attribute defines the amount of rows. The rating option is
displayed also.
The nexts steps I want to accomplish:
A form for users, they can create/edit the profile. The 'interests' and
'sports' columns have to
be prepopulated with all available (declared by 'active' with a Boolean)
entries in the interests/sports table.
If a user has an 'interest' or 'sports', he/she selects it (checkbox) and
rates the entry.
Also the amount of entries to be selected by the user is limited to a
defined amount (i.e. 6 or 10).
Is there any way to do it???
I started with something like this....
class UserProfileForm(forms.ModelForm):
interests = forms.ModelMultipleChoiceField(
queryset=Interests.objects.all(),
widget=forms.CheckboxSelectMultiple)
sports = forms.ModelMultipleChoiceField(
queryset=Sports.objects.all(),
widget=forms.CheckboxSelectMultiple)
Best regards! :)
Am Donnerstag, 4. Dezember 2014 09:38:33 UTC+1 schrieb Yann Fouillat:
>
> Hi,
>
> > Startet lot of investigation and the 'through' option seems to be the
> > solution? Don't got it really because in my Admin there is NO field to
> > choose some 'interests' and an option to rate it.
>
> Did you try using InlineModelAdmin
> (
> https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#working-with-many-to-many-intermediary-models)?
>
>
>
>
> --
> Yann FOUILLAT
> Ingénieur Développeur
> Makina Corpus
> Tél : 02 51 79 80 82
>
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/c06c8ebc-5493-4145-9e50-8c8d119ab7f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.