示例#1
0
class UpdatePlaceForm(forms.Form):
    title = forms.CharField(max_length=100, help_text='Enter a place name')
    location = forms.PointField(widget=forms.OSMWidget(attrs={
        'map_width': 800,
        'map_height': 500
    }))
    description = forms.CharField(max_length=500,
                                  help_text='Enter a place description')
    address = forms.CharField(max_length=250,
                              help_text='Enter a place address')
    phone = forms.CharField(max_length=10, help_text='Enter a phone number')
    city = forms.ModelChoiceField(queryset=City.objects.all())
    PLACE_TYPE = (
        ('a', 'Park'),
        ('b', 'Restaurant'),
        ('c', 'Mall'),
        ('d', 'Amusement park'),
        ('e', 'Museum'),
        ('f', 'Beach'),
        ('g', 'Theater'),
        ('h', 'Lodge'),
        ('i', 'Others'),
    )
    type_of_place = forms.ChoiceField(
        choices=PLACE_TYPE,
        help_text='Place Type',
    )
示例#2
0
class AddDeviceForm(forms.Form):
    name = forms.CharField(widget=forms.TextInput(attrs={
        "placeholder": "Name",
        "class": "form-control"
    }))
    location = forms.PointField(widget=forms.OSMWidget(attrs={
        'map_width': 1000,
        'map_height': 500
    }))

    class Meta:
        model = Device
        fields = ('name', 'location')
        widgets = {'location': LeafletWidget()}

    class Media:
        css = {
            'all': (
                'https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.1/ol.css',
                'gis/css/ol3.css',
            )
        }
        js = (
            'https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.1/ol.js',
            'gis/js/OLMapWidget.js',
        )
示例#3
0
class cayxanhForm(ModelForm):
    geom = forms.PointField(widget=LeafletWidget(attrs=LEAFLET_WIDGET_ATTRS))

    class Meta:
        model = cayxanh
        fields = ('ma_cay', 'ten_cay', 'chieucao', 'vitri', 'ngaytrong',
                  'tinhtrang_id', 'dacdiem', 'geom', 'duong_id', 'loaicay_id')
示例#4
0
    class Meta:
        model = Project
        fields = (
            "naam",
            "nummer",
            "organisaties",
            "vhe",
            "pensioenfonds",
            "statuscontract",
            "plaats",
        )
        geom = forms.PointField()
        labels = {
            "naam": "Projectnaam:",
            "nummer": "Projectnummer:",
            "plaats": "Plaats:",
            "vhe": "Aantal verhuureenheden:",
            "pensioenfonds": "Pensioenfonds:",
            "statuscontract": "Contractstatus:",
        }

        widgets = {
            "point":
            forms.OSMWidget(attrs={
                "default_lat": 52.37,
                "default_lon": 4.895,
            }),
        }
示例#5
0
class StartProjectForm(ModelForm):
    plaats = forms.PointField(widget=forms.OSMWidget(attrs={
        "default_lat": 52.37,
        "default_lon": 4.895,
    }))

    class Meta:
        model = Project
        fields = (
            "belegger",
            "projectmanager",
            "naam",
            "nummer",
            "vhe",
            "pensioenfonds",
            "plaats",
        )
        geom = forms.PointField()
        labels = {
            "belegger": "Belegger:",
            "projectmanager": "Projectmanager:",
            "naam": "Projectnaam:",
            "nummer": "Projectnummer:",
            "plaats": "Plaats:",
            "vhe": "Aantal verhuureenheden:",
            "pensioenfonds": "Pensioenfonds:",
        }
        widgets = {
            "point":
            forms.OSMWidget(attrs={
                "default_lat": 52.37,
                "default_lon": 4.895,
            })
        }
示例#6
0
class NewUserForm(UserCreationForm):
    email = forms.EmailField(
        label=_("Email"),
        required=True,
        help_text=_("(Απαραίτητο! Εισάγετε το email σας σε έγκυρη μορφή.)"))
    address = forms.PointField(label='Διεύθυνση Κατοικίας',
                               widget=LeafletWidget())
    password1 = forms.CharField(
        label=_("Password"),
        widget=forms.PasswordInput,
        help_text=
        _("(Τουλάχιστον 8 χαρακτήρες!	Όχι ίδιο με προσωπικά στοιχεία!	Όχι μόνο αριθμούς!	Όχι συνηθισμένα passwords!)"
          ))
    password2 = forms.CharField(
        label=_("Επαλήθευση Password"),
        widget=forms.PasswordInput,
        help_text=_(
            "(Ξανά-εισάγετε το ίδιο password, όπως πριν, για επαλήθευση!)"))

    class Meta:
        model = User_Res
        fields = ("email", "username", "password1", "password2", "address",
                  "first_name", "last_name", "car_driver", "cellphone",
                  "visitor", "visit_time")
        labels = {
            "first_name": _('Όνομα'),
            "last_name": _('Επίθετο'),
            "username": _('Username'),
        }
        help_texts = {
            "username":
            '******',
        }
        widgets = {
            "visit_time": DatePickerInput(format='%d/%m/%Y'),
            "address": LeafletWidget(),
        }

    def save(self, commit=True):
        user = super(NewUserForm, self).save(commit=False)
        user.email = self.cleaned_data['email']
        if commit:
            user.is_staff = True
            user.save()
        return user
示例#7
0
class BusinessForm(forms.ModelForm):
    """
    form to create neighbourhood by users
    """
    location = forms.PointField(widget=forms.OSMWidget(attrs={
        'map_width': 1024,
        'map_height': 600
    }))

    class Meta:
        model = Business
        fields = [
            'id', 'name', 'owner_name', 'national_id', 'phone', 'email',
            'postal_address', 'status', 'opening_days', 'opening', 'closing',
            'address', 'country', 'county', 'city', 'town', 'village',
            'location', 'description', 'company', 'image', 'image1', 'image2',
            'image3', 'image4', 'image5', 'category', 'verified'
        ]
示例#8
0
class HousingForm(forms.ModelForm):
    """
    Form to Create Posts
    """
    location = forms.PointField(widget=forms.OSMWidget(attrs={
        'map_width': 1024,
        'map_height': 600
    }))

    class Meta:
        model = Housing
        fields = [
            'id', 'name', 'owner_name', 'national_id', 'phone', 'email',
            'postal_address', 'status', 'opening_days', 'opening', 'closing',
            'address', 'country', 'county', 'city', 'town', 'village',
            'location', 'description', 'company', 'image', 'image1', 'image2',
            'image3', 'image4', 'image5', 'size', 'firnished', 'unfirnished',
            'amenities', 'price', 'mode_of_payment', 'category', 'verified'
        ]
示例#9
0
class MyGeoForm(forms.Form):
    point = forms.PointField(widget=forms.OSMWidget(attrs={'map_width': 800, 'map_height': 500}))