Beispiel #1
0
 def get_user_journals(self):
     """ Returns the journals that can be accessed by the current user. """
     if self.allow_production_team_access and is_production_team_member(self.request.user):
         # Allows the production team members to access this page for all the Journal instances
         # if applicable.
         return Journal.objects.filter(collection__code='erudit')
     return get_editable_journals(self.request.user)
Beispiel #2
0
 def get_user_journals(self):
     """ Returns the journals that can be accessed by the current user. """
     if self.allow_production_team_access and is_production_team_member(
             self.request.user):
         # Allows the production team members to access this page for all the Journal instances
         # if applicable.
         return Journal.objects.filter(collection__code='erudit')
     return get_editable_journals(self.request.user)
Beispiel #3
0
 def get_redirect_url(self, *args, **kwargs):
     journal_qs = get_editable_journals(self.request.user)
     journal_count = journal_qs.count()
     if journal_count:
         return reverse(
             'userspace:journal:home', kwargs={
                 'journal_pk': journal_qs.first().pk})
     else:
         # No Journal instance can be edited
         raise PermissionDenied
Beispiel #4
0
 def get_redirect_url(self, *args, **kwargs):
     journal_qs = Journal.objects.filter(collection__code='erudit') \
         if is_production_team_member(self.request.user) \
         else get_editable_journals(self.request.user)
     journal_count = journal_qs.count()
     if journal_count:
         return reverse('userspace:journal:home',
                        kwargs={'journal_pk': journal_qs.first().pk})
     else:
         # No Journal instance can be edited
         raise PermissionDenied
Beispiel #5
0
 def get_redirect_url(self, *args, **kwargs):
     journal_qs = Journal.objects.filter(collection__code='erudit') \
         if is_production_team_member(self.request.user) \
         else get_editable_journals(self.request.user)
     journal_count = journal_qs.count()
     if journal_count:
         return reverse(
             'userspace:journal:home', kwargs={
                 'journal_pk': journal_qs.first().pk})
     else:
         # No Journal instance can be edited
         raise PermissionDenied
Beispiel #6
0
 def get_redirect_url(self, *args, **kwargs):
     journal_qs = get_editable_journals(self.request.user)
     journal_count = journal_qs.count()
     if journal_count > 1:
         return reverse('userspace:journal:journal-information-list')
     elif journal_count:
         return reverse(
             'userspace:journal:journal-information-update',
             kwargs={'code': journal_qs.first().code})
     else:
         # No Journal instance can be edited
         raise PermissionDenied
Beispiel #7
0
    def get(self, request):
        journal_qs = Journal.objects.filter(collection__code='erudit') \
            if is_production_team_member(self.request.user) \
            else get_editable_journals(self.request.user)
        organisation_qs = get_editable_organisations(self.request.user)
        journal_exists = journal_qs.exists()
        organisation_exists = organisation_qs.exists()

        if journal_exists and organisation_exists:
            return self.render_to_response(
                self.get_context_data(journals=journal_qs, organisations=organisation_qs))
        elif journal_exists:
            return HttpResponseRedirect(reverse('userspace:journal:entrypoint'))
        elif organisation_exists:
            return HttpResponseRedirect(reverse('userspace:library:entrypoint'))
        else:
            raise PermissionDenied
Beispiel #8
0
    def get(self, request):
        journal_qs = Journal.objects.filter(collection__code='erudit') \
            if is_production_team_member(self.request.user) \
            else get_editable_journals(self.request.user)
        organisation_qs = get_editable_organisations(self.request.user)
        journal_exists = journal_qs.exists()
        organisation_exists = organisation_qs.exists()

        if journal_exists and organisation_exists:
            return self.render_to_response(
                self.get_context_data(journals=journal_qs,
                                      organisations=organisation_qs))
        elif journal_exists:
            return HttpResponseRedirect(
                reverse('userspace:journal:entrypoint'))
        elif organisation_exists:
            return HttpResponseRedirect(
                reverse('userspace:library:entrypoint'))
        else:
            raise PermissionDenied
Beispiel #9
0
 def get_queryset(self):
     qs = get_editable_journals(self.request.user)
     return qs.order_by('name')
Beispiel #10
0
 def get_user_journals(self):
     """ Returns the journals that can be accessed by the current user. """
     return get_editable_journals(self.request.user)