muammo va yordam sorash uchun api chiqarildi

This commit is contained in:
behruz-dev
2025-12-03 15:40:55 +05:00
parent d7d7f23dca
commit 9276124cea
9 changed files with 164 additions and 1 deletions

View File

@@ -8,3 +8,4 @@ from .plan import *
from .location import *
from .tour_plan import *
from .factory import *
from .support import *

View File

@@ -0,0 +1,24 @@
# django
from django.db import models
# shared
from core.apps.shared.models import BaseModel, District
# accounts
from core.apps.accounts.models import User
class Support(BaseModel):
TYPE = (
('PROBLEM', 'muammo'),
('HELP', 'yordam'),
)
district = models.ForeignKey(District, on_delete=models.CASCADE, related_name='supports')
problem = models.TextField()
date = models.DateField()
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='supports')
type = models.CharField(choices=TYPE, default="PROBLEM", max_length=8)
def __str__(self):
return f"#{self.id} problem from {self.user.first_name} {self.user.last_name}"