You've already forked Promocode-API
mirror of
https://github.com/devitq/Promocode-API.git
synced 2026-05-22 23:17:10 +00:00
feat: added business models, implemented business signup and signin
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CoreConfig(AppConfig):
|
||||
name = "apps.core"
|
||||
label = "core"
|
||||
@@ -0,0 +1,23 @@
|
||||
import uuid
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
|
||||
from config.errors import UniqueConstraintError
|
||||
|
||||
|
||||
class BaseModel(models.Model):
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def save(self, *args, **kwargs) -> None: # noqa: ANN002, ANN003
|
||||
self.full_clean(validate_unique=False)
|
||||
|
||||
try:
|
||||
self.validate_unique()
|
||||
except ValidationError as e:
|
||||
raise UniqueConstraintError(e) from None
|
||||
|
||||
super().save(*args, **kwargs)
|
||||
Reference in New Issue
Block a user