Skip to content

Instantly share code, notes, and snippets.

@ridoansaleh
Created January 28, 2018 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ridoansaleh/bec582b9af9839d4e72444bf6b9d44ec to your computer and use it in GitHub Desktop.
Save ridoansaleh/bec582b9af9839d4e72444bf6b9d44ec to your computer and use it in GitHub Desktop.
from django.db import models
class Song(models.Model):
genre_choices = (
('Pop', 'Pop'),
('Reggae', 'Reggae'),
('Country', 'Country'),
('Jazz', 'Jazz'),
('Hip Hop', 'Hip Hop'),
('Rock', 'Rock'),
('R&B and Souls', 'R&B and Souls'),
('Dangdut', 'Dangdut'),
)
title = models.CharField(max_length=50)
genre = models.CharField(max_length=25, choices=genre_choices, default='Pop')
singer = models.CharField(max_length=50)
rating = models.PositiveIntegerField(default=1)
def __unicode__(self):
return self.title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment