예제 #1
0
class ProfileUpdateForm(forms.ModelForm):
    location = PointField()

    class Meta:
        model = Profile
        fields = ['location']
        widgets = {'location': LeafletWidget()}
예제 #2
0
파일: views.py 프로젝트: EMasha/Newfolder
class PronaAdd(forms.ModelForm):
    geom = PointField()

    class Meta:
        model = prona
        fields = [
            'id_vendodhje',
            'id_lloji',
            'cmimi',
            'dhoma',
            'banjo',
            'size',
            'titulli',
            'pershkrim',
            'id_biznes',
            'status',
            'url',
            'hits',
            'creation_date',
            'modif_date',
            'sponsorizuar',
            'geom',
            'id_user',
        ]
        widgets = {'geom': YourMapWidget()}
예제 #3
0
class BikerRegistrationForm(UserCreationForm):
    email = forms.EmailField(required=True)
    area_of_business = PointField()

    class Meta:
        model = bikemodel.Biker
        fields = ('username', 'first_name', 'last_name', 'email', 'password1',
                  'password2', 'date_of_birth', 'id_number', 'residence',
                  'mobile_number', 'vehiecle', 'area_of_business')
        widgets = {'area_of_business': LeafletWidget()}

    def save(self, commit=True):
        user = super(FoodbusinessRegistrationForm, self).save(commit=False)
        user.first_name = self.cleaned_data['first_name']
        user.last_name = self.cleaned_data['last_name']
        user.email = self.cleaned_data['email']
        user.date_of_birth = self.cleaned_data['date_of_birth']
        user.id_number = self.cleaned_data['id_number']
        user.residence = self.cleaned_data['residence']
        user.mobile_number = self.cleaned_data['mobile_number']
        user.vehiecle = self.cleaned_data['vehiecle']
        user.area_of_business = self.cleaned_data['area_of_business']

        if commit:
            user.save()
        return user
예제 #4
0
class CreatePlaceForm(ModelForm):

    location = PointField()
    description = forms.CharField(widget=forms.Textarea(
        attrs={
            'rows': 5,
            'placeholder': 'Short description about the place',
        }),
                                  max_length=1000,
                                  help_text='Maximum 1000 characters')
    address = forms.CharField(widget=forms.Textarea(attrs={
        'rows': 5,
    }),
                              max_length=200,
                              help_text='Maximum 200 characters')

    class Meta:
        model = Place
        fields = (
            'title',
            'location',
            'description',
            'address',
            'phone',
            'city',
            'types',
            'tags',
        )
class SpaceTimeForm(forms.Form):
    location = PointField(label='Possible Contagion Site')
    start_date = forms.DateField(input_formats=['%Y-%m-%d'],
                                 widget=XDSoftDatePickerInput(),
                                 label='START')
    end_date = forms.DateField(input_formats=['%Y-%m-%d'],
                               widget=XDSoftDatePickerInput(),
                               label='END')
class SpaceTimeForm(forms.Form):
    location = PointField(
        label='Possible Contagion Site'
    )
    time = forms.DateTimeField(
        input_formats=['%d/%m/%Y %H:%M'],
        widget=XDSoftDateTimePickerInput(),
        label = 'Date+Time'
    )
예제 #7
0
class HelpRequestForm(forms.ModelForm):
    location = PointField(
        label="Ubicación",
        error_messages={
            'required':
            mark_safe(
                'Te olvidaste de marcar tu ubicación en el mapita\n <br>Si tenés problemas con este paso <a href="#" class="is-link modal-button" data-target="#myModal" aria-haspopup="true">mirá esta ayuda</a></p><p id="div_direccion" style="font-size: 10px; margin-bottom: 5px;"></p>'
            )
        },
        help_text=mark_safe(
            '<p style="margin-bottom:5px;font-size:10px;">Seleccioná tu ubicación para que la gente pueda encontrarte, si no querés marcar tu casa una buena opción puede ser la comisaría más cercana o algún otro sitio público cercano.\
            <br>Si tenés problemas con este paso <a href="#" class="is-link modal-button" data-target="#myModal" aria-haspopup="true">mirá esta ayuda</a></p><p id="div_direccion" style="font-size: 10px; margin-bottom: 5px;"></p>'
        ),
    )

    class Meta:
        model = HelpRequest
        fields = ("title", "message", "categories", "name", "phone",
                  "location", "address", "picture")
        widgets = {
            "title":
            forms.TextInput(
                attrs={
                    "class":
                    "input",
                    "placeholder":
                    "Ejemplo: Necesito de manera urgente víveres para mi familia",
                }),
            "message":
            forms.Textarea(
                attrs={
                    "class":
                    "textarea",
                    "rows":
                    4,
                    "placeholder":
                    "Ejemplo: Por la situación actual estoy necesitando tapabocas y productos de limpieza, \
                        cualquier ayuda aunque sea mínima ya me va a ayudar.\nMuchas Gracias!",
                }),
            "name":
            forms.TextInput(attrs={"class": "input"}),
            "phone":
            forms.TextInput(attrs={
                "class": "input",
                "type": "tel"
            }),
            "address":
            forms.TextInput(attrs={"class": "input"}),
            'categories':
            forms.SelectMultiple(attrs={"style": "display:none;"}),
        }
        error_messages = {
            NON_FIELD_ERRORS: {
                'unique_together':
                "Registro ya ingresado, no puede duplicar mismo pedido.",
            }
        }
