Skip to content

Commit

Permalink
Revert "Merge branch 'main' into release" (#2486)
Browse files Browse the repository at this point in the history
This reverts commit 0d1b6f0, reversing
changes made to 2ad61b5.

This merge to release was a mistake and needs to be reverted.
  • Loading branch information
jkueloc authored Aug 12, 2024
1 parent 0d1b6f0 commit 34a1fbd
Show file tree
Hide file tree
Showing 40 changed files with 1,377 additions and 1,671 deletions.
1 change: 0 additions & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ rules:
'unicorn/prefer-query-selector': off # See https://github.com/sindresorhus/eslint-plugin-unicorn/issues/276
'unicorn/prefer-node-append': off
'unicorn/prefer-ternary': off
'unicorn/no-lonely-if': off
env:
browser: true
es2024: true
Expand Down
43 changes: 11 additions & 32 deletions concordia/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.models import User
from django.db.models import Count
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.template.defaultfilters import truncatechars
Expand Down Expand Up @@ -79,7 +80,6 @@
SubmittedFilter,
TagCampaignListFilter,
TagCampaignStatusListFilter,
TopicListFilter,
TranscriptionCampaignListFilter,
TranscriptionCampaignStatusListFilter,
TranscriptionProjectListFilter,
Expand All @@ -93,9 +93,8 @@
CampaignAdminForm,
CardAdminForm,
GuideAdminForm,
ItemAdminForm,
ProjectAdminForm,
TopicAdminForm,
SanitizedDescriptionAdminForm,
)

logger = logging.getLogger(__name__)
Expand All @@ -111,18 +110,13 @@ class ConcordiaUserAdmin(UserAdmin):
)

def get_queryset(self, request):
qs = super().get_queryset(request).select_related("profile")
qs = super().get_queryset(request)
qs = qs.annotate(Count("transcription"))
return qs

@admin.display(
description="Transcription Count", ordering="profile__transcribe_count"
)
@admin.display(ordering="transcription__count")
def transcription_count(self, obj):
return obj.profile.transcribe_count

@admin.display(description="Review Count", ordering="profile__review_count")
def review_count(self, obj):
return obj.profile.review_count
return obj.transcription__count

EXPORT_FIELDS = (
"username",
Expand All @@ -134,31 +128,17 @@ def review_count(self, obj):
"is_superuser",
"date_joined",
"last_login",
"profile__transcribe_count",
"profile__review_count",
"transcription__count",
)

EXTRA_VERBOSE_NAMES = {
"profile__transcribe_count": "transcription count",
"profile__review_count": "review count",
}

def export_users_as_csv(self, request, queryset):
return export_to_csv_action(
self,
request,
queryset,
field_names=self.EXPORT_FIELDS,
extra_verbose_names=self.EXTRA_VERBOSE_NAMES,
self, request, queryset, field_names=self.EXPORT_FIELDS
)

def export_users_as_excel(self, request, queryset):
return export_to_excel_action(
self,
request,
queryset,
field_names=self.EXPORT_FIELDS,
extra_verbose_names=self.EXTRA_VERBOSE_NAMES,
self, request, queryset, field_names=self.EXPORT_FIELDS
)

actions = (anonymize_action, export_users_as_csv, export_users_as_excel)
Expand Down Expand Up @@ -378,8 +358,8 @@ class ResourceAdmin(admin.ModelAdmin, CustomListDisplayFieldsMixin):
list_filter = (
"resource_type",
ResourceCampaignStatusListFilter,
TopicListFilter,
ResourceCampaignListFilter,
"title",
)

def formfield_for_foreignkey(self, db_field, request, **kwargs):
Expand Down Expand Up @@ -416,7 +396,7 @@ def get_fields(self, request, obj=None):

@admin.register(Topic)
class TopicAdmin(admin.ModelAdmin):
form = TopicAdminForm
form = SanitizedDescriptionAdminForm

list_display = (
"id",
Expand Down Expand Up @@ -543,7 +523,6 @@ def item_import_view(self, request, object_id):

@admin.register(Item)
class ItemAdmin(admin.ModelAdmin):
form = ItemAdminForm
list_display = ("title", "item_id", "campaign_title", "project", "published")
list_display_links = ("title", "item_id")
search_fields = [
Expand Down
21 changes: 1 addition & 20 deletions concordia/admin/filters.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib import admin
from django.utils.translation import gettext_lazy as _

from ..models import Campaign, Project, Topic
from ..models import Campaign, Project


class NullableTimestampFilter(admin.SimpleListFilter):
Expand Down Expand Up @@ -92,25 +92,6 @@ def queryset(self, request, queryset):
return queryset


class TopicListFilter(admin.SimpleListFilter):
"""
Base class for admin topic filters
"""

title = "Topic"
template = "admin/long_name_filter.html"
parameter_name = "topic__id__exact"

def lookups(self, request, model_admin):
queryset = Topic.objects.all()
return queryset.values_list("id", "title").order_by("title")

def queryset(self, request, queryset):
if self.value():
return queryset.filter(**{self.parameter_name: self.value()})
return queryset


class ProjectCampaignListFilter(CampaignListFilter):
parameter_name = "campaign__id__exact"
status_filter_parameter = "campaign__status"
Expand Down
18 changes: 1 addition & 17 deletions concordia/admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.core.cache import caches
from tinymce.widgets import TinyMCE

from ..models import Campaign, Card, Guide, Item, Project, Topic
from ..models import Campaign, Card, Guide, Project

FRAGMENT_ALLOWED_TAGS = {
"a",
Expand Down Expand Up @@ -90,15 +90,6 @@ def clean_short_description(self):
)


class TopicAdminForm(SanitizedDescriptionAdminForm):
class Meta(SanitizedDescriptionAdminForm.Meta):
model = Topic
widgets = {
"description": TinyMCE(),
"short_description": TinyMCE(),
}


class CampaignAdminForm(SanitizedDescriptionAdminForm):
class Meta(SanitizedDescriptionAdminForm.Meta):
model = Campaign
Expand All @@ -117,13 +108,6 @@ class Meta(SanitizedDescriptionAdminForm.Meta):
}


class ItemAdminForm(forms.ModelForm):
class Meta:
model = Item
widgets = {"description": TinyMCE()}
fields = "__all__"


class CardAdminForm(forms.ModelForm):
class Meta:
model = Card
Expand Down
3 changes: 0 additions & 3 deletions concordia/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class Django:

fields = [
"created_on",
"report_name",
"assets_total",
"assets_published",
"assets_not_started",
Expand All @@ -55,14 +54,12 @@ class Django:
"projects_unpublished",
"anonymous_transcriptions",
"transcriptions_saved",
"daily_review_actions",
"distinct_tags",
"tag_uses",
"campaigns_published",
"campaigns_unpublished",
"users_registered",
"users_activated",
"registered_contributors",
"daily_active_users",
]

Expand Down

This file was deleted.

40 changes: 0 additions & 40 deletions concordia/migrations/0098_userprofile_create_and_population.py

This file was deleted.

Loading

0 comments on commit 34a1fbd

Please sign in to comment.