Guest User

Untitled

a guest
Jun 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import uuid
  2. from django.db import models
  3. from django.utils.text import gettext_lazy as _
  4.  
  5. class Course(models.Model):
  6. id = models.UUIDField(
  7. _('id'),
  8. default=uuid.uuid4,
  9. primary_key=True,
  10. editable=False,
  11. unique=True
  12. )
  13. name = models.CharField(_('name of the course'), max_length=100)
  14. code = models.CharField(_('code for the subject'), max_length=10, unique=True)
  15. description = models.TextField(_('optional description for the course'), blank=True, null=True)
  16.  
  17. class Meta:
  18. db_table = 'courses'
  19.  
  20. def __str__(self):
  21. return '%s-%s'%(self.code, self.name)
Add Comment
Please, Sign In to add comment