示例#1
0
class RememberForm(forms.ModelForm):
    city = forms.ChoiceField(label="Выбрать город", required=True)
    place = forms.CharField(max_length=512, label="Место", required=True, widget=forms.TextInput(attrs={'class':'form-control'}))
    description = forms.CharField(label="Описание", required=False, widget=forms.TextInput(attrs={'class':'form-control'}))
    date = forms.DateField(widget=forms.SelectDateWidget, label="Дата", required=True)
    point = gis_forms.PointField(
        widget=gis_forms.OSMWidget(
            attrs={'map_width': 800, 'map_height': 500}
        )
    )

    class Meta:
        model = models.Remember
        exclude = ["user"]

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields["city"].choices = self.get_cities_choice()

    def get_cities_choice(self):
        cities = models.City.objects.all().order_by("-people_population")
        return (
            (city.id, city.name) 
            for city in cities
        )

    def clean(self):
        cleaned_data = self.cleaned_data
        city_id = cleaned_data.pop("city")
        city = models.City.objects.get(pk=city_id)
        cleaned_data["city"] = city
        return cleaned_data
示例#2
0
class LocationForm(geoforms.Form):
    class Meta:
        model = Photo
        fields = ['geom']
    # point = geoforms.PointField()
    point = geoforms.PointField(widget=
        geoforms.OSMWidget(attrs={'map_width': 800, 'map_height': 500}))

# class LocationForm(geoforms.gis.PointWidget, geoforms.gis.BaseGMapWidget):
#     pass

# class LocationForm(geoforms.Form):
#     class Meta:
#         model = Photo
#         fields = ['geom']

#     point = geoforms.gis.PointField()


# class ReadSingleLocationForm(geoforms.Form):
#     class Meta:
#         model = Photo
#         fields = ['geom']
#         readonly_fields = ['geom']

#     point = geoforms.gis.PointField()
示例#3
0
class CartForm(geoforms.Form):

    pin = geoforms.PointField(widget=geoforms.OSMWidget(
        attrs={
            'map_width': '100%',
            'map_height': 'auto',
            'default_lat': -1.2921,
            'default_lon': 36.8219,
            'default_zoom': 13
        }))
    # Must be filled if point is NULL || Blank
    floor = geoforms.CharField(
        label="Floor",
        widget=geoforms.TextInput(attrs={
            'class': 'form-control',
            'placeholder': 'Floor',
            'id': 'floor'
        }))
    street = geoforms.CharField(
        label="Street",
        widget=geoforms.TextInput(attrs={
            'class': 'form-control',
            'placeholder': 'Street',
            'id': 'street'
        }))
    apt = geoforms.CharField(
        label="Apartment",
        widget=geoforms.TextInput(attrs={
            'class': 'form-control',
            'placeholder': 'Apartment',
            'id': 'apt'
        }))
class SubscriptionPreviewForm(forms.Form):
    center = forms.PointField(
        help_text="With the radius, determines the notification area.",
        srid=4326)
    radius = DistanceField(min_value=D(ft=100),
                           max_value=D(mi=1),
                           initial=D(ft=300))
    region_name = forms.ChoiceField(choices=(("Somerville, MA",
                                              "Somerville, MA"), ),
                                    initial=settings.GEO_REGION)
    start = forms.DateTimeField(widget=admin_widgets.AdminDateWidget(),
                                help_text="Find changes since this date")
    end = forms.DateTimeField(widget=admin_widgets.AdminDateWidget(),
                              help_text="Find changes up to this date")

    class Media:
        js = js_files()

    def clean(self):
        cleaned = super().clean()

        if cleaned["start"] >= cleaned["end"]:
            self.add_error("start",
                           ValidationError("start should be less than end"))
            self.add_error("end",
                           ValidationError("end should be greater than start"))

        try:
            center = cleaned["center"]
            cleaned["address"] = Geocoder.reverse_geocode(
                center.y, center.x).split(",")[0]
        except:
            cleaned["address"] = None

        return cleaned
