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)
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)
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
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
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
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