123456789101112131415 |
- from django.contrib.auth.models import User
- from django.db import models
- from django.db.models import Model
- from mptt.models import MPTTModel, TreeForeignKey
- # Create your models here.
- class Genre(MPTTModel):
- name = models.CharField(max_length=50, unique=True)
- parent = TreeForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='children')
- class MPTTMeta:
- order_insertion_by = ['name']
|