class ContagionSiteForm(forms.Form):
    location = PointField(label='Possible Contagion Site')
    start_date = forms.DateField(input_formats=['%Y-%m-%d'],
                                 widget=XDSoftDatePickerInput(),
                                 label='START')
    end_date = forms.DateField(input_formats=['%Y-%m-%d'],
                               widget=XDSoftDatePickerInput(),
                               label='END')
    radius = forms.ChoiceField(widget=BootstrapSelect(choices=radii),
                               choices=radii)
예제 #9
0
class x(models.Model):
    SB = models.CharField(max_length=255)
    latitude = models.PointField()
    longitude = models.PointField()

    def __str__(self):
        return self.SB

    point = PointField()

    @property
    def lat_lon(self):
        return list(getattr(self.point, 'COORDINATES', [])[::-1])
class ConfirmedCaseFormOld(forms.Form):
    location = PointField(label='Approximate Current Residence')
    estimated_date_contracted = forms.DateTimeField(
        input_formats=['%d/%m/%Y %H:%M'],
        widget=XDSoftDateTimePickerInput(),
        label='Estimated Date Contracted')
    date_confirmed = forms.DateTimeField(input_formats=['%d/%m/%Y %H:%M'],
                                         widget=XDSoftDateTimePickerInput(),
                                         label='Date Confirmed')
    additional_info = forms.CharField(widget=forms.Textarea,
                                      label='Additional Information')
    contagion_sites = MultiPointField(
        label='Locations Visited Since Contraction')
예제 #11
0
class PlaceForm(forms.ModelForm):
    geom = PointField(label='Укажите место на карте')

    class Meta:
        model = Place
        fields = ('name', 'geom', 'comment')

    def save(self, user):
        new_place = Place.objects.create(name=self.cleaned_data['name'],
                                         location=self.cleaned_data['geom'],
                                         comment=self.cleaned_data['comment'],
                                         author=user)
        return new_place
class ContagionSiteForm(forms.Form):
    location = PointField(
        label='Possible Contagion Site'
    )
    start_time = forms.DateTimeField(
        input_formats=['%d/%m/%Y %H:%M'],
        widget=XDSoftDateTimePickerInput(),
        label = 'Start Time'
    )
    end_time = forms.DateTimeField(
        input_formats=['%d/%m/%Y %H:%M'],
        widget=XDSoftDateTimePickerInput(),
        label = 'End Time'
    )
예제 #13
0
class PlaceForm(forms.ModelForm):
    name = forms.CharField(max_length=100,
                           help_text="Scan project name",
                           required=True)
    location = PointField()
    description = forms.CharField(widget=forms.Textarea)

    class Meta:
        model = Place
        fields = (
            'name',
            'description',
            'location',
        )
예제 #14
0
class FrmLocal(forms.Form):

    descricao = forms.CharField(widget=forms.Textarea(attrs={'cols': 80, 'rows': 4}))
    geojson = forms.CharField(widget=forms.Textarea(attrs={'cols': 80, 'rows': 20}), required=False)
    poligono = MultiPolygonField(required=False)
    ponto = PointField(required=False)
    linha = MultiLineStringField(required=False)


    class Meta:
        fields = ('descricao ', 'geojson')
        widgets = {'poligono': LeafletWidget(),
                   'ponto': LeafletWidget(),
                   'linha': LeafletWidget()
                   }
