#50 feat: add StoreSettings model and API for store address and map coordinates
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
from .store_settings import StoreSettings
|
||||
|
||||
__all__ = ["StoreSettings"]
|
||||
|
||||
20
tienda_ilusion/don_confiao/models/store_settings.py
Normal file
20
tienda_ilusion/don_confiao/models/store_settings.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class StoreSettings(models.Model):
|
||||
address = models.TextField()
|
||||
latitude = models.FloatField(null=True, blank=True)
|
||||
longitude = models.FloatField(null=True, blank=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Configuración de la tienda"
|
||||
verbose_name_plural = "Configuración de la tienda"
|
||||
|
||||
def __str__(self):
|
||||
return f"StoreSettings (id={self.id})"
|
||||
|
||||
@classmethod
|
||||
def get_singleton(cls):
|
||||
instance, _ = cls.objects.get_or_create(pk=1)
|
||||
return instance
|
||||
Reference in New Issue
Block a user