Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/46 producttype nl datamodel #2

Merged
merged 8 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/generate_api_schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ OUTFILE=${1:-src/openapi.yaml}
src/manage.py spectacular \
--validate \
--fail-on-warn \
--lang=en \
--lang=nl \
--file "$OUTFILE"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
requires-python = "3.11"
requires-python = '>= 3.11'

[tool.uv.pip]
emit-index-url = false
3 changes: 1 addition & 2 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ django-treebeard

# API libraries
# django-extra-fields
django-tinymce
django-markdownx
geopy
django-open-forms-client
django-localflavor

# waiting for > 2.0.1
Expand Down
19 changes: 9 additions & 10 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ django==4.2.16
# django-jsonform
# django-localflavor
# django-log-outgoing-requests
# django-markdownx
# django-markup
# django-open-forms-client
# django-otp
# django-phonenumber-field
# django-privates
Expand All @@ -97,7 +97,6 @@ django==4.2.16
# django-setup-configuration
# django-simple-certmanager
# django-solo
# django-tinymce
# django-treebeard
# django-two-factor-auth
# djangorestframework
Expand Down Expand Up @@ -137,10 +136,10 @@ django-localflavor==4.0
# via -r requirements/base.in
django-log-outgoing-requests==0.6.1
# via open-api-framework
django-markdownx==4.0.7
# via -r requirements/base.in
django-markup==1.9.1
# via open-api-framework
django-open-forms-client==0.4.0
# via -r requirements/base.in
django-ordered-model==3.7.4
# via django-admin-index
django-otp==1.5.4
Expand All @@ -167,12 +166,9 @@ django-solo==2.4.0
# via
# commonground-api-common
# django-log-outgoing-requests
# django-open-forms-client
# mozilla-django-oidc-db
# notifications-api-common
# zgw-consumers
django-tinymce==4.1.0
# via -r requirements/base.in
django-treebeard==4.7.1
# via -r requirements/base.in
django-two-factor-auth==1.17.0
Expand Down Expand Up @@ -250,7 +246,9 @@ jsonschema-specifications==2024.10.1
kombu==5.4.2
# via celery
markdown==3.7
# via django-markup
# via
# django-markdownx
# django-markup
markupsafe==3.0.2
# via jinja2
maykin-2fa==1.0.1
Expand All @@ -274,7 +272,9 @@ packaging==24.2
phonenumberslite==8.13.50
# via django-two-factor-auth
pillow==11.0.0
# via -r requirements/base.in
# via
# -r requirements/base.in
# django-markdownx
prometheus-client==0.21.0
# via flower
prompt-toolkit==3.0.48
Expand Down Expand Up @@ -334,7 +334,6 @@ requests==2.32.3
# commonground-api-common
# coreapi
# django-log-outgoing-requests
# django-open-forms-client
# gemma-zds-client
# mozilla-django-oidc
# open-api-framework
Expand Down
17 changes: 6 additions & 11 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ django==4.2.16
# django-jsonform
# django-localflavor
# django-log-outgoing-requests
# django-markdownx
# django-markup
# django-open-forms-client
# django-otp
# django-phonenumber-field
# django-privates
Expand All @@ -164,7 +164,6 @@ django==4.2.16
# django-setup-configuration
# django-simple-certmanager
# django-solo
# django-tinymce
# django-treebeard
# django-two-factor-auth
# djangorestframework
Expand Down Expand Up @@ -231,15 +230,15 @@ django-log-outgoing-requests==0.6.1
# -c requirements/base.txt
# -r requirements/base.txt
# open-api-framework
django-markup==1.9.1
django-markdownx==4.0.7
# via
# -c requirements/base.txt
# -r requirements/base.txt
# open-api-framework
django-open-forms-client==0.4.0
django-markup==1.9.1
# via
# -c requirements/base.txt
# -r requirements/base.txt
# open-api-framework
django-ordered-model==3.7.4
# via
# -c requirements/base.txt
Expand Down Expand Up @@ -301,14 +300,9 @@ django-solo==2.4.0
# -r requirements/base.txt
# commonground-api-common
# django-log-outgoing-requests
# django-open-forms-client
# mozilla-django-oidc-db
# notifications-api-common
# zgw-consumers
django-tinymce==4.1.0
# via
# -c requirements/base.txt
# -r requirements/base.txt
django-treebeard==4.7.1
# via
# -c requirements/base.txt
Expand Down Expand Up @@ -492,6 +486,7 @@ markdown==3.7
# via
# -c requirements/base.txt
# -r requirements/base.txt
# django-markdownx
# django-markup
markupsafe==3.0.2
# via
Expand Down Expand Up @@ -560,6 +555,7 @@ pillow==11.0.0
# via
# -c requirements/base.txt
# -r requirements/base.txt
# django-markdownx
platformdirs==4.3.6
# via
# black
Expand Down Expand Up @@ -686,7 +682,6 @@ requests==2.32.3
# commonground-api-common
# coreapi
# django-log-outgoing-requests
# django-open-forms-client
# gemma-zds-client
# mozilla-django-oidc
# open-api-framework
Expand Down
17 changes: 6 additions & 11 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ django==4.2.16
# django-jsonform
# django-localflavor
# django-log-outgoing-requests
# django-markdownx
# django-markup
# django-open-forms-client
# django-otp
# django-phonenumber-field
# django-privates
Expand All @@ -191,7 +191,6 @@ django==4.2.16
# django-setup-configuration
# django-simple-certmanager
# django-solo
# django-tinymce
# django-treebeard
# django-two-factor-auth
# djangorestframework
Expand Down Expand Up @@ -262,15 +261,15 @@ django-log-outgoing-requests==0.6.1
# -c requirements/ci.txt
# -r requirements/ci.txt
# open-api-framework
django-markup==1.9.1
django-markdownx==4.0.7
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
# open-api-framework
django-open-forms-client==0.4.0
django-markup==1.9.1
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
# open-api-framework
django-ordered-model==3.7.4
# via
# -c requirements/ci.txt
Expand Down Expand Up @@ -332,14 +331,9 @@ django-solo==2.4.0
# -r requirements/ci.txt
# commonground-api-common
# django-log-outgoing-requests
# django-open-forms-client
# mozilla-django-oidc-db
# notifications-api-common
# zgw-consumers
django-tinymce==4.1.0
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
django-treebeard==4.7.1
# via
# -c requirements/ci.txt
Expand Down Expand Up @@ -549,6 +543,7 @@ markdown==3.7
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
# django-markdownx
# django-markup
markupsafe==3.0.2
# via
Expand Down Expand Up @@ -626,6 +621,7 @@ pillow==11.0.0
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
# django-markdownx
platformdirs==4.3.6
# via
# -c requirements/ci.txt
Expand Down Expand Up @@ -765,7 +761,6 @@ requests==2.32.3
# commonground-api-common
# coreapi
# django-log-outgoing-requests
# django-open-forms-client
# gemma-zds-client
# mozilla-django-oidc
# open-api-framework
Expand Down
29 changes: 10 additions & 19 deletions src/open_producten/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
"rest_framework.authtoken",
"localflavor",
"treebeard",
"tinymce",
"openformsclient",
"markdownx",
"django.contrib.gis",
"open_producten.accounts",
"open_producten.utils",
# "open_producten.producttypen",
"open_producten.producttypen",
# "open_producten.products",
# "open_producten.locations",
]
Expand Down Expand Up @@ -71,6 +70,11 @@