示例#5
0
class EstablishmentForm(forms.ModelForm):

    closing_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    construction_expiration_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    inactivate_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    last_plan_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    next_inspection_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    permit_expiration_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    permit_print_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    reactivate_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    renewal_received_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    renewal_sent_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    setup_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    status_change_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    test_expiration_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    status_change_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    test_expiration_date = DateTimeFieldNull0(input_formats=DATE_FORMATS, required=False)
    lat = forms.FloatField(required=False)
    lon = forms.FloatField(required=False)
    location = forms.PointField(required=False)

    class Meta:
        model = Establishment

    def clean(self):
        lat = self.cleaned_data.get('lat', None)
        lon = self.cleaned_data.get('lon', None)
        if lat and lon:
            self.cleaned_data['location'] = Point(lon, lat)
        return self.cleaned_data
class TestForm(forms.Form):
    """
    Form with a variety of widgets to test bootstrap4 rendering.
    """

    date = forms.DateField(required=False)
    datetime = forms.SplitDateTimeField(widget=AdminSplitDateTime(), required=False)
    subject = forms.CharField(
        max_length=100,
        help_text="my_help_text",
        required=True,
        widget=forms.TextInput(attrs={"placeholder": "placeholdertest"}),
    )
    xss_field = forms.CharField(
        label='XSS" onmouseover="alert(\'Hello, XSS\')" foo="', max_length=100
    )
    password = forms.CharField(widget=forms.PasswordInput)
    message = forms.CharField(required=False, help_text="<i>my_help_text</i>")
    sender = forms.EmailField(label="Sender © unicode", help_text='E.g., "*****@*****.**"')
    secret = forms.CharField(initial=42, widget=forms.HiddenInput)
    cc_myself = forms.BooleanField(
        required=False,
        help_text='cc stands for "carbon copy." You will get a copy in your mailbox.',
    )
    select1 = forms.ChoiceField(choices=RADIO_CHOICES)
    select2 = forms.MultipleChoiceField(
        choices=RADIO_CHOICES, help_text="Check as many as you like."
    )
    select3 = forms.ChoiceField(choices=MEDIA_CHOICES)
    select4 = forms.MultipleChoiceField(
        choices=MEDIA_CHOICES, help_text="Check as many as you like."
    )
    category1 = forms.ChoiceField(choices=RADIO_CHOICES, widget=forms.RadioSelect)
    category2 = forms.MultipleChoiceField(
        choices=RADIO_CHOICES,
        widget=forms.CheckboxSelectMultiple,
        help_text="Check as many as you like.",
    )
    category3 = forms.ChoiceField(widget=forms.RadioSelect, choices=MEDIA_CHOICES)
    category4 = forms.MultipleChoiceField(
        choices=MEDIA_CHOICES,
        widget=forms.CheckboxSelectMultiple,
        help_text="Check as many as you like.",
    )
    category5 = forms.ChoiceField(widget=RadioSelectButtonGroup, choices=MEDIA_CHOICES)
    addon = forms.CharField(
        widget=forms.TextInput(attrs={"addon_before": "before", "addon_after": "after"})
    )
    polygon = gisforms.PointField()

    required_css_class = "bootstrap4-req"

    # Set this to allow tests to work properly in Django 1.10+
    # More information, see issue #337
    use_required_attribute = False

    def clean(self):
        cleaned_data = super(TestForm, self).clean()
        raise forms.ValidationError("This error was added to show the non field errors styling.")
        return cleaned_data
示例#7
0
 class PointForm(forms.Form):
     p = forms.PointField(
         widget=forms.OSMWidget(attrs={
             'default_lon': 20,
             'default_lat': 30,
             'default_zoom': 17,
         }), )
