Exemple #1
0
@classroute('/news/<int:pk>/delete/', 'entry_delete', methods=['GET', 'POST'])
@view_class_decorator(admin_required)
class EntryDeleteView(BreadcrumbsMixin, DeleteView):
    model_class = BlogEntry
    redirect_view = 'blog'

    def get_breadcrumbs(self):
        return [('News', url_for('blog')),
                (self.model.title, url_for('entry_detail',
                                           pk=self.kwargs['pk'])),
                ('Delete BlogEntry', None)]

    def get_redirect_context(self):
        return {}


# Static pages (about, etc.)

app.add_url_rule('/about/', 'about',
                 View.as_view(template='flatpages/about.html'))

app.add_url_rule('/about/recruiting/', 'recruiting',
                 View.as_view(template='flatpages/recruiting.html'))

app.add_url_rule('/about/staff/', 'staff',
                 View.as_view(template='flatpages/staff.html'))

app.add_url_rule('/about/history/', 'history',
                 View.as_view(template='flatpages/history.html'))
 def decorator(cls):
     app.add_url_rule(rule, endpoint, cls.as_view(), **options)
     return cls
Exemple #3
0
            ("Edit BlogEntry", None),
        ]


@classroute("/news/<int:pk>/delete/", "entry_delete", methods=["GET", "POST"])
@view_class_decorator(admin_required)
class EntryDeleteView(BreadcrumbsMixin, DeleteView):
    model_class = BlogEntry
    redirect_view = "blog"

    def get_breadcrumbs(self):
        return [
            ("News", url_for("blog")),
            (self.model.title, url_for("entry_detail", pk=self.kwargs["pk"])),
            ("Delete BlogEntry", None),
        ]

    def get_redirect_context(self):
        return {}


# Static pages (about, etc.)

app.add_url_rule("/about/", "about", View.as_view(template="flatpages/about.html"))

app.add_url_rule("/about/recruiting/", "recruiting", View.as_view(template="flatpages/recruiting.html"))

app.add_url_rule("/about/staff/", "staff", View.as_view(template="flatpages/staff.html"))

app.add_url_rule("/about/history/", "history", View.as_view(template="flatpages/history.html"))
 def decorator(cls):
     app.add_url_rule(rule, endpoint, cls.as_view(), **options)
     return cls