I am trying to create a Django application where a user can make a list of movies. Each time a user logs in, their list of films will be presented to them in a table. The table will have three columns: one for the name of the movie, one for the genre, the other - delete buttons that allow the user to delete the line corresponding to the button. The user can add rows to the table by filling out the text field with the name of the movie and selecting a genre from the drop-down menu, and then clicking the "Add" button. The Add and Delete buttons are the only way the user can edit the table.
Are there any Django shortcuts for creating such an editable table? I thought this might be something suitable for forms, but I cannot figure out how to do this. In addition, it was difficult to maintain “Google Django tables,” since the results seem to be for database tables.
This is the model I'm trying to use now:
class MovieList(models.Model):
user = models.ForeignKey(User)
movie = models.ForeignKey(Movie)
class Movie(models.Model):
genre = models.ForeignKey(Genre)
name = models.CharField(max_length=300)
class Genre(models.Model):
name = models.CharField(max_length=200)
Any help would be greatly appreciated.
source
share