feat: added advertiser and campaign apps

This commit is contained in:
ITQ
2025-02-20 22:54:28 +03:00
parent 4793973233
commit 0f77f9eb73
24 changed files with 1580 additions and 0 deletions
@@ -0,0 +1,35 @@
from typing import Any
from django import forms
from apps.campaign.models import Campaign, CampaignReport
class CampaignForm(forms.ModelForm):
class Meta:
model = Campaign
fields = "__all__"
def clean(self) -> dict[str, Any]:
cleaned_data = super().clean()
location = cleaned_data.get("location")
if location == "":
cleaned_data["location"] = None
return cleaned_data
class CampaignReportForm(forms.ModelForm):
class Meta:
model = CampaignReport
fields = "__all__"
def clean(self) -> dict[str, Any]:
cleaned_data = super().clean()
message = cleaned_data.get("message")
if message == "":
cleaned_data["message"] = None
return cleaned_data