New WaitingListEntry #33

Merged
valberg merged 10 commits from benjaoming/membersystem:waiting-list into main 2024-07-31 22:49:48 +00:00
Showing only changes of commit f2fb72a2fe - Show all commits

View file

@ -2,24 +2,27 @@
from django.contrib import admin from django.contrib import admin
from . import models from .models import Membership
benjaoming marked this conversation as resolved Outdated

I'm against importing whole modules.

Explicit is better than implicit.

I'm against importing whole modules. > Explicit is better than implicit.

Don't we import whole modules everywhere all the time?

The idea is that the Django app is a domain-specific app so importing the models into the admin makes sense because almost all Models from that models module will have an admin. To me, this makes the code more readable than having lots of import statements.

Don't we import whole modules everywhere all the time? The idea is that the Django app is a domain-specific app so importing the models into the admin makes sense because almost all Models from that models module will have an admin. To me, this makes the code more readable than having lots of import statements.

Well, yes. I mostly use for instance from django.db import models in my own models modules, because it is a standard - but I actually would love to be more explicit everywhere.

When push comes to shove it is all about preference. My preference is to explicitly import what is being used, to have a clear "in this module we are using these external things".

Well, yes. I mostly use for instance `from django.db import models` in my own `models` modules, because it is a standard - but I actually would love to be more explicit everywhere. When push comes to shove it is all about preference. My preference is to explicitly import what is being used, to have a clear "in this module we are using these external things".

I also use from django.db import models in app.models but in app.* I use from app import models because it's so convenient and it targets the domain-specific ideal of the app. As in, if you are import some other models module, then something is wrong.

I also use `from django.db import models` in `app.models` but in `app.*` I use `from app import models` because it's so convenient and it targets the domain-specific ideal of the app. As in, if you are import some other `models` module, then something is wrong.

I think having explicit imports is more readable and gives me an overview of what the module is interfacing with.

I think we can debate this forever :P

I would say that we should go with "do not change it just for the sake of changing it" and keep it as it was (but that is also in favorable for me ATM)

I think having explicit imports is more readable and gives me an overview of what the module is interfacing with. I think we can debate this forever :P I would say that we should go with "do not change it just for the sake of changing it" and keep it as it was (but that is also in favorable for me ATM)

Alright you stubborn one ❤️

Alright you stubborn one ❤️
from .models import MembershipType
from .models import SubscriptionPeriod
from .models import WaitingListEntry
@admin.register(models.Membership) @admin.register(Membership)
class MembershipAdmin(admin.ModelAdmin): class MembershipAdmin(admin.ModelAdmin):
"""Admin for Membership model.""" """Admin for Membership model."""
@admin.register(models.MembershipType) @admin.register(MembershipType)
class MembershipTypeAdmin(admin.ModelAdmin): class MembershipTypeAdmin(admin.ModelAdmin):
"""Admin for MembershipType model.""" """Admin for MembershipType model."""
@admin.register(models.SubscriptionPeriod) @admin.register(SubscriptionPeriod)
class SubscriptionPeriodAdmin(admin.ModelAdmin): class SubscriptionPeriodAdmin(admin.ModelAdmin):
"""Admin for SubscriptionPeriod model.""" """Admin for SubscriptionPeriod model."""
@admin.register(models.WaitingListEntry) @admin.register(WaitingListEntry)
class WaitingListEntryAdmin(admin.ModelAdmin): class WaitingListEntryAdmin(admin.ModelAdmin):
"""Admin for WaitingList model.""" """Admin for WaitingList model."""