Compare commits
No commits in common. "f31cd623516124d8bd2870f1004ea1dec19f3c8c" and "9dda7670df99e62e307962731e705903fb72f6a0" have entirely different histories.
f31cd62351
...
9dda7670df
|
@ -21,7 +21,6 @@ dependencies = [
|
||||||
"whitenoise==6.6.0",
|
"whitenoise==6.6.0",
|
||||||
"django-zen-queries==2.1.0",
|
"django-zen-queries==2.1.0",
|
||||||
"django-registries==0.0.3",
|
"django-registries==0.0.3",
|
||||||
"django-view-decorator==0.0.4",
|
|
||||||
]
|
]
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ django==5.0.1
|
||||||
# django-allauth
|
# django-allauth
|
||||||
# django-money
|
# django-money
|
||||||
# django-registries
|
# django-registries
|
||||||
# django-view-decorator
|
|
||||||
# django-zen-queries
|
# django-zen-queries
|
||||||
# membersystem (pyproject.toml)
|
# membersystem (pyproject.toml)
|
||||||
django-allauth==0.60.0
|
django-allauth==0.60.0
|
||||||
|
@ -41,8 +40,6 @@ django-money==3.4.1
|
||||||
# via membersystem (pyproject.toml)
|
# via membersystem (pyproject.toml)
|
||||||
django-registries==0.0.3
|
django-registries==0.0.3
|
||||||
# via membersystem (pyproject.toml)
|
# via membersystem (pyproject.toml)
|
||||||
django-view-decorator==0.0.4
|
|
||||||
# via membersystem (pyproject.toml)
|
|
||||||
django-zen-queries==2.1.0
|
django-zen-queries==2.1.0
|
||||||
# via membersystem (pyproject.toml)
|
# via membersystem (pyproject.toml)
|
||||||
environs[django]==10.0.0
|
environs[django]==10.0.0
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
# Generated by Django 5.0.1 on 2024-01-14 11:14
|
|
||||||
|
|
||||||
import djmoney.models.fields
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
dependencies = [
|
|
||||||
("accounting", "0001_initial"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name="order",
|
|
||||||
name="price_currency",
|
|
||||||
field=djmoney.models.fields.CurrencyField(
|
|
||||||
choices=[("DKK", "DKK")], default=None, editable=False, max_length=3
|
|
||||||
),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name="order",
|
|
||||||
name="vat_currency",
|
|
||||||
field=djmoney.models.fields.CurrencyField(
|
|
||||||
choices=[("DKK", "DKK")], default=None, editable=False, max_length=3
|
|
||||||
),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name="payment",
|
|
||||||
name="amount_currency",
|
|
||||||
field=djmoney.models.fields.CurrencyField(
|
|
||||||
choices=[("DKK", "DKK")], default=None, editable=False, max_length=3
|
|
||||||
),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name="transaction",
|
|
||||||
name="amount_currency",
|
|
||||||
field=djmoney.models.fields.CurrencyField(
|
|
||||||
choices=[("DKK", "DKK")], default=None, editable=False, max_length=3
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.contrib.auth.decorators import permission_required
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django_view_decorator import namespaced_decorator_factory
|
|
||||||
|
|
||||||
from .permissions import ADMINISTRATE_MEMBERS
|
from .permissions import ADMINISTRATE_MEMBERS
|
||||||
from .selectors import get_member
|
from .selectors import get_member
|
||||||
|
@ -11,14 +12,7 @@ from utils.view_utils import render_list
|
||||||
from utils.view_utils import RowAction
|
from utils.view_utils import RowAction
|
||||||
|
|
||||||
|
|
||||||
member_view = namespaced_decorator_factory(namespace="member", base_path="membership")
|
@login_required
|
||||||
|
|
||||||
|
|
||||||
@member_view(
|
|
||||||
paths="",
|
|
||||||
name="membership-overview",
|
|
||||||
login_required=True,
|
|
||||||
)
|
|
||||||
def membership_overview(request):
|
def membership_overview(request):
|
||||||
memberships = get_memberships(member=request.user)
|
memberships = get_memberships(member=request.user)
|
||||||
current_membership = memberships.current()
|
current_membership = memberships.current()
|
||||||
|
@ -39,18 +33,8 @@ def membership_overview(request):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
admin_members_view = namespaced_decorator_factory(
|
@login_required
|
||||||
namespace="admin-members",
|
@permission_required(ADMINISTRATE_MEMBERS.path)
|
||||||
base_path="admin",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@admin_members_view(
|
|
||||||
paths="members/",
|
|
||||||
name="list",
|
|
||||||
login_required=True,
|
|
||||||
permissions=[ADMINISTRATE_MEMBERS.path],
|
|
||||||
)
|
|
||||||
def members_admin(request):
|
def members_admin(request):
|
||||||
users = get_members()
|
users = get_members()
|
||||||
|
|
||||||
|
@ -70,19 +54,15 @@ def members_admin(request):
|
||||||
row_actions=[
|
row_actions=[
|
||||||
RowAction(
|
RowAction(
|
||||||
label=_("View"),
|
label=_("View"),
|
||||||
url_name="admin-members:detail",
|
url_name="admin-members-detail",
|
||||||
url_kwargs={"member_id": "id"},
|
url_kwargs={"member_id": "id"},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@admin_members_view(
|
@login_required
|
||||||
paths="<int:member_id>/",
|
@permission_required(ADMINISTRATE_MEMBERS.path)
|
||||||
name="detail",
|
|
||||||
login_required=True,
|
|
||||||
permissions=[ADMINISTRATE_MEMBERS.path],
|
|
||||||
)
|
|
||||||
def members_admin_detail(request, member_id):
|
def members_admin_detail(request, member_id):
|
||||||
member = get_member(member_id=member_id)
|
member = get_member(member_id=member_id)
|
||||||
subscription_periods = get_subscription_periods(member=member)
|
subscription_periods = get_subscription_periods(member=member)
|
||||||
|
@ -90,7 +70,7 @@ def members_admin_detail(request, member_id):
|
||||||
context = {
|
context = {
|
||||||
"member": member,
|
"member": member,
|
||||||
"subscription_periods": subscription_periods,
|
"subscription_periods": subscription_periods,
|
||||||
"base_path": "admin-members:list",
|
"base_path": "admin-members",
|
||||||
}
|
}
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
|
|
|
@ -40,7 +40,6 @@ DJANGO_APPS = [
|
||||||
THIRD_PARTY_APPS = [
|
THIRD_PARTY_APPS = [
|
||||||
"allauth",
|
"allauth",
|
||||||
"allauth.account",
|
"allauth.account",
|
||||||
"django_view_decorator",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
LOCAL_APPS = [
|
LOCAL_APPS = [
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
|
|
||||||
{% if perms.membership.administrate_memberships %}
|
{% if perms.membership.administrate_memberships %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url "admin-members:list" %}" class="{% active_path "admin-members:list" "current" %}">
|
<a href="{% url "admin-members" %}" class="{% active_path "admin-members" "current" %}">
|
||||||
Admin
|
Admin
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -1,12 +1,26 @@
|
||||||
"""URLs for the membersystem"""
|
"""URLs for the membersystem"""
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.urls import include
|
from django.urls import include
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from django_view_decorator import include_view_urls
|
|
||||||
|
from .views import index
|
||||||
|
from .views import services_overview
|
||||||
|
from membership.views import members_admin
|
||||||
|
from membership.views import members_admin_detail
|
||||||
|
from membership.views import membership_overview
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", include_view_urls(extra_modules=["project.views"])),
|
path("", login_required(index), name="index"),
|
||||||
|
path("services/", login_required(services_overview), name="services"),
|
||||||
|
path("membership/", membership_overview, name="membership-overview"),
|
||||||
|
path("admin/members/", members_admin, name="admin-members"),
|
||||||
|
path(
|
||||||
|
"admin/members/<int:member_id>/",
|
||||||
|
members_admin_detail,
|
||||||
|
name="admin-members-detail",
|
||||||
|
),
|
||||||
path("accounts/", include("allauth.urls")),
|
path("accounts/", include("allauth.urls")),
|
||||||
path("_admin/", admin.site.urls),
|
path("_admin/", admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,21 +1,9 @@
|
||||||
from django_view_decorator import view
|
|
||||||
|
|
||||||
from utils.view_utils import render
|
from utils.view_utils import render
|
||||||
|
|
||||||
|
|
||||||
@view(
|
|
||||||
paths="",
|
|
||||||
name="index",
|
|
||||||
login_required=True,
|
|
||||||
)
|
|
||||||
def index(request):
|
def index(request):
|
||||||
return render(request, "index.html")
|
return render(request, "index.html")
|
||||||
|
|
||||||
|
|
||||||
@view(
|
|
||||||
paths="services/",
|
|
||||||
name="services",
|
|
||||||
login_required=True,
|
|
||||||
)
|
|
||||||
def services_overview(request):
|
def services_overview(request):
|
||||||
return render(request, "services_overview.html")
|
return render(request, "services_overview.html")
|
||||||
|
|
Loading…
Reference in a new issue