예제 #15
0
class BusinessRegistrationForm(forms.ModelForm):
    location = PointField()

    class Meta:
        model = bizmodel.Business
        fields = (
            'business_name',
            'mobile_number',
            'location',
        )
        widgets = {'location': LeafletWidget()}

    def save(self, commit=True):
        user = super(BusinessRegistrationForm, self).save(commit=False)
        user.business_name = self.cleaned_data['business_name']
        user.mobile_number = self.cleaned_data['mobile_number']
        user.location = self.cleaned_data['location']
        if commit:
            user.save()
        return user
예제 #16
0
class IncidenceForm(forms.ModelForm):
    geom = PointField()

    class Meta:
        model = Incidence
        fields = '__all__'
예제 #17
0
class LawyerForm(forms.ModelForm):
    location = PointField()

    class Meta:
        model = Lawyer
        fields = '__all__'
예제 #18
0
class HelpRequestForm(forms.ModelForm):
    location = PointField(
        label="Ubicación",
        # XXX Move all HTML to the corresponding templates
        error_messages={
            'required':
            mark_safe(
                '{}\n<br>{} <a href="#" class="is-link modal-button" data-target="#myModal" aria-haspopup="true">{}</a></p><p id="div_direccion" style="font-size: 10px; margin-bottom: 5px;"></p>'
                .format(
                    _("You forgot to mark your location on the map"),
                    _("If you have problems with this step"),
                    _("Check out this help"),
                ))
        },
        help_text=mark_safe(
            '<p style="margin-bottom:5px;font-size:10px;">{}.<br>{} <a href="#" class="is-link modal-button" data-target="#myModal" aria-haspopup="true">{}</a></p><p id="div_direccion" style="font-size: 10px; margin-bottom: 5px;"></p>'
            .format(
                _("Select your location so that people can find you, if you do not want to mark your home a good option may be the nearest police station or some other nearby public place."
                  ),
                _("If you have problems with this step"),
                _("Check out this help"),
            )),
    )

    class Meta:
        model = HelpRequest
        fields = ("title", "message", "categories", "name", "phone",
                  "location", "address", "picture")
        widgets = {
            "title":
            forms.TextInput(
                attrs={
                    "class":
                    "input",
                    "placeholder":
                    _("Example: I urgently need food for my family"),
                }),
            "message":
            forms.Textarea(
                attrs={
                    "class":
                    "textarea",
                    "rows":
                    4,
                    "placeholder":
                    _("Example: Due to the current situation I am in need of masks and cleaning products, any help, even a minimal one, will help me. Thank you so much!"
                      ),
                }),
            "name":
            forms.TextInput(attrs={"class": "input"}),
            "phone":
            forms.TextInput(attrs={
                "class": "input",
                "type": "tel"
            }),
            "address":
            forms.TextInput(attrs={"class": "input"}),
            'categories':
            forms.SelectMultiple(attrs={"style": "display:none;"}),
        }
        error_messages = {
            NON_FIELD_ERRORS: {
                'unique_together':
                _("Registration already entered, cannot duplicate the same request."
                  ),
            }
        }
예제 #19
0
class LeafForm(forms.ModelForm):
    geom = PointField()

    class Meta:
        model = Leaf
        fields = ('name', 'geom')
예제 #20
0
class HelpRequestForm(forms.ModelForm):
    location = PointField(
        label="Ubicación:",
        error_messages={
            'required':
            mark_safe(
                'Te olvidaste de marcar tu ubicación en el mapita\n <br>Si tienes un problemas con este paso \
            <a href="#" class="is-link modal-button" data-target="#myModal" aria-haspopup="true">mira esta ayuda</a></p>\
            <p id="div_direccion" style="font-size: 10px; margin-bottom: 5px;"></p>'
            )
        },
        help_text=mark_safe(
            '<p style="margin-bottom:5px;font-size:10px;">Selecciona tu Ubicación para que las personas solidarias te puedan encontrar.\
            <br>Si tienes un problemas con este paso \
                <a href="#" class="is-link modal-button" data-target="#myModal" aria-haspopup="true">mira esta ayuda</a></p>\
                <p id="div_direccion" style="font-size: 10px; margin-bottom: 5px;"></p>'
        ),
    )

    class Meta:
        model = HelpRequest

        fields = ("title", "message", "categories", "name", "phone",
                  "provincia", "location", "address", "picture")
        widgets = {
            "title":
            forms.TextInput(
                attrs={
                    "class":
                    "input",
                    "placeholder":
                    "Ejemplo: Necesito de manera urgente víveres para mi familia",
                }),
            "message":
            forms.Textarea(
                attrs={
                    "class":
                    "textarea",
                    "rows":
                    4,
                    "placeholder":
                    "Puedes describir detalladamente lo que necesites, ",
                }),
            "name":
            forms.TextInput(attrs={"class": "input"}),
            "phone":
            forms.TextInput(attrs={
                "class": "input",
                "type": "tel"
            }),
            "address":
            forms.TextInput(attrs={"class": "input"}),
            'categories':
            forms.SelectMultiple(attrs={"style": "display:none;"}),
            "provincia":
            forms.Select(attrs={
                "id": "provicia_id",
                "placeholder": "Seleccione una provincia"
            }),
        }
        error_messages = {
            NON_FIELD_ERRORS: {
                'unique_together':
                "Registro ya ingresado, no puede duplicar mismo pedido.",
            }
        }
