4.2.2.13. Package apps.widgets.raffle
¶
Implements the raffle widget.
4.2.2.13.1. Module apps.widgets.raffle.models
¶
Provides the model for the raffle widget.
-
apps.widgets.raffle.models.
POINTS_PER_TICKET
= 25¶ Number of points required to earn a raffle ticket
-
class
apps.widgets.raffle.models.
RafflePrize
(*args, **kwargs)[source]¶ RafflePrize model
Parameters: - id (AutoField) – Id
- round_id (ForeignKey) – The round of the raffle prize.
- title (CharField) – The title of the raffle prize.
- value (IntegerField) – The value of the raffle prize
- description (TextField) – Description of the raffle prize. Uses Markdown formatting.
- image (ImageField) – A picture of the raffle prize.
- winner_id (ForeignKey) – The winner of the raffle prize. Normally, this is randomly picked by the system at the end of the round.
-
add_ticket
(user)[source]¶ Adds a ticket from the user if they have one. Throws an exception if they cannot add a ticket.
-
class
apps.widgets.raffle.models.
RaffleTicket
(*args, **kwargs)[source]¶ Raffle ticket model
Parameters: - id (AutoField) – Id
- user_id (ForeignKey) – User
- raffle_prize_id (ForeignKey) – Raffle prize
- created_at (DateTimeField) – Created at
- updated_at (DateTimeField) – Updated at
4.2.2.13.2. Module apps.widgets.raffle.views
¶
Handle rendering of the raffle widget.
-
apps.widgets.raffle.views.
add_ticket
(request, *args, **kwargs)[source]¶ Adds a user’s raffle ticket to the prize.
-
apps.widgets.raffle.views.
bulk_round_change
(request, *args, **kwargs)[source]¶ Handle change Round for selected Raffle Prizes from the admin interface.
-
apps.widgets.raffle.views.
notify_winner
(request, *args, **kwargs)[source]¶ Sends an email to the user notifying them that they are a winner.
-
apps.widgets.raffle.views.
pick_winner
(request, *args, **kwargs)[source]¶ Picks the raffle game winners for the raffle deadline that has passed.
-
apps.widgets.raffle.views.
prize_summary
(request, round_name)[source]¶ display summary of the winners.
-
apps.widgets.raffle.views.
raffle_prize_list
(request)[source]¶ Generates the raffle prize list and renders to page.
4.2.2.13.3. Module apps.widgets.raffle.admin
¶
Raffle widget administration