Format and fix logged out bug for most recent orgs
This commit is contained in:
parent
103a4bb69d
commit
30f1c105cb
6 changed files with 703 additions and 12 deletions
File diff suppressed because one or more lines are too long
|
@ -39,7 +39,13 @@ from judge.models.problem_data import (
|
||||||
problem_data_storage,
|
problem_data_storage,
|
||||||
problem_directory_file,
|
problem_directory_file,
|
||||||
)
|
)
|
||||||
from judge.models.profile import Organization, OrganizationRequest, Profile, Friend, OrganizationProfile
|
from judge.models.profile import (
|
||||||
|
Organization,
|
||||||
|
OrganizationRequest,
|
||||||
|
Profile,
|
||||||
|
Friend,
|
||||||
|
OrganizationProfile,
|
||||||
|
)
|
||||||
from judge.models.runtime import Judge, Language, RuntimeVersion
|
from judge.models.runtime import Judge, Language, RuntimeVersion
|
||||||
from judge.models.submission import (
|
from judge.models.submission import (
|
||||||
SUBMISSION_RESULT,
|
SUBMISSION_RESULT,
|
||||||
|
|
|
@ -445,7 +445,9 @@ class OrganizationProfile(models.Model):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def remove_organization(self, users, organization):
|
def remove_organization(self, users, organization):
|
||||||
organizationprofile = self.objects.filter(users=users, organization=organization)
|
organizationprofile = self.objects.filter(
|
||||||
|
users=users, organization=organization
|
||||||
|
)
|
||||||
if organizationprofile.exists():
|
if organizationprofile.exists():
|
||||||
organizationprofile.delete()
|
organizationprofile.delete()
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,9 @@ class FeedView(ListView):
|
||||||
start_time__lte=now, end_time__gt=now
|
start_time__lte=now, end_time__gt=now
|
||||||
)
|
)
|
||||||
context["future_contests"] = visible_contests.filter(start_time__gt=now)
|
context["future_contests"] = visible_contests.filter(start_time__gt=now)
|
||||||
context["recent_organizations"] = OrganizationProfile.get_most_recent_organizations(self.request.profile)
|
context[
|
||||||
|
"recent_organizations"
|
||||||
|
] = OrganizationProfile.get_most_recent_organizations(self.request.profile)
|
||||||
context["top_rated"] = Profile.objects.filter(is_unlisted=False).order_by(
|
context["top_rated"] = Profile.objects.filter(is_unlisted=False).order_by(
|
||||||
"-rating"
|
"-rating"
|
||||||
)[:10]
|
)[:10]
|
||||||
|
|
|
@ -263,6 +263,7 @@ class OrganizationList(TitleMixin, ListView, OrganizationBase):
|
||||||
|
|
||||||
class OrganizationHome(OrganizationDetailView):
|
class OrganizationHome(OrganizationDetailView):
|
||||||
template_name = "organization/home.html"
|
template_name = "organization/home.html"
|
||||||
|
|
||||||
def get_posts(self):
|
def get_posts(self):
|
||||||
posts = (
|
posts = (
|
||||||
BlogPost.objects.filter(
|
BlogPost.objects.filter(
|
||||||
|
|
Loading…
Reference in a new issue