Example #1
0
class ReportAdminForm(forms.ModelForm):
    reported_at = PointField(required=False,
                             widget=GooglePointFieldWidget,
                             srid=4326)

    class Meta(object):
        model = Report
        exclude = []
Example #2
0
class AmbulanceCreateForm(forms.ModelForm):
    location = PointField(widget=LeafletPointWidget(attrs={
        'map_width': 500,
        'map_height': 300
    }))

    class Meta:
        model = Ambulance
        fields = ['identifier', 'capability', 'status', 'comment', 'location']
Example #3
0
class PincodeAdminForm(forms.ModelForm):

    located_at = PointField(required=True,
                            widget=GooglePointFieldWidget,
                            srid=4326)

    class Meta(object):
        model = Pincode
        exclude = []
Example #4
0
class GeoUserForm(ModelForm):
    default_center_point = PointField(label='Click a point for your location',
                                      widget=OSMWidget(
                                          attrs={'default_lat': 40, 'default_lon': -84, 'default_zoom': 12,
                                                 'template_name': 'gis/openlayers-osm.html',
                                                 }
                                      ))

    class Meta:
        model = GeoUser
        fields = ['default_center_point']
Example #5
0
class ChildDataSerialiser(serializers.ModelSerializer):
    location = PointField()

    class Meta:
        model = ChildData
        fields = "__all__"

    def validate(self, attrs):
        if (not attrs.get("parent_id") or attrs.get("parent_id") == "") and attrs.get("is_orphan") is False:
            raise serializers.ValidationError("Non Orphan child must register with parent details")
        return super(ChildDataSerialiser, self).validate(attrs)
Example #6
0
class LocationAdminCreateForm(forms.ModelForm):
    location = PointField(widget=LeafletPointWidget(attrs={
        'map_width': 500,
        'map_height': 300
    }))

    class Meta:
        model = Location
        fields = [
            'name', 'type', 'number', 'street', 'unit', 'neighborhood', 'city',
            'state', 'zipcode', 'country', 'location', 'comment'
        ]
Example #7
0
class ServiceForm(forms.ModelForm):
    type = forms.ModelChoiceField(queryset=ServiceType.objects.all(),
                                  widget=ServiceTypeWidget)
    provider = forms.ModelChoiceField(queryset=Provider.objects.all(),
                                      widget=ProviderWidget)
    location = PointField(widget=PointWidget)

    class Meta:
        model = Service
        exclude = ['status']
        # Setting fields to '__all__' here is reasonably safe since we
        # are careful elsewhere to only export and import certain fields.
        fields = '__all__'
Example #8
0
class HospitalCreateForm(forms.ModelForm):
    location = PointField(label=_('Location'),
                          widget=LeafletPointWidget(attrs={
                              'map_width': 500,
                              'map_height': 300
                          }))

    class Meta:
        model = Hospital
        fields = [
            'name', 'number', 'street', 'unit', 'neighborhood', 'city',
            'state', 'zipcode', 'country', 'active', 'comment', 'location'
        ]
Example #9
0
class LocationAdminForm(forms.ModelForm):
    state = forms.CharField(max_length=50,
                            widget=forms.Select(choices=settings.STATE_CHOICES))
    point = PointField(widget=LeafletMapWidget())

    def clean_sub_district_name(self):
        sub_district_name = self.cleaned_data["sub_district_name"]
        sub_district_type = self.cleaned_data["sub_district_type"]
        if not sub_district_type and sub_district_name:
            raise forms.ValidationError(_("Sub district type has to be chosen first"))
        return sub_district_name

    class Meta:
        model = Location
        fields = ["point", "name", "district", "region", "state", "panchayat", "sub_district_type", "sub_district_name"]
Example #10
0
class RememberForm(ModelForm):
    location = PointField(widget=OSMWidget(attrs={'map_width': 800, 'map_height': 500}))

    class Meta:
        model = RememberCards

        fields = ['location_name',  'image', 'notes']

        widgets = {
            "location_name": TextInput(attrs={
                "class": "form-control",
                "placeholder": "Воспоминание о "
            }),
            "image": FileInput,
            "notes": Textarea(attrs={
                "class": "Вставте фотографию",
                "placeholder": "Заметки"
            })
        }
Example #11
0
class TicketReadonlyForm(forms.Form):
    subject = forms.CharField()
    location = PointField(widget=GoogleStaticOverlayMapWidget)


# class MissionForm(forms.ModelForm):
#     class Meta:
#         model = Mission
#         fields = '__all__'

#     def form_valid(self, form):
#         # self.object = form.save()

#         # do something with self.object
#         # remember the import: from django.http import HttpResponseRedirect
#         return HttpResponseRedirect(self.get_success_url())

#     def form_invalid(self, form):
#         print(sys.stderr, "Form was invalid")
#         return HttpResponseRedirect(self.get_success_url())
Example #12
0
class ServiceAdminForm(forms.ModelForm):
    location = PointField(widget=LocationWidget())

    class Meta:
        exclude = []
        model = Service
Example #13
0
class ComplaintSerialiser(serializers.ModelSerializer):
    location = PointField()

    class Meta:
        model = Complaint
        fields = "__all__"