Revision d7c741db
Added by Benjamin Dauvergne almost 13 years ago
| calebasse/actes/views.py | ||
|---|---|---|
| 1 |
# Create your views here. |
|
| 1 |
import datetime |
|
| 2 |
|
|
| 3 |
from django.shortcuts import redirect |
|
| 4 |
|
|
| 5 |
from calebasse.cbv import ListView |
|
| 6 |
|
|
| 7 |
import models |
|
| 8 |
|
|
| 9 |
def redirect_today(request, service): |
|
| 10 |
'''If not date is given we redirect on the agenda for today''' |
|
| 11 |
return redirect(act_listing, date=datetime.date.today().strftime('%Y-%m-%d'),
|
|
| 12 |
service=service) |
|
| 13 |
|
|
| 14 |
class ActListingView(ListView): |
|
| 15 |
model=models.EventAct |
|
| 16 |
template_name='actes/act_listing.html' |
|
| 17 |
|
|
| 18 |
def get_queryset(self): |
|
| 19 |
qs = super(ActListingView, self).get_queryset() |
|
| 20 |
qs.filter(services=self.service) |
|
| 21 |
return qs |
|
| 22 |
|
|
| 23 |
act_listing = ActListingView.as_view() |
|
Also available in: Unified diff
actes: start implementing the acts listing view