I have a model for uploading photos in an album by the users. But if the
user don't want to create an album, and just upload photos, I want it to be
uploaded in a default album, namely 'Default album'. So that, whenever the
user uploads photo without creating a new album, the 'Default album should
be updated by that photos. For that, I thought about giving a default
valuein the title of the Album, but I also don't want to create a new
album with
name 'Default album' whenever the user doesn't create a new album to upload
photo. I just want to update the 'Default Album'. Please suggest me how to
achieve the above mentioned. And also is it okay to just give the ForeignKey
field of the User to the Album class and not the Photo class??? Thank you!

models.py:

class Album(models.Model):
    title = models.CharField(max_length=200)
    pub_date = models.DateTimeField(default=datetime.now)
    user = models.ForeignKey(User)

class Photo(models.Model):
    album = models.ForeignKey(Album)
    title = models.CharField(max_length=200)
    image = models.ImageField(upload_to=get_upload_file_name, blank=True)
    pub_date = models.DateTimeField(default=datetime.now)

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CAHSNPWs-6Lx%3Dtwwb0Y%2B7zd4wn-7DEqXUR7%2BE4Ttz4C3wukqFgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to