Add recent view organization
This commit is contained in:
parent
7a9dad71b4
commit
512bc92116
6 changed files with 101 additions and 1 deletions
|
@ -19,6 +19,7 @@ from judge.models import (
|
|||
Submission,
|
||||
Ticket,
|
||||
)
|
||||
from judge.models.profile import Organization, OrganizationProfile
|
||||
from judge.utils.cachedict import CacheDict
|
||||
from judge.utils.diggpaginator import DiggPaginator
|
||||
from judge.utils.problems import user_completed_ids
|
||||
|
@ -74,10 +75,12 @@ class FeedView(ListView):
|
|||
.filter(is_visible=True)
|
||||
.order_by("start_time")
|
||||
)
|
||||
|
||||
context["current_contests"] = visible_contests.filter(
|
||||
start_time__lte=now, end_time__gt=now
|
||||
)
|
||||
context["future_contests"] = visible_contests.filter(start_time__gt=now)
|
||||
context["recent_organizations"] = OrganizationProfile.get_organization(self.request.profile)
|
||||
context["top_rated"] = Profile.objects.filter(is_unlisted=False).order_by(
|
||||
"-rating"
|
||||
)[:10]
|
||||
|
|
|
@ -35,6 +35,7 @@ from django.views.generic.detail import (
|
|||
SingleObjectTemplateResponseMixin,
|
||||
)
|
||||
from django.core.paginator import Paginator
|
||||
from judge.models.profile import OrganizationProfile
|
||||
from reversion import revisions
|
||||
|
||||
from judge.forms import (
|
||||
|
@ -126,6 +127,7 @@ class OrganizationMixin(OrganizationBase):
|
|||
context["logo_override_image"] = self.organization.logo_override_image
|
||||
if "organizations" in context:
|
||||
context.pop("organizations")
|
||||
OrganizationProfile.add_organization(self.request.profile, self.organization)
|
||||
return context
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
|
@ -261,7 +263,6 @@ class OrganizationList(TitleMixin, ListView, OrganizationBase):
|
|||
|
||||
class OrganizationHome(OrganizationDetailView):
|
||||
template_name = "organization/home.html"
|
||||
|
||||
def get_posts(self):
|
||||
posts = (
|
||||
BlogPost.objects.filter(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue