Cookiecutter-django: Upgrading to Django 2.1

Created on 21 May 2018  路  4Comments  路  Source: pydanny/cookiecutter-django

Things to keep in mind:

Most helpful comment

@webyneter thank you so much this solution helped me a lot

All 4 comments

Is anyone running cookiecutter-django with Django 2.1? Is it safe to upgrade?

@jhancia I've been successfully using it on my production-grade projects. The only thing you'd need to change is the layout of UserAdmin, for instance, this is what mine looks like:

@admin.register(User)
class UserAdmin(auth_admin.UserAdmin):
    fieldsets = (
        (_("Personal info"), {"fields": ("email",)}),
        (
            _("Permissions"),
            {
                "fields": (
                    "is_active",
                    "is_staff",
                    "is_superuser",
                    "groups",
                    "user_permissions",
                )
            },
        ),
        (_("Important dates"), {"fields": ("last_login", "date_joined")}),
    )
    add_fieldsets = (
        (None, {"classes": ("wide",), "fields": ("email", "password1", "password2")}),
    )
    form = UserChangeForm
    add_form = UserCreationForm
    list_display = ["email", "is_active", "is_staff", "is_superuser", "date_joined"]
    list_filter = ["groups", "is_active", "is_staff", "is_superuser"]
    search_fields = ["email"]
    ordering = ["-date_joined"]

Also, you might wanna check out if UserChangeForm and UserCreationForm are still necessary (I can't find them being mentioned in the current dev docs for some reason...)

@webyneter thank you so much this solution helped me a lot

The change mentioned which simplified User forms has been reverted, that's why it's no longer in the release notes:

https://github.com/django/django/pull/10289

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vladimirmyshkovski picture vladimirmyshkovski  路  4Comments

jsmedmar picture jsmedmar  路  3Comments

pygabo picture pygabo  路  3Comments

saschalalala picture saschalalala  路  4Comments

sebastian-code picture sebastian-code  路  4Comments