Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/breatheco-de/apiv2 into dev…
Browse files Browse the repository at this point in the history
…elopment
  • Loading branch information
jefer94 committed Jul 4, 2024
2 parents 90d7d0f + 30f116c commit 085cb3e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 34 deletions.
18 changes: 9 additions & 9 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion breathecode/events/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class EventSmallSerializer(EventTinySerializer):
eventbrite_sync_description = serpy.Field()
tags = serpy.Field()
asset_slug = serpy.Field()
host_user = UserSerializer(required=False)
host_user = UserBigSerializer(required=False)
author = UserSerializer(required=False)
asset = serpy.MethodField()

Expand Down
73 changes: 49 additions & 24 deletions breathecode/registry/admin.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,47 @@
import logging, re, html
import html
import logging
import re

from django import forms
from django.contrib import admin, messages
from django.utils.html import format_html
from django.db.models import Q
from django import forms
from breathecode.utils.admin import change_field
from django.utils.html import format_html

from breathecode.services.seo import SEOAnalyzer
from breathecode.utils.admin import change_field

from .actions import (
AssetThumbnailGenerator,
add_syllabus_translations,
clean_asset_readme,
get_user_from_github_username,
process_asset_config,
push_to_github,
scan_asset_originality,
)
from .models import (
Asset,
AssetTechnology,
AssetAlias,
AssetErrorLog,
KeywordCluster,
AssetCategory,
AssetKeyword,
AssetComment,
SEOReport,
AssetErrorLog,
AssetImage,
OriginalityScan,
AssetKeyword,
AssetTechnology,
ContentVariable,
CredentialsOriginality,
KeywordCluster,
OriginalityScan,
SEOReport,
SyllabusVersionProxy,
ContentVariable,
)
from .tasks import (
async_pull_from_github,
async_test_asset,
async_download_readme_images,
async_pull_from_github,
async_remove_img_from_cloud,
async_upload_image_to_bucket,
async_test_asset,
async_update_frontend_asset_cache,
)
from .actions import (
get_user_from_github_username,
AssetThumbnailGenerator,
scan_asset_originality,
add_syllabus_translations,
clean_asset_readme,
process_asset_config,
push_to_github,
async_upload_image_to_bucket,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -592,6 +596,27 @@ def queryset(self, request, queryset):
return queryset.filter(visibility="PRIVATE")


class SortPriorityFilter(admin.SimpleListFilter):

title = "Sort Priority"

parameter_name = "sort_priority"

def lookups(self, request, model_admin):

return (("1", "1"), ("2", "2"), ("3", "3"))

def queryset(self, request, queryset):
if self.value() == "1":
return queryset.filter(sort_priority="1")

if self.value() == "2":
return queryset.filter(sort_priority="2")

if self.value() == "3":
return queryset.filter(sort_priority="3")


def mark_technologies_as_unlisted(modeladmin, request, queryset):
technologies = queryset.all()
for technology in technologies:
Expand All @@ -603,7 +628,7 @@ def mark_technologies_as_unlisted(modeladmin, request, queryset):
class AssetTechnologyAdmin(admin.ModelAdmin):
search_fields = ["title", "slug"]
list_display = ("id", "get_slug", "title", "parent", "featured_asset", "description", "visibility", "is_deprecated")
list_filter = (ParentFilter, VisibilityFilter, IsDeprecatedFilter)
list_filter = (ParentFilter, VisibilityFilter, IsDeprecatedFilter, SortPriorityFilter)
raw_id_fields = ["parent", "featured_asset"]

actions = (merge_technologies, slug_to_lower_case, mark_technologies_as_unlisted)
Expand Down

0 comments on commit 085cb3e

Please sign in to comment.