Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pingiun committed Nov 24, 2024
1 parent 4978e29 commit c62be5c
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 61 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies = [
"mollie-api-python ~= 3.6",
"pillow ~= 10.0",
"psycopg[c] ~= 3.2.1",
"django-tenants ~= 3.7.0"
]
requires-python = ">= 3.12"

Expand All @@ -39,7 +40,7 @@ include-package-data = true

[tool.setuptools.packages.find]
namespaces = true
where = ["src"]
include = ["symfexit"]

[build-system]
requires = ["setuptools>=61.0"]
Expand Down
33 changes: 13 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --allow-unsafe --build-deps-for=sdist --generate-hashes --strip-extras
#
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml --universal --generate-hashes --strip-extras -o requirements.txt
asgiref==3.8.1 \
--hash=sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47 \
--hash=sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590
Expand Down Expand Up @@ -112,23 +108,22 @@ django==5.1.1 \
--hash=sha256:021ffb7fdab3d2d388bc8c7c2434eb9c1f6f4d09e6119010bbb1694dda286bc2 \
--hash=sha256:71603f27dac22a6533fb38d83072eea9ddb4017fead6f67f2562a40402d61c3f
# via
# symfexit (pyproject.toml)
# dj-database-url
# django-picklefield
# django-tailwind
# django-tenants
# django-tinymce
# symfexit (pyproject.toml)
django-constance==4.1.3 \
--hash=sha256:e5e05acbf329c3addec141f3911989d58c423ebc3bc92e1359f9c1dd77e08e95 \
--hash=sha256:e8b619ebeab75665d279299cce4bbebbcb0a73caf3539edcd788f2d2275c21a1
# via symfexit (pyproject.toml)
django-picklefield==3.2 \
--hash=sha256:aa463f5d79d497dbe789f14b45180f00a51d0d670067d0729f352a3941cdfa4d \
--hash=sha256:e9a73539d110f69825d9320db18bcb82e5189ff48dbed41821c026a20497764c
# via django-constance
django-tailwind==3.8.0 \
--hash=sha256:31c2f4a7879d685c2de0feaf0b63f246200b37337bea4d7dbafb59bc3f10c008 \
--hash=sha256:fa969c5b95d314b173fe2b2ed2cb2c03f2e2c94fdc2c01ff73a993fa159085da
# via symfexit (pyproject.toml)
django-tenants==3.7.0 \
--hash=sha256:3836a2bae2c88504889a3226525930dfac8d3621f577cefdfde03db8115e88ac
# via symfexit (pyproject.toml)
django-tinymce==4.1.0 \
--hash=sha256:02e3b70e940fd299f0fbef4315aee5c185664e1eb8cd396b176963954e4357c9 \
--hash=sha256:9804836e6d2b08de3b03a27c100f8c2e9633549913eff8b323678a10cd48b94e
Expand Down Expand Up @@ -238,7 +233,7 @@ psycopg==3.2.3 \
--hash=sha256:644d3973fe26908c73d4be746074f6e5224b03c1101d302d9a53bf565ad64907 \
--hash=sha256:a5764f67c27bec8bfac85764d23c534af2c27b893550377e37ce59c12aac47a2
# via symfexit (pyproject.toml)
psycopg-c==3.2.3 \
psycopg-c==3.2.3 ; implementation_name != 'pypy' \
--hash=sha256:06ae7db8eaec1a3845960fa7f997f4ccdb1a7a7ab8dc593a680bcc74e1359671
# via psycopg
requests==2.32.3 \
Expand All @@ -258,18 +253,16 @@ sqlparse==0.5.1 \
typing-extensions==4.12.2 \
--hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \
--hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8
# via dj-database-url
tzdata==2024.2 ; sys_platform == 'win32' \
--hash=sha256:7d85cc416e9382e69095b7bdf4afd9e3880418a2413feec7069d533d6b4e31cc \
--hash=sha256:a48093786cdcde33cad18c2555e8532f34422074448fbc874186f0abd79565cd
# via
# dj-database-url
# django
# psycopg
urllib3==2.2.3 \
--hash=sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac \
--hash=sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9
# via
# mollie-api-python
# requests

