Skip to content

Commit

Permalink
Merge pull request #12 from pitangainnovare/fix/pr-1
Browse files Browse the repository at this point in the history
Aplica correções sugeridas pela revisão realizada no Pull Request #1
  • Loading branch information
pitangainnovare authored May 10, 2024
2 parents 00bb1d7 + a0ca2c2 commit 31c9607
Show file tree
Hide file tree
Showing 31 changed files with 134 additions and 1,441 deletions.
2 changes: 1 addition & 1 deletion .envs/.local/.postgres
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# ------------------------------------------------------------------------------
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=scielo_core
POSTGRES_DB=scielo_usage
POSTGRES_USER=GVRFlLmcCNfGLhsFvSnCioYOPJPYpyfj
POSTGRES_PASSWORD=BQ4hSUL4rdj5WZLdR8ilDLRQMvCtzo0caMaXDO0olGsmycQjlcZlTVK9DepZR8kk
2 changes: 1 addition & 1 deletion .envs/.production/.postgres
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# ------------------------------------------------------------------------------
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=core
POSTGRES_DB=scielo_usage
POSTGRES_USER=GVRFlLmcCNfGLhsFvSnCioYOPJPYpyfj
POSTGRES_PASSWORD=BQ4hSUL4rdj5WZLdR8ilDLRQMvCtzo0caMaXDO0olGsmycQjlcZlTVK9DepZR8kk
223 changes: 0 additions & 223 deletions collection/migrations/0001_initial.py

This file was deleted.

6 changes: 2 additions & 4 deletions collection/tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.contrib.auth import get_user_model
from django.utils.translation import gettext as _

from core.utils.utils import _get_user
from collection.models import Collection
from config import celery_app

Expand All @@ -9,8 +10,5 @@

@celery_app.task(bind=True)
def task_load_collections(self, user_id=None, username=None):
if user_id:
user = User.objects.get(pk=user_id)
if username:
user = User.objects.get(username=username)
user = _get_user(self.request, username=username, user_id=user_id)
Collection.load(user)
32 changes: 12 additions & 20 deletions collection/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
from django.http import HttpResponseRedirect
from django.utils.translation import gettext as _
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from wagtail.contrib.modeladmin.views import CreateView

from .models import Collection
from wagtail.snippets.views.snippets import SnippetViewSet
from wagtail.snippets.models import register_snippet

from config.menu import get_menu_order

class CollectionCreateView(CreateView):
def form_valid(self, form):
self.object = form.save_all(self.request.user)
return HttpResponseRedirect(self.get_success_url())
from .models import Collection


class CollectionAdmin(ModelAdmin):
class CollectionSnippetViewSet(SnippetViewSet):
model = Collection
create_view_class = CollectionCreateView
inspect_view_enabled = True
menu_label = _("Collection")
menu_icon = "folder-open-inverse"
menu_order = 1
add_to_settings_menu = False
exclude_from_explorer = (
False
)
icon = "folder-open-inverse"
menu_name = 'collection'
menu_label = _("Collection")
menu_order = get_menu_order("collection")
add_to_admin_menu = True

list_display = (
"main_name",
"acron3",
Expand Down Expand Up @@ -66,4 +58,4 @@ class CollectionAdmin(ModelAdmin):
export_filename = "collections"


modeladmin_register(CollectionAdmin)
register_snippet(CollectionSnippetViewSet)
5 changes: 4 additions & 1 deletion config/menu.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
WAGTAIL_MENU_APPS_ORDER = {
"collection": 100,
"log_manager": 200,
"tasks": 300,
"unexpected-error": 400,
}


def get_menu_order(app_name):
try:
return WAGTAIL_MENU_APPS_ORDER[app_name]
Expand Down
2 changes: 0 additions & 2 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"core.search_site",
"wagtail.contrib.forms",
"wagtail.contrib.redirects",
"wagtail.contrib.modeladmin",
"wagtail_modeladmin",
"wagtail.contrib.simple_translation",
"wagtail_localize",
Expand All @@ -77,7 +76,6 @@
"wagtail.admin",
"wagtail",
"wagtail.locales",
"wagtail.api.v2",
"wagtail.contrib.settings",
"wagtail.contrib.styleguide",
"wagtail.contrib.routable_page",
Expand Down
2 changes: 0 additions & 2 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from wagtail.documents import urls as wagtaildocs_urls
from wagtailautocomplete.urls.admin import urlpatterns as autocomplete_admin_urls

from core.api.wagtail.api import api_router


urlpatterns = [
path("admin/autocomplete/", include(autocomplete_admin_urls)),
Expand Down
Empty file removed core/api/__init__.py
Empty file.
Empty file removed core/api/v1/__init__.py
Empty file.
24 changes: 0 additions & 24 deletions core/api/v1/serializers.py

This file was deleted.

15 changes: 0 additions & 15 deletions core/api/wagtail/api.py

This file was deleted.

Loading

0 comments on commit 31c9607

Please sign in to comment.