示例#8
0
class UserCreateForm(forms.ModelForm):

    error_messages = {
        'duplicate_username': _("A user with that username already exists. "),
        'password_mismatch': _("The two password fields didn't match."),
    }

    userhandle = forms.RegexField(
        label=_("Userhandle"),
        max_length=20,
        regex=r'^[\w.+-]+$',
        help_text=_(
            "Required. 20 characters or less. Alphanumeric and (./+/-) only"),
        error_messages={
            'invalid':
            _("This value may contain only letters, number an (./+/-/_) characters"
              )
        })

    password1 = forms.CharField(label=_("Password"),
                                widget=forms.PasswordInput)
    password2 = forms.CharField(
        label=_("Password confirmation"),
        widget=forms.PasswordInput,
        help_text=_("Enter the same password as above, for verification."))

    location = forms.PointField(widget=LocationInput)

    class Meta:
        model = User
        fields = ("first_name", "last_name", "userhandle", "email", "location")

    def clean_username(self):
        username = self.cleaned_data["username"]
        try:
            User._default_manager.get(username=username)
        except User.DoesNotExist:
            return username
        raise forms.ValidationError(
            self.error_messages['duplicate_username'],
            code='duplicate_username',
        )

    def clean_password2(self):
        password1 = self.cleaned_data.get("password1")
        password2 = self.cleaned_data.get("password2")
        if password1 and password2 and password1 != password2:
            raise forms.ValidationError(
                self.error_messages['password_mismatch'],
                code='password_mismatch',
            )
        return password2

    def save(self, commit=True):
        user = super(UserCreateForm, self).save(commit=False)
        user.set_password(self.cleaned_data["password1"])
        if commit:
            user.save()
        return user
示例#9
0
class ProfileForm(forms.ModelForm):
    """
    Form to edit Profile
    """

    # For loction field, we will use OpenStreetMap Widget
    location = gis_forms.PointField(required=False, widget=gis_forms.OSMWidget(
            attrs={
                'default_lat': -7.7129,
                'default_lon': 110.0093,
                'default_zoom': 11,
                'map_width': 1050,
            }
        ),
    )
    # Expertise can have multiple value, so we will use Multiple ModelMultipleChoiceField
    expertise = forms.ModelMultipleChoiceField(required=False, queryset=Expertise.objects.all(),
                                               widget=forms.SelectMultiple(attrs={'style': 'width:100%;'}))

    phone = PhoneNumberField(required=False)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.attrs = {'id': 'profile-form'} #give id to form
        self.helper.layout = Layout(
            'photo',
            Row(
                Column(
                    Row(
                        Column('first_name', css_class='col-12 col-sm-4 input-sm '),
                        Column('last_name', css_class='col-12 col-sm-4 input-sm'),
                        Column('phone', css_class='col-12 col-sm-4 input-sm '),
                        css_class='row'
                    ),
                    css_class='col-md-12'
                ),
                css_class='form-row row'
            ),
            Row(
                Column(
                    Row(
                        Column('expertise', css_class='col-12 col-sm-4 input-sm'),
                        Column('address', css_class='col-12 col-sm-8 input-sm'),
                        css_class='row'
                    ),
                    css_class='col-md-12'
                ),
                css_class='form-row row'
            ),
            'location',
            Submit('submit', 'Save')
        )

    class Meta:
        model = Profile
        fields = '__all__'
        exclude = ('user',)
示例#10
0
class LocationForm(forms.ModelForm):
    required_css_class = 'required'

    location = forms.PointField(
        widget=LeafletWidget(attrs=LEAFLET_WIDGET_ATTRS), label='')

    class Meta:
        model = User
        fields = ('location', )
示例#11
0
class ProfileForm(forms_gis.ModelForm):
    class Meta:
        model = Profile
        fields = ('phone', 'address', 'geom')

    geom = forms_gis.PointField(widget=forms_gis.OSMWidget(attrs={
        'map_width': 800,
        'map_height': 500
    }))
示例#12
0
class TrackingForm(forms.ModelForm):
    class Meta:
        model = Tracking
        exclude = ["nothing"]

    gps = forms.PointField(widget=forms.OSMWidget(attrs={
        'map_width': 800,
        'map_height': 500,
    }))
示例#13
0
class LocationForm(geoforms.Form):
    class Meta:
        model = Photo
        fields = ['geom']

    point = geoforms.PointField(widget=geoforms.OSMWidget(attrs={
        'map_width': 800,
        'map_height': 500
    }))
