How to make a model with a yes/no field, if yes that particular object
(image) will be used as the background, and no other image will be
selected.

I have come with this model:

    class BackgroundImage(models.Model):
        user = models.ForeignKey(user)
        caption = models.CharField(max_length=200)
        image = models.ImageField(upload_to=get_upload_file_name)
        using_image = models.BooleanField()

But with this I can select all of them, and not only one.

Lets take an example of profile picture. A user can have many images, but
he can only select one as a profile picture. So, that if he selects one,
the other will be un-select itself.
Hope everybody understood what I mean. Please ask me if didn't understood.
Also please correct me if my model is not correct. Thank you!

-- 
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/CAHSNPWvAr2iVH7MT1TJDmBqOO3EmFt4NR%3DYv1OQY0sexLUKK8w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
  • [no subject] Aamu Padi
    • Re: Lee Hinde
      • Re: Aamu Padi
        • Re: Lee Hinde
          • Re: Rafael E. Ferrero
    • Re: Tom Evans
      • Re: Aamu Padi

Reply via email to