def sync_flatpages(self, lang): self.sync_geojson(lang, FlatPageViewSet, 'flatpages.geojson', zipfile=self.zipfile) flatpages = FlatPage.objects.filter(published=True) if self.source: flatpages = flatpages.filter(source__name__in=self.source) if self.portal: flatpages = flatpages.filter(portal__name__in=self.portal) for flatpage in flatpages: name = os.path.join('meta', lang, flatpage.rando_url, 'index.html') self.sync_view(lang, FlatPageMeta.as_view(), name, pk=flatpage.pk, params={'rando_url': self.rando_url})
def sync_flatpages(self, lang): self.sync_geojson(lang, FlatPageViewSet, 'flatpages.geojson', zipfile=self.zipfile) flatpages = FlatPage.objects.filter(published=True) if self.source: flatpages = flatpages.filter(source__name__in=self.source) if self.portal: flatpages = flatpages.filter(Q(portal__name__in=self.portal) | Q(portal=None)) for flatpage in flatpages: name = os.path.join('meta', lang, flatpage.rando_url, 'index.html') self.sync_view(lang, FlatPageMeta.as_view(), name, pk=flatpage.pk, params={'rando_url': self.rando_url})
from django.conf.urls import patterns, url, include from rest_framework.routers import DefaultRouter from geotrek.flatpages.views import FlatPageViewSet, FlatPageMeta """ We don't use MapEntity for FlatPages, thus we use Django Rest Framework without sugar. """ router = DefaultRouter(trailing_slash=False) router.register(r'flatpages', FlatPageViewSet, base_name='flatpages') urlpatterns = patterns( '', url(r'^api/(?P<lang>[a-z]{2})/', include(router.urls)), url(r'^api/(?P<lang>[a-z]{2})/flatpages/(?P<pk>\d+)/meta.html$', FlatPageMeta.as_view(), name="flatpage_meta"), )