2025-08-29 11:27:38 +05:30
|
|
|
from django import forms
|
2025-05-22 15:48:58 +05:30
|
|
|
from django.template.loader import render_to_string
|
2025-12-23 05:40:04 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2025-05-09 11:14:51 +05:30
|
|
|
|
|
|
|
|
from base.forms import ModelForm
|
2025-05-22 15:48:58 +05:30
|
|
|
|
2025-05-09 11:14:51 +05:30
|
|
|
from .models import GeoFencing
|
2025-05-22 15:48:58 +05:30
|
|
|
|
2025-05-09 11:14:51 +05:30
|
|
|
|
|
|
|
|
class GeoFencingSetupForm(ModelForm):
|
2025-12-23 05:40:04 +00:00
|
|
|
verbose_name = _("Geofence Configuration")
|
2025-05-22 15:48:58 +05:30
|
|
|
|
2025-05-09 11:14:51 +05:30
|
|
|
class Meta:
|
|
|
|
|
model = GeoFencing
|
2025-08-29 11:27:38 +05:30
|
|
|
fields = "__all__"
|
|
|
|
|
widgets = {"company_id": forms.HiddenInput()}
|
2025-05-09 11:14:51 +05:30
|
|
|
|
|
|
|
|
def as_p(self):
|
|
|
|
|
"""
|
|
|
|
|
Render the form fields as HTML table rows with Bootstrap styling.
|
|
|
|
|
"""
|
|
|
|
|
context = {"form": self}
|
|
|
|
|
table_html = render_to_string("common_form.html", context)
|
|
|
|
|
return table_html
|