# The following packages are considered to be unsafe in a requirements file:
setuptools==75.1.0 \
--hash=sha256:35ab7fd3bcd95e6b7fd704e4a1539513edad446c097797f2985e0e4b960772f2 \
--hash=sha256:d59a21b17a275fb872a9c3dae73963160ae079f1049ed956880cd7c09b120538
# via symfexit (pyproject.toml::build-system.requires)
2 changes: 1 addition & 1 deletion symfexit/members/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ def __str__(self):
return self.name

contact_people = models.ManyToManyField(
User, related_name="contact_person_for_groups", verbose_name=_("contact people")
User, related_name="contact_person_for_groups", verbose_name=_("contact people"), blank=True
)
8 changes: 4 additions & 4 deletions symfexit/members/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ class MemberData(LoginRequiredMixin, TemplateView):
def get(self, request, *args, **kwargs):
user_form = UserForm(instance=request.user, prefix="user_form")
password_form = PasswordChangeForm(user=request.user, prefix="password_form")
memberships = Membership.objects.filter(user=request.user)
current_membership = Membership.current_for_user(request.user)
# memberships = Membership.objects.filter(user=request.user)
# current_membership = Membership.current_for_user(request.user)
return render(
request,
self.template_name,
{
"user_form": user_form,
"password_form": password_form,
"memberships": memberships,
"current_membership": current_membership,
"memberships": None,
"current_membership": None,
},
)

Expand Down
42 changes: 11 additions & 31 deletions symfexit/signup/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ class Status(models.TextChoices):
created_at = models.DateTimeField(_("created at"), auto_now_add=True)
updated_at = models.DateTimeField(_("updated at"), auto_now=True)

class Meta:
verbose_name = _("membership application")
verbose_name_plural = _("membership applications")

def __str__(self):
return f"{self.first_name} {self.last_name}"

def get_absolute_url(self):
return reverse("signup:payment", kwargs={"application_id": self.eid})

@property
def eid(self):
return hashids.encode(self.id)
Expand All @@ -69,29 +79,6 @@ def get_or_404(cls, eid):
id = hashids.decode(eid)[0]
return get_object_or_404(MembershipApplication, id=id)

def get_absolute_url(self):
return reverse("signup:payment", kwargs={"application_id": self.eid})

def get_or_create_subscription(self):
address = BillingAddress.objects.create(
user=self.user,
name=f"{self.first_name} {self.last_name}",
address=self.address,
city=self.city,
postal_code=self.postal_code,
)
subscription = Membership.objects.create(
user=self.user,
active_from_to=DateTimeTZRange(lower=timezone.now()),
period_quantity=3, # TODO: make configurable
period_unit=Membership.PeriodUnit.MONTH,
price_per_period=self.payment_amount,
address=address,
)
self._subscription = subscription
self.save()
return subscription

def create_user(self):
try:
user = User.objects.create_user(
Expand All @@ -105,7 +92,7 @@ def create_user(self):
)
except IntegrityError as e:
if "members_user_unique_email_key" in e.args[0]:
raise DuplicateEmailError
raise DuplicateEmailError from e
else:
raise e
self.user = user
Expand All @@ -115,10 +102,3 @@ def create_user(self):
self._subscription.save()
self.save()
return user

def __str__(self):
return f"{self.first_name} {self.last_name}"

class Meta:
verbose_name = _("membership application")
verbose_name_plural = _("membership applications")
2 changes: 1 addition & 1 deletion symfexit/signup/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
return_view,
)

app_name = "symfexit.signup"
app_name = "signup"

urlpatterns = [
path("aanmelden/", MemberSignup.as_view(), name="signup"),
Expand Down
3 changes: 0 additions & 3 deletions symfexit/theme/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@ def get_app_admin_urls(self, admin_site):

from symfexit.theme.admin import RebuildTheme

if not settings.THEMING_ENABLED:
return []

rebuild_theme = RebuildTheme.as_view(admin_site=admin_site)
return [path("rebuild/", admin_site.admin_view(rebuild_theme), name="rebuild_theme")]

0 comments on commit c62be5c

Please sign in to comment.