Skip to content

Commit

Permalink
Merge branch 'feature/883-slowa-kluczowe' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mpasternak committed Feb 27, 2021
2 parents 144875d + 3aada62 commit fcc24b1
Show file tree
Hide file tree
Showing 33 changed files with 949 additions and 82 deletions.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Historia zmian
* raport uczelnia-ewaluacja: jeżeli autor ma punktowane prace w danym roku w danej dyscyplinie, ale w innym
roku będącym w zakresie raportu autor jest "zerowy", to nie pokazuj go jako zerowego (#984),
* wyeliminowano błąd przebudowy cache poprzez usuniecie 'globalnej' transakcji (#989),
* prawdziwe, indeksowane słowa kluczowe dla wszystkich rekordów, z możliwością edycji oraz przeszukiwania (#883),
* [API] słowa kluczowe eksportowane są teraz jako lista, nie jako ciąg znaków (b/n),

202102.55
---------
Expand Down
2 changes: 2 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ cssmin==0.2.0
rjsmin==1.1.0
django-import-export==2.5.0
pymed-iplweb==0.8.10
django-taggit==1.3.0
django-taggit-serializer==0.1.7

# MacBook Pro M1 arm
cryptography>=3.3.1
Expand Down
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ django-sendfile==0.3.11 # via -r requirements.in
django-session-security-iplweb==2.6.6 # via -r requirements.in
django-static-sitemaps==4.6.0 # via -r requirements.in
django-tables2==2.3.1 # via -r requirements.in, django-flexible-reports
django-taggit-serializer==0.1.7 # via -r requirements.in
django-taggit==1.3.0 # via -r requirements.in, django-taggit-serializer
django-webmaster-verification==0.3.0 # via -r requirements.in
django==3.0.11 # via -r requirements.in, channels, crispy-forms-foundation, django-admin-sortable2, django-appconf, django-braces, django-classy-tags, django-columns, django-cookie-law, django-dirtyfields, django-dsl, django-favicon-plus, django-filter, django-flexible-reports, django-import-export, django-model-utils, django-mptt, django-multiseek, django-password-policies-iplweb, django-querysetsequence, django-sendfile, django-session-security-iplweb, django-static-sitemaps, django-tables2, django-webmaster-verification, djangorestframework
django==3.0.11 # via -r requirements.in, channels, crispy-forms-foundation, django-admin-sortable2, django-appconf, django-braces, django-classy-tags, django-columns, django-cookie-law, django-dirtyfields, django-dsl, django-favicon-plus, django-filter, django-flexible-reports, django-import-export, django-model-utils, django-mptt, django-multiseek, django-password-policies-iplweb, django-querysetsequence, django-sendfile, django-session-security-iplweb, django-static-sitemaps, django-tables2, django-taggit, django-webmaster-verification, djangorestframework
django_compressor==2.4 # via -r requirements.in
djangorestframework==3.11.0 # via -r requirements.in
et-xmlfile==1.0.1 # via openpyxl
Expand Down Expand Up @@ -115,7 +117,7 @@ requests==2.20.0 # via -r requirements.in, pymed-iplweb, wosclient
rjsmin==1.1.0 # via -r requirements.in, django-compressor
sentry-sdk==0.14.1 # via -r requirements.in
service-identity==18.1.0 # via twisted
six==1.14.0 # via automat, bleach, cryptography, django-appconf, django-autocomplete-light, django-braces, django-classy-tags, django-compat, django-compressor, django-extensions, django-grappelli, django-redis-cache, django-static-sitemaps, html5lib, moai-iplweb, paste, pastescript, progressbar2, pyoai, pyopenssl, python-dateutil, python-utils, wsgi-intercept
six==1.14.0 # via automat, bleach, cryptography, django-appconf, django-autocomplete-light, django-braces, django-classy-tags, django-compat, django-compressor, django-extensions, django-grappelli, django-redis-cache, django-static-sitemaps, django-taggit-serializer, html5lib, moai-iplweb, paste, pastescript, progressbar2, pyoai, pyopenssl, python-dateutil, python-utils, wsgi-intercept
soupsieve==2.0 # via beautifulsoup4
sqlalchemy==1.3.15 # via moai-iplweb
sqlparse==0.3.1 # via django
Expand Down
8 changes: 4 additions & 4 deletions src/api_v1/serializers/patent.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
from rest_framework import serializers
from taggit_serializer.serializers import TagListSerializerField

from api_v1.serializers.util import (
AbsoluteUrlSerializerMixin,
Wydawnictwo_AutorSerializerMixin,
WydawnictwoSerializerMixin,
)
from bpp.models import (
Patent_Autor,
Patent,
)
from bpp.models import Patent, Patent_Autor


class Patent_AutorSerializer(
Expand Down Expand Up @@ -40,6 +38,8 @@ class PatentSerializer(
WydawnictwoSerializerMixin,
serializers.HyperlinkedModelSerializer,
):
slowa_kluczowe = TagListSerializerField()

rodzaj_prawa = serializers.RelatedField(read_only=True)
# "bpp.Rodzaj_Prawa_Patentowego", CASCADE, null=True, blank=True
# )
Expand Down
4 changes: 3 additions & 1 deletion src/api_v1/serializers/praca_doktorska.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from rest_framework import serializers
from taggit_serializer.serializers import TagListSerializerField

from api_v1.serializers.util import (
AbsoluteUrlSerializerMixin,
Wydawnictwo_AutorSerializerMixin,
WydawnictwoSerializerMixin,
)
from bpp.models import Praca_Doktorska
Expand All @@ -25,6 +25,8 @@ class Praca_DoktorskaSerializer(
view_name="api_v1:jednostka-detail", read_only=True
)

slowa_kluczowe = TagListSerializerField()

class Meta:
model = Praca_Doktorska
fields = [
Expand Down
3 changes: 3 additions & 0 deletions src/api_v1/serializers/praca_habilitacyjna.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from rest_framework import serializers
from taggit_serializer.serializers import TagListSerializerField

from api_v1.serializers.util import (
AbsoluteUrlSerializerMixin,
Expand All @@ -12,6 +13,8 @@ class Praca_HabilitacyjnaSerializer(
WydawnictwoSerializerMixin,
serializers.HyperlinkedModelSerializer,
):
slowa_kluczowe = TagListSerializerField()

autor = serializers.HyperlinkedRelatedField(
view_name="api_v1:autor-detail", read_only=True
)
Expand Down
7 changes: 4 additions & 3 deletions src/api_v1/serializers/wydawnictwo_ciagle.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from rest_framework import serializers
from taggit_serializer.serializers import TagListSerializerField

from api_v1.serializers.util import (
AbsoluteUrlSerializerMixin,
Wydawnictwo_AutorSerializerMixin,
WydawnictwoSerializerMixin,
)
from bpp.models import (
Wydawnictwo_Zwarte,
Wydawnictwo_Zwarte_Autor,
Wydawnictwo_Ciagle_Autor,
Wydawnictwo_Ciagle,
Wydawnictwo_Ciagle_Autor,
Wydawnictwo_Ciagle_Zewnetrzna_Baza_Danych,
)

Expand Down Expand Up @@ -55,6 +54,8 @@ class Wydawnictwo_CiagleSerializer(
serializers.HyperlinkedModelSerializer,
):

slowa_kluczowe = TagListSerializerField()

zrodlo = serializers.HyperlinkedRelatedField(
view_name="api_v1:zrodlo-detail", read_only=True
)
Expand Down
2 changes: 2 additions & 0 deletions src/api_v1/serializers/wydawnictwo_zwarte.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from rest_framework import serializers
from taggit_serializer.serializers import TagListSerializerField

from api_v1.serializers.util import (
AbsoluteUrlSerializerMixin,
Expand Down Expand Up @@ -37,6 +38,7 @@ class Wydawnictwo_ZwarteSerializer(
WydawnictwoSerializerMixin,
serializers.HyperlinkedModelSerializer,
):
slowa_kluczowe = TagListSerializerField()

wydawca = serializers.HyperlinkedRelatedField(
view_name="api_v1:wydawca-detail", read_only=True
Expand Down
2 changes: 1 addition & 1 deletion src/api_v1/tests/test_patent.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_rest_api_patent_ukryj_status(


@pytest.fixture
def wiele_patentow(db):
def wiele_patentow(db, jezyki, charaktery_formalne):
for a in range(100):
mommy.make(Patent)

Expand Down
2 changes: 1 addition & 1 deletion src/api_v1/viewsets/patent.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PatentViewSet(UkryjStatusyKorektyMixin, viewsets.ReadOnlyModelViewSet):
Patent.objects.exclude(nie_eksportuj_przez_api=True)
.order_by("pk")
.select_related() # "status_korekty", "jezyk", "charakter_formalny")
.prefetch_related("autorzy_set")
.prefetch_related("autorzy_set", "slowa_kluczowe")
)
serializer_class = PatentSerializer
filterset_class = PatentFilterSet
1 change: 1 addition & 0 deletions src/api_v1/viewsets/praca_doktorska.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Praca_DoktorskaViewSet(UkryjStatusyKorektyMixin, viewsets.ReadOnlyModelVie
Praca_Doktorska.objects.exclude(nie_eksportuj_przez_api=True)
.order_by("pk")
.select_related("status_korekty")
.prefetch_related("slowa_kluczowe")
)
serializer_class = Praca_DoktorskaSerializer
filterset_class = Praca_DoktorskaFilterSet
1 change: 1 addition & 0 deletions src/api_v1/viewsets/praca_habilitacyjna.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Praca_HabilitacyjnaViewSet(
Praca_Habilitacyjna.objects.exclude(nie_eksportuj_przez_api=True)
.order_by("pk")
.select_related("status_korekty")
.prefetch_related("slowa_kluczowe")
)
serializer_class = Praca_HabilitacyjnaSerializer
filterset_class = Praca_HabilitacyjnaFilterSet
2 changes: 1 addition & 1 deletion src/api_v1/viewsets/wydawnictwo_ciagle.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Wydawnictwo_CiagleViewSet(
Wydawnictwo_Ciagle.objects.exclude(nie_eksportuj_przez_api=True)
.order_by("pk")
.select_related("status_korekty")
.prefetch_related("autorzy_set", "zewnetrzna_baza_danych")
.prefetch_related("autorzy_set", "zewnetrzna_baza_danych", "slowa_kluczowe")
)

serializer_class = Wydawnictwo_CiagleSerializer
Expand Down
2 changes: 1 addition & 1 deletion src/api_v1/viewsets/wydawnictwo_zwarte.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Wydawnictwo_ZwarteViewSet(
Wydawnictwo_Zwarte.objects.exclude(nie_eksportuj_przez_api=True)
.order_by("pk")
.select_related("status_korekty")
.prefetch_related("autorzy_set", "nagrody")
.prefetch_related("autorzy_set", "nagrody", "slowa_kluczowe")
)
serializer_class = Wydawnictwo_ZwarteSerializer
filterset_class = Wydawnictwo_ZwarteFilterSet
8 changes: 4 additions & 4 deletions src/bpp/admin/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class AdnotacjeZDatamiOrazPBNMixin:
def js_openwin(url, handle, options):
options = ",".join(["%s=%s" % (a, b) for a, b in list(options.items())])
d = dict(url=url, handle=handle, options=options)
return "window.open('%(url)s','\%(handle)s','%(options)s')" % d
return "window.open('%(url)s','\\%(handle)s','%(options)s')" % d


NIZSZE_TEXTFIELD_Z_MAPA_ZNAKOW = {
Expand All @@ -301,11 +301,11 @@ class Wycinaj_W_z_InformacjiMixin:
def clean_informacje(self):
i = self.cleaned_data.get("informacje")
if i:
l = i.lower()
x = i.lower()
n = 0
if l.startswith("w:"):
if x.startswith("w:"):
n = 2
if l.startswith("w :"):
if x.startswith("w :"):
n = 3
if n:
return i[n:].strip()
Expand Down
15 changes: 10 additions & 5 deletions src/bpp/admin/patent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from django import forms
from django.contrib import admin
from taggit.forms import TextareaTagWidget

from bpp.models.patent import Patent, Patent_Autor

from .core import generuj_inline_dla_autorow
from .element_repozytorium import Element_RepozytoriumInline
from .grant import Grant_RekorduInline
Expand All @@ -17,17 +22,17 @@
)
from .wydawnictwo_zwarte import Wydawnictwo_ZwarteAdmin_Baza

from django.contrib import admin

from bpp.models.patent import Patent, Patent_Autor


class Patent_Form(Wycinaj_W_z_InformacjiMixin, forms.ModelForm):
status_korekty = DomyslnyStatusKorektyMixin.status_korekty

class Meta:
fields = "__all__"

widgets = {
"slowa_kluczowe": TextareaTagWidget(attrs={"rows": 2}),
}


class Patent_Admin(AdnotacjeZDatamiMixin, Wydawnictwo_ZwarteAdmin_Baza):
inlines = (
Expand All @@ -43,7 +48,7 @@ class Patent_Admin(AdnotacjeZDatamiMixin, Wydawnictwo_ZwarteAdmin_Baza):
"szczegoly",
"uwagi",
"informacje",
"slowa_kluczowe",
"slowa_kluczowe__name",
"rok",
"adnotacje",
"id",
Expand Down
6 changes: 5 additions & 1 deletion src/bpp/admin/praca_doktorska.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from dal import autocomplete
from django import forms
from django.contrib import admin
from taggit.forms import TextareaTagWidget

from ..models import Autor, Jednostka, Praca_Doktorska
from .actions import ustaw_po_korekcie, ustaw_przed_korekta, ustaw_w_trakcie_korekty
Expand Down Expand Up @@ -77,7 +78,7 @@ class Praca_Doktorska_Habilitacyjna_Admin_Base(
"szczegoly",
"uwagi",
"informacje",
"slowa_kluczowe",
"slowa_kluczowe__name",
"rok",
"www",
"wydawca_opis",
Expand Down Expand Up @@ -113,6 +114,9 @@ class Praca_DoktorskaForm(Wycinaj_W_z_InformacjiMixin, forms.ModelForm):
class Meta:
model = Praca_Doktorska
fields = "__all__"
widgets = {
"slowa_kluczowe": TextareaTagWidget(attrs={"rows": 2}),
}


class Praca_DoktorskaAdmin(Praca_Doktorska_Habilitacyjna_Admin_Base):
Expand Down
5 changes: 4 additions & 1 deletion src/bpp/admin/praca_habilitacyjna.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- encoding: utf-8 -*-

from dal import autocomplete
from dal.forms import FutureModelForm
from dal_queryset_sequence.fields import QuerySetSequenceModelField
Expand All @@ -8,6 +7,7 @@
from django.contrib import admin
from django.forms.widgets import HiddenInput
from queryset_sequence import QuerySetSequence
from taggit.forms import TextareaTagWidget

from bpp.models import ( # Publikacja_Habilitacyjna
Autor,
Expand Down Expand Up @@ -102,6 +102,9 @@ class Praca_HabilitacyjnaForm(forms.ModelForm):

class Meta:
fields = "__all__"
widgets = {
"slowa_kluczowe": TextareaTagWidget(attrs={"rows": 2}),
}


class Praca_HabilitacyjnaAdmin(Praca_Doktorska_Habilitacyjna_Admin_Base):
Expand Down
5 changes: 3 additions & 2 deletions src/bpp/admin/wydawnictwo_ciagle.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- encoding: utf-8 -*-

from dal import autocomplete
from django import forms
from django.contrib import admin
from django.forms.utils import flatatt
from django.utils.safestring import mark_safe
from mptt.forms import TreeNodeChoiceField
from taggit.forms import TextareaTagWidget

from bpp.admin.filters import DOIUstawioneFilter, LiczbaZnakowFilter
from bpp.admin.helpers import (
Expand Down Expand Up @@ -108,6 +108,7 @@ class Meta:
"strony": forms.TextInput(attrs=dict(style="width: 150px")),
"tom": forms.TextInput(attrs=dict(style="width: 150px")),
"nr_zeszytu": forms.TextInput(attrs=dict(style="width: 150px")),
"slowa_kluczowe": TextareaTagWidget(attrs={"rows": 2}),
}


Expand Down Expand Up @@ -148,7 +149,7 @@ class Wydawnictwo_CiagleAdmin(
"szczegoly",
"uwagi",
"informacje",
"slowa_kluczowe",
"slowa_kluczowe__name",
"rok",
"id",
"issn",
Expand Down
4 changes: 3 additions & 1 deletion src/bpp/admin/wydawnictwo_zwarte.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django import forms
from django.contrib import admin, messages
from mptt.forms import TreeNodeChoiceField
from taggit.forms import TextareaTagWidget

from bpp.admin import helpers
from bpp.admin.filters import (
Expand Down Expand Up @@ -54,7 +55,7 @@ class Wydawnictwo_ZwarteAdmin_Baza(CommitedModelAdmin):
"szczegoly",
"uwagi",
"informacje",
"slowa_kluczowe",
"slowa_kluczowe__name",
"rok",
"isbn",
"id",
Expand Down Expand Up @@ -158,6 +159,7 @@ class Meta:
widgets = {
"strony": forms.TextInput(attrs=dict(style="width: 150px")),
"tom": forms.TextInput(attrs=dict(style="width: 150px")),
"slowa_kluczowe": TextareaTagWidget(attrs={"rows": 2}),
}


Expand Down
Loading

0 comments on commit fcc24b1

Please sign in to comment.