예제 #21
0
class SearchForm(SingleButtonMixin, forms.Form):
    point = PointField()

    def __init__(self, *args, **kwargs):
        super(SearchForm, self).__init__(*args, **kwargs)
        self.helper.form_method = 'get'
예제 #22
0
class HelpRequestForm(forms.ModelForm):
    location = PointField(
        label="Ubicación",
        error_messages={
            'required':
            mark_safe(
                '<p>Te olvidaste de marcar tu ubicación en el mapita.\n <br>Si tenés problemas con este paso <a href="#" class="is-link modal-button error-message-hyperlink" data-target="#myModal" aria-haspopup="true">mirá esta ayuda</a></p><p id="div_direccion" style="font-size: 10px; margin-bottom: 5px;"></p>'
            )
        },
        help_text=mark_safe(
            '<p>Seleccioná tu ubicación para que la gente pueda encontrarte, si no querés marcar tu casa una buena opción puede ser la comisaría más cercana o algún otro sitio público cercano.</p><p class="help text-muted has-text-left"><i class="fas fa-info-circle"></i>&nbsp;&nbsp;Si tenés problemas con este paso <a href="#" class="is-link modal-button" data-target="#myModal" aria-haspopup="true">mirá esta ayuda</a></p>'
        ),
    )

    class Meta:
        model = HelpRequest
        fields = ("title", "message", "categories", "name", "phone",
                  "location", "address", "picture")
        widgets = {
            "title":
            forms.TextInput(
                attrs={
                    "id":
                    "title",
                    "class":
                    "input",
                    "placeholder":
                    "Ejemplo: Necesito de manera urgente víveres para mi familia",
                }),
            "message":
            forms.Textarea(
                attrs={
                    "id":
                    "message",
                    "class":
                    "textarea",
                    "rows":
                    4,
                    "minlength":
                    20,
                    "placeholder":
                    "Ejemplo: Por la situación actual estoy necesitando tapabocas y productos de limpieza, cualquier ayuda aunque sea mínima ya me va a ayudar. ¡Muchas Gracias!",
                }),
            "name":
            forms.TextInput(
                attrs={
                    "id": "name",
                    "class": "input",
                    'pattern': '[A-Za-zÁÉÍÓÚáéíóúñÑ ]+',
                    'title': 'Ingrese solo letras.',
                    "placeholder": "Nombre completo",
                }),
            "phone":
            forms.TextInput(
                attrs={
                    "id": "phone",
                    "class": "input",
                    "type": "tel",
                    'pattern': '\+?1?\d{8,15}$',
                    'title': 'Ingrese solo números y una cantidad mayor a 7.',
                    "placeholder": "Teléfono",
                }),
            "address":
            forms.TextInput(attrs={
                "id": "address",
                "class": "input",
                "placeholder": "Dirección",
            }),
            "picture":
            forms.FileInput(attrs={"id": "picture"}),
            'categories':
            forms.SelectMultiple(attrs={
                "id": "categories",
                "style": "display:none;"
            }),
        }
        error_messages = {
            NON_FIELD_ERRORS: {
                'unique_together':
                "Registro ya ingresado, no puede duplicar mismo pedido.",
            }
        }

    def clean_phone(self):
        phone = self.data.get('phone')
        if not re.match(r"\+?1?\d{9,15}$", f'+54{phone}'):
            raise forms.ValidationError('Ingrese un número de teléfono válido')
        return phone
예제 #23
0
파일: models.py 프로젝트: lelouchwhite/swat
class WeatherStationForm(forms.ModelForm):
    geom = PointField()

    class Meta:
        model = WeatherStation
        fields = ('name', 'geom')