Zeste de Savoir
dev
  • Guides pas-à-pas
  • Installation
  • Contribuer à Zeste de Savoir
  • Workflow et détails pratiques
  • Le back-end
  • Documentation technique du back-end
    • Arborescence du back-end
    • Les outils de mises en avant (featured/)
      • Modèles (models.py)
        • FeaturedMessage
        • FeaturedRequested
        • FeaturedResource
      • Vues (views.py)
        • FeaturedMessageCreateUpdate
        • FeaturedMessageDelete
        • FeaturedRequestedList
        • FeaturedRequestedUpdate
        • FeaturedResourceCreate
        • FeaturedResourceDeleteDetail
        • FeaturedResourceDeleteList
        • FeaturedResourceList
        • FeaturedResourceUpdate
        • FeaturedViewMixin
    • Les forums (forum/)
    • Les galleries (gallery/)
    • Les membres (member/)
    • Les pages (pages/)
    • Les messages privés (mp/)
    • La recherche (search/)
    • Les tutoriels v2 (ZEP12) (tutorialv2/)
    • Les utilitaires (utils/)
  • Le front-end
  • API
  • Makefile et autres outils
  • Problème de lenteur lors du dev ?
Zeste de Savoir
  • Documentation technique du back-end
  • Les outils de mises en avant (featured/)
  • Afficher la source de la page

Les outils de mises en avant (featured/)

Module situé dans zds/featured/.

Fichiers documentés :

  • Les outils de mises en avant (featured/)

    • Modèles (models.py)

    • Vues (views.py)

Modèles (models.py)

class zds.featured.models.FeaturedMessage(*args, **kwargs)

The Featured Message is a simple one-line information on the home page. This message is divided in three parts:

  • The hook : displayed in bold, it shows the topic of the message (i.e.: « New », « Warning », « Info », …)

  • The message : the info message itself (i.e.: « The site will be down for maintenance tomorrow »)

  • The « tell me more » url : A tell me more button linking to a page giving more details

Only the message is mandatory.

exception DoesNotExist
exception MultipleObjectsReturned
class zds.featured.models.FeaturedRequested(*args, **kwargs)

This class hold votes for a topic or content to be featured.

exception DoesNotExist
exception MultipleObjectsReturned
toggle(user)

Toogle featured request for user. Do not reject the vote anymore.

Paramètres:

user (User) – the user

Renvoie:

tuple of the form (user has voted, number of votes)

Type renvoyé:

(bool, int)

class zds.featured.models.FeaturedResource(*args, **kwargs)

A FeaturedResource is a link to a resource that is featured by the Staff It displays 3 main informations:

  • A background picture

  • A title

  • The author(s) of the resource

Currently, the five newer FeaturedResource are displayed on the front page.

exception DoesNotExist
exception MultipleObjectsReturned

Vues (views.py)

class zds.featured.views.FeaturedMessageCreateUpdate(**kwargs)

Creates or updates the featured message.

form_class

alias de FeaturedMessageForm

form_valid(form)

If the form is valid, redirect to the supplied URL.

get_context_data(**kwargs)

Insert the form into the context dict.

get_initial()

Return the initial data to use for forms on this view.

class zds.featured.views.FeaturedMessageDelete(*args, **kwargs)

Delete the featured message.

form_valid(form)

If the form is valid, redirect to the supplied URL.

get_object(queryset=None)

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

model

alias de FeaturedMessage

class zds.featured.views.FeaturedRequestedList(**kwargs)

Displays the list of featured resources.

get_queryset()

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

class zds.featured.views.FeaturedRequestedUpdate(**kwargs)
model

alias de FeaturedRequested

post(request, *args, **kwargs)

Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.

class zds.featured.views.FeaturedResourceCreate(**kwargs)

Creates a new featured resource.

form_class

alias de FeaturedResourceForm

form_valid(form)

If the form is valid, save the associated model.

get_form_kwargs()

Return the keyword arguments for instantiating the form.

get_initial()

Return the initial data to use for forms on this view.

class zds.featured.views.FeaturedResourceDeleteDetail(*args, **kwargs)

Deletes a featured resource.

model

alias de FeaturedResource

class zds.featured.views.FeaturedResourceDeleteList(**kwargs)

Deletes a list of featured resources.

get_queryset()

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

class zds.featured.views.FeaturedResourceList(**kwargs)

Displays the list of featured resources.

class zds.featured.views.FeaturedResourceUpdate(**kwargs)

Updates a featured resource.

form_class

alias de FeaturedResourceForm

form_valid(form)

If the form is valid, save the associated model.

get_form(form_class=None)

Return an instance of the form to be used in this view.

get_initial()

Return the initial data to use for forms on this view.

class zds.featured.views.FeaturedViewMixin
Précédent Suivant

© Droits d'auteur 2014-2025, Zeste de Savoir.

Compilé avec Sphinx en utilisant un thème fourni par Read the Docs.