ADMIN_INDEX_SHOW_REMAINING_APPS = False

#
# markdownx
#
MARKDOWNX_EDITOR_RESIZABLE = False

#
# Django rest framework
#
Expand Down Expand Up @@ -106,24 +110,11 @@
"DESCRIPTION": _DESCRIPTION,
"TOS": None,
"VERSION": API_VERSION,
"SWAGGER_UI_DIST": "SIDECAR",
"SWAGGER_UI_FAVICON_HREF": "SIDECAR",
"REDOC_DIST": "SIDECAR",
}

TINYMCE_DEFAULT_CONFIG = { # TODO: light/dark mode based on browser settings
"height": 200,
"menubar": False,
"plugins": "advlist,autolink,lists,link,image,charmap,print,preview,anchor,"
"searchreplace,visualblocks,code,fullscreen,insertdatetime,media,table,paste,"
"code,wordcount",
"toolbar": "undo redo | formatselect | "
"bold italic backcolor | alignleft aligncenter "
"alignright alignjustify | bullist numlist outdent indent | "
"removeformat",
"skin": "oxide-dark",
"content_css": "dark",
}

TINYMCE_EXTRA_MEDIA = {"js": ["initTinymce.js"]}

#
# geopy
#
Expand Down
Empty file.
17 changes: 17 additions & 0 deletions src/open_producten/producttypen/admin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from .bestand import BestandAdmin
from .link import LinkAdmin
from .onderwerp import OnderwerpAdmin
from .prijs import PrijsAdmin
from .producttype import ProductTypeAdmin
from .upn import UniformeProductNaamAdmin
from .vraag import VraagAdmin

__all__ = [
"ProductTypeAdmin",
"BestandAdmin",
"LinkAdmin",
"VraagAdmin",
"UniformeProductNaamAdmin",
"PrijsAdmin",
"OnderwerpAdmin",
]
17 changes: 17 additions & 0 deletions src/open_producten/producttypen/admin/bestand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.contrib import admin

from ..models import Bestand


class BestandInline(admin.TabularInline):
model = Bestand
extra = 1


@admin.register(Bestand)
class BestandAdmin(admin.ModelAdmin):
Floris272 marked this conversation as resolved.
Show resolved Hide resolved
list_display = ("product_type", "bestand")
list_filter = ("product_type",)

def get_queryset(self, request):
return super().get_queryset(request).select_related("product_type")
17 changes: 17 additions & 0 deletions src/open_producten/producttypen/admin/link.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.contrib import admin

from ..models import Link


class LinkInline(admin.TabularInline):
Floris272 marked this conversation as resolved.
Show resolved Hide resolved
model = Link
extra = 1
ordering = ("pk",)


@admin.register(Link)
class LinkAdmin(admin.ModelAdmin):
Floris272 marked this conversation as resolved.
Show resolved Hide resolved
list_display = ("product_type", "naam", "url")

def get_queryset(self, request):
return super().get_queryset(request).select_related("product_type")
Loading
Loading