Ejemplo n.º 1
0
 def get_queryset(self):
     # self.request will be None when we come here via the static site
     # renderer
     if (self.request and Talk.can_view_all(self.request.user)):
         return Talk.objects.all()
     return Talk.objects.filter(Q(status=ACCEPTED) |
                                Q(status=CANCELLED))
Ejemplo n.º 2
0
 def get_queryset(self):
     # self.request will be None when we come here via the static site
     # renderer
     if (self.request and Talk.can_view_all(self.request.user)):
         return Talk.objects.all()
     return Talk.objects.filter( Q(status=ACCEPTED) |
                                 Q(status=CANCELLED))
Ejemplo n.º 3
0
def test_is_late_submission_no_deadline():
    from django.utils.timezone import now
    from wafer.talks.models import Talk, TalkType

    talk_type = TalkType()
    talk = Talk(submission_time=now(), talk_type=talk_type)

    assert not talk.is_late_submission
Ejemplo n.º 4
0
def test_is_late_submission_late():
    from django.utils.timezone import datetime, utc
    from wafer.talks.models import Talk, TalkType

    deadline = datetime(2019, 11, 1, 0, 0, 0, 0, utc)
    after_deadline = datetime(2019, 11, 2, 0, 0, 0, 0, utc)

    talk_type = TalkType(submission_deadline=deadline)
    late = Talk(talk_type=talk_type, submission_time=after_deadline)
    assert late.is_late_submission
Ejemplo n.º 5
0
def test_is_late_submission_not_late():
    from django.utils.timezone import datetime, utc
    from wafer.talks.models import Talk, TalkType

    deadline = datetime(2019, 11, 1, 0, 0, 0, 0, utc)
    before_deadline = datetime(2019, 10, 15, 0, 0, 0, 0, utc)

    talk_type = TalkType(submission_deadline=deadline)
    not_late = Talk(talk_type=talk_type, submission_time=before_deadline)
    assert not not_late.is_late_submission
Ejemplo n.º 6
0
 def get_queryset(self):
     # We override the default implementation to only show accepted talks
     # to people who aren't part of the management group
     if self.request.user.id is None:
         # Anonymous user, so just accepted talks
         return Talk.objects.filter(status=ACCEPTED)
     elif Talk.can_view_all(self.request.user):
         return Talk.objects.all()
     else:
         # Also include talks owned by the user
         # XXX: Should this be all authors rather than just
         # the corresponding author?
         return Talk.objects.filter(
             Q(status=ACCEPTED)|
             Q(corresponding_author=self.request.user))
Ejemplo n.º 7
0
 def get_queryset(self):
     # We override the default implementation to only show accepted talks
     # to people who aren't part of the management group
     if self.request.user.id is None:
         # Anonymous user, so just accepted or cancelled talks
         return Talk.objects.filter(
             Q(status=ACCEPTED) | Q(status=CANCELLED))
     elif Talk.can_view_all(self.request.user):
         return Talk.objects.all()
     else:
         # Also include talks owned by the user
         # XXX: Should this be all authors rather than just
         # the corresponding author?
         return Talk.objects.filter(
             Q(status=ACCEPTED) | Q(status=CANCELLED)
             | Q(corresponding_author=self.request.user))
Ejemplo n.º 8
0
def test_is_late_submission_no_talk_type():
    from wafer.talks.models import Talk

    assert not Talk().is_late_submission