mirror of
https://github.com/fergalmoran/dss.api.git
synced 2025-12-27 11:48:06 +00:00
20 lines
617 B
Python
20 lines
617 B
Python
from django.db import models
|
|
from core.utils.url import unique_slugify
|
|
from spa.models.basemodel import BaseModel
|
|
|
|
|
|
class Genre(BaseModel):
|
|
class Meta:
|
|
app_label = 'spa'
|
|
|
|
description = models.CharField(max_length=100)
|
|
slug = models.CharField(max_length=100, null=True)
|
|
|
|
def save(self, force_insert=False, force_update=False, using=None):
|
|
if not self.slug:
|
|
self.slug = unique_slugify(self, self.description, slug_separator='_')
|
|
|
|
super(Genre, self).save(force_insert, force_update, using)
|
|
|
|
def __unicode__(self):
|
|
return self.description |