示例#14
0
class ShopForm(forms.ModelForm):
    name = forms.CharField(max_length=100, help_text="Please enter your Company name")
    location = forms.PointField(help_text="Please pin your company's location on the map")
    address = forms.CharField(max_length=150, help_text="Please enter your company's address")
    city = forms.CharField(max_length=50, help_text="Please input your City")
    urge = forms.ChoiceField(choices=URGENCY, help_text="Please state how urgent the food is!")
    
    class Meta:
        model = Shop
        fields = ('name','location','address','city','urge')
示例#15
0
class BasicInformationForm(forms.ModelForm):
    """Form for Basic Information model."""
    name = forms.CharField(
        required=True,
        label='Your name',
        widget=forms.TextInput(attrs={'placeholder': 'John Doe'}))
    email = forms.EmailField(
        required=True,
        label='Your email',
        widget=forms.EmailInput(attrs={
            'readonly': 'readonly',
            'placeholder': '*****@*****.**'
        }))
    image = forms.ImageField(required=False, widget=CustomClearableFileInput())
    website = forms.URLField(
        required=False,
        label='Your website',
        widget=forms.URLInput(attrs={'placeholder': 'http://john.doe.com'}))
    inasafe_roles = forms.ModelMultipleChoiceField(
        required=True,
        label='Your InaSAFE role(s)',
        queryset=InasafeRole.objects.filter(sort_number__gte=1),
        widget=forms.CheckboxSelectMultiple)
    osm_roles = forms.ModelMultipleChoiceField(
        required=False,
        label='Your OSM role(s)',
        queryset=OsmRole.objects.filter(sort_number__gte=1),
        widget=forms.CheckboxSelectMultiple)
    osm_username = forms.CharField(
        required=False,
        label='OSM Username',
        widget=forms.TextInput(attrs={'placeholder': 'johndoe'}))
    email_updates = forms.BooleanField(
        required=False, label='Receive project news and updates')
    location = forms.PointField(label='Click your location on the map',
                                widget=LeafletWidget())

    class Meta:
        """Association between models and this form."""
        model = User
        fields = [
            'name', 'email', 'image', 'website', 'inasafe_roles', 'osm_roles',
            'osm_username', 'location', 'email_updates'
        ]

    def save(self, commit=True):
        """Save form.

        :param commit: Whether committed to db or not.
        :type commit: bool
        """
        user = super(BasicInformationForm, self).save(commit=False)
        if commit:
            user.save()
        return user
示例#16
0
class AddEventMarkForm(forms.Form):
    point = forms.PointField(widget=TDOSMWidget(), label='')
    message = forms.CharField(label=_('Message'),
                              widget=forms.Textarea(attrs={
                                  'cols': '',
                                  'rows': ''
                              }),
                              required=True)

    def __init__(self, *args, **kwargs):
        self.event = kwargs.pop('event')
        super(AddEventMarkForm, self).__init__(*args, **kwargs)
示例#17
0
class VestUserForm(forms.ModelForm):
    home = forms.PointField(
        required=False,
        widget=forms.OSMWidget(attrs={
            'map_width': 800,
            'map_height': 500,
            'modifiable': True,
        }))

    class Meta():
        model = VestUser
        fields = ('email', 'home')
示例#18
0
class QueryPointForm(forms.Form):
    query_point = forms.PointField(widget=forms.OSMWidget(
        attrs={
            'map_width': 700,
            'map_height': 500,
            'default_lat': 40.304665,
            'default_lon': -3.723679,
            'default_zoom': 6
        }))
    distance = forms.DecimalField(max_digits=6,
                                  decimal_places=2,
                                  help_text='Distance in km.')
示例#19
0
class MapImageForm(forms.ModelForm):
    location = forms.PointField(widget=OSMWidget(
        attrs={
            'default_lat': '18.653238',
            'default_lon': '-72.093788',
            'map_width': 600,
            'map_height': 500
        }))

    class Meta:
        model = MapImage
        fields = ['name', 'image', 'location']
class PointForm(forms.ModelForm):
	class Meta:
		model = Point
		
		fields = ['name', 'geom', 'description', 'theme', 'popup_image', 'popup_audio_file', 'popup_audio_title', 'popup_audio_slug', 'banner_image', 'banner_image_copyright', 'weight', 'tags', 'published',]

		help_texts = {
			'popup_audio_title': _('If you have added an audio file to the popup, make sure you give it a title as well'),
			'description': _('A short description of the location.')
		}

	geom = forms.PointField(widget=MapBoxGLWidget(attrs={'config': config}), label=_('Point'))
示例#21
0
class EntryForm(forms.Form):
    feedTime = forms.DateTimeField()
    feedType = forms.CharField(max_length=50)
    feedAmt = forms.FloatField()
    flockSize = forms.IntegerField()
    feedLoc = forms.PointField(widget=forms.OSMWidget(
        attrs={
            'map_width': 800,
            'map_height': 500,
            'default_lat': 48.427502,
            'default_lon': -123.367264
        }))
示例#22
0
class AEDCreateForm(forms.ModelForm):
    class Meta:
        model = AED
        fields = [
            'location', 'name', 'description', 'address', 'number',
            'neighborhood', 'city', 'state', 'country', 'zipcode', 'public'
        ]

    location = gis_forms.PointField(widget=LeafletPointWidget(attrs={
        'map_width': 500,
        'map_height': 300
    }))
示例#23
0
class BasicInformationForm(forms.ModelForm):
    """Form for Basic Information model."""
    name = forms.CharField(
        required=True,
        label='Your name',
        widget=forms.TextInput(
            attrs={
                'placeholder': 'John Doe'})
    )
    email = forms.EmailField(
        required=True,
        label='Your email',
        widget=forms.EmailInput(
            attrs={
                'readonly': 'readonly',
                'placeholder': '*****@*****.**'})
    )
    website = forms.URLField(
        required=False,
        label='Your website',
        widget=forms.URLInput(
            attrs={
                'placeholder': 'http://john.doe.com'})
    )
    role = forms.ModelChoiceField(
        label='Your role',
        queryset=Role.objects.filter(sort_number__gte=1),
        initial=1)
    email_updates = forms.BooleanField(
        required=False,
        label='Receive project news and updates')
    location = forms.PointField(
        label='Click your location on the map',
        widget=LeafletWidget())

    class Meta:
        """Association between models and this form."""
        model = User
        fields = ['name', 'email', 'website', 'role', 'location',
                  'email_updates']

    def save(self, commit=True):
        """Save form.

        :param commit: Whether committed to db or not.
        :type commit: bool
        """
        user = super(BasicInformationForm, self).save(commit=False)
        if commit:
            user.save()
        return user
示例#24
0
class CallsignForm(forms.ModelForm):
    issued = forms.DateField(widget=forms.TextInput(attrs={'type': 'date'}),
                             required=False)
    location = forms.PointField(
        srid=4326,
        widget=forms.OSMWidget(attrs={
            'map_width': 785,
            'map_height': 500,
            'default_zoom': 12
        }))

    class Meta:
        model = Callsign
        fields = ["type", "location", 'cq_zone', "itu_zone", "dstar", "issued"]
示例#25
0
class CentroDeSaludForm(gisforms.ModelForm):
    ubicacion = gisforms.PointField(widget=gisforms.OSMWidget(
        attrs={
            'map_width': 600,
            'map_height': 400,
            'template_name': 'gis/openlayers-osm.html',
            'default_lat': -34.6037673975556,
            'default_lon': -58.38164806365966,
            'default_zoom': 12
        }))

    class Meta:
        model = CentroDeSalud
        fields = '__all__'
示例#26
0
class AEDUpdateForm(forms.ModelForm):
    class Meta:
        model = AED
        fields = [
            'location', 'name', 'description', 'address', 'number',
            'neighborhood', 'city', 'state', 'country', 'zipcode', 'public',
            'contact'
        ]

    contact = forms.ModelChoiceField(queryset=User.objects.all(),
                                     disabled=True,
                                     empty_label=None)
    location = gis_forms.PointField(widget=LeafletPointWidget(attrs={
        'map_width': 500,
        'map_height': 300
    }))
示例#27
0
class TrainingCenterForm(geoforms.ModelForm):

    location = geoforms.PointField(widget=OSMWidget(
        attrs={
            'map_width': 750,
            'map_height': 400,
            'default_zoom': 5,
            'default_lat': -30.559482,
            'default_lon': 22.937506
        }), )

    class Meta:
        model = TrainingCenter
        fields = (
            'name',
            'email',
            'address',
            'phone',
            'location',
        )

    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user')
        self.certifying_organisation = kwargs.pop('certifying_organisation')
        form_title = 'New Training Center for %s' % \
                     self.certifying_organisation.name
        self.helper = FormHelper()
        layout = Layout(
            Fieldset(
                form_title,
                Field('name', css_class='form-control'),
                Field('email', css_class='form-control'),
                Field('address', css_class='form-control'),
                Field('phone', css_class='form-control'),
                Field('location', css_class='form-control'),
            ))
        self.helper.layout = layout
        self.helper.html5_required = False
        super(TrainingCenterForm, self).__init__(*args, **kwargs)
        self.helper.add_input(Submit('submit', 'Submit'))

    def save(self, commit=True):
        instance = super(TrainingCenterForm, self).save(commit=False)
        instance.certifying_organisation = self.certifying_organisation
        instance.author = self.user
        instance.save()
        return instance
示例#28
0
    def __init__(self, *args, **kwargs):
        feature_type = kwargs.pop('feature_type')
        user = kwargs.pop('user', None)
        super().__init__(*args, **kwargs)
        project = feature_type.project

        # Status choices
        initial = 'draft'
        choices = tuple(x for x in Feature.STATUS_CHOICES)
        if not project.moderation:
            choices = tuple(x for x in Feature.STATUS_CHOICES
                            if x[0] != 'pending')
            initial = 'published' if not self.instance else self.instance.status

        if project.moderation and not Authorization.has_permission(
                user, 'can_publish_feature', project):
            choices = tuple(x for x in Feature.STATUS_CHOICES
                            if x[0] in ['draft', 'pending'])
            initial = 'pending'

        if project.moderation and Authorization.has_permission(
                user, 'can_publish_feature', project):
            choices = tuple(x for x in Feature.STATUS_CHOICES
                            if x[0] in ['draft', 'published', 'archived'])
            initial = 'draft'

        self.fields['status'] = forms.ChoiceField(choices=choices,
                                                  initial=initial,
                                                  label='Statut')

        # TODO: factoriser les attributs de champs geom
        if feature_type.geom_type == "point":
            self.fields['geom'] = forms.PointField(label="Localisation",
                                                   required=True,
                                                   srid=4326)

        if feature_type.geom_type == "linestring":
            self.fields['geom'] = forms.LineStringField(label="Localisation",
                                                        required=True,
                                                        srid=4326)

        if feature_type.geom_type == "polygon":
            self.fields['geom'] = forms.PolygonField(label="Localisation",
                                                     required=True,
                                                     srid=4326)
示例#29
0
文件: forms.py 项目: pragya96/ramon
class LocationForm(gis_forms.ModelForm):
    name = forms.CharField(max_length=100, widget=forms.TextInput(
        attrs={'class': 'col-sm-12 col-lg-12 form-control'}
    ))
    type = forms.ModelChoiceField(required=False, queryset=models.LocationType.objects.filter(status='R'), widget=forms.Select(
        attrs={'class': 'col-sm-12 col-lg-12 form-control'}
    ))
    geom = gis_forms.PointField(widget=gis_forms.OSMWidget(
        attrs={}
    ))
    old_madrid = forms.NullBooleanField(required=False, widget=forms.Select(
        attrs={'class': 'col-sm-12 col-lg-12 form-control'},
        choices=[(1, 'Yes'), (0, 'No'), (2, 'N/A')]
    ))
    complete = forms.BooleanField(required=False)

    class Meta:
        model = models.Location
        exclude = ['status']
示例#30
0
class EventForm(forms.ModelForm):
    point = forms.PointField(widget=forms.OSMWidget(),
                             label="Miejsce na mapie")

    class Meta:
        model = Event
        fields = (
            'title',
            'description',
            'category',
            'start_time',
            'end_time',
            'image',
            'place',
            'point',
        )
        widgets = {
            'start_time': widgets.AdminSplitDateTime,
            'end_time': widgets.AdminSplitDateTime
        }