Combining querysets on a choice field in django?

Choices needs to be a list of tuples: def __init__(self, userprofile, *args, **kwargs): ### define all videos the user has been in ### videos_uploaded_by_user=list(userprofile. Video_set.all()) credits_from_others=video. Video for video in userprofile.

Videocredit_set.all() all_credited_videos=list(set(videos_uploaded_by_user+credits_from_others)) ### build a sorted list of tuples (CHOICES) with title, id CHOICES= for video in all_credited_videos: CHOICES. Append((video. Id,video.

Title)) CHOICES. Sort(key=lambda x: x1) ### 'super' the function to define the choices for the 'featured_video' field super(FeaturedVideoForm, self). __init__(*args, **kwargs) self.

Fields'featured_video'. Choices = CHOICES And to display in the template: {{form. Featured_video}}.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions