Пример #1
0
class PlacesWFSView(WFSView):
    """An simple view that uses the WFSView against our test model."""

    xml_namespace = "http://example.org/gisserver"
    service_description = ServiceDescription(
        # While not tested directly, this is still validated against the XSD
        title="Places",
        abstract="Unittesting",
        keywords=["django-gisserver"],
        provider_name="Django",
        provider_site="https://www.example.com/",
        contact_person="django-gisserver",
    )
    feature_types = [
        FeatureType(
            Restaurant.objects.all(),
            fields="__all__",
            keywords=["unittest"],
            other_crs=[RD_NEW],
            metadata_url="/feature/restaurants/",
        ),
        FeatureType(
            Restaurant.objects.all(),
            name="mini-restaurant",
            keywords=["unittest", "limited-fields"],
            other_crs=[RD_NEW],
            metadata_url="/feature/restaurants-limit/",
        ),
        DeniedFeatureType(Restaurant.objects.none(), name="denied-feature"),
    ]
Пример #2
0
class FlattenedWFSView(PlacesWFSView):
    """An advanced view that has a custom type definition for a foreign key."""

    feature_types = [
        FeatureType(
            Restaurant.objects.all(),
            fields=[
                "id",
                "name",
                field("city-id", model_attribute="city_id"),
                field("city-name", model_attribute="city.name"),
                "location",
                "rating",
                "is_open",
                "created",
            ],
        ),
    ]
Пример #3
0
class ComplexTypesWFSView(PlacesWFSView):
    """An advanced view that has a custom type definition for a foreign key."""

    feature_types = [
        FeatureType(
            Restaurant.objects.all(),
            fields=[
                "id",
                "name",
                field("city", fields=["id", "name"]),
                "location",
                "rating",
                "is_open",
                "created",
            ],
            other_crs=[RD_NEW],
        ),
    ]
Пример #4
0
class ComplexTypesWFSView(PlacesWFSView):
    """An advanced view that has a custom type definition for a foreign key and M2M relation."""

    feature_types = [
        FeatureType(
            Restaurant.objects.all(),
            fields=[
                "id",
                "name",
                field("city", fields=["id", "name"]),
                "location",
                "rating",
                "is_open",
                "created",
                field("opening_hours",
                      fields=["weekday", "start_time", "end_time"]),
                "tags",  # array field
            ],
            other_crs=[RD_NEW],
        ),
    ]