Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import uuid
- from django.db import models
- from django.utils.text import gettext_lazy as _
- class Course(models.Model):
- id = models.UUIDField(
- _('id'),
- default=uuid.uuid4,
- primary_key=True,
- editable=False,
- unique=True
- )
- name = models.CharField(_('name of the course'), max_length=100)
- code = models.CharField(_('code for the subject'), max_length=10, unique=True)
- description = models.TextField(_('optional description for the course'), blank=True, null=True)
- class Meta:
- db_table = 'courses'
- def __str__(self):
- return '%s-%s'%(self.code, self.name)
Add Comment
Please, Sign In to add comment