unfoldadmin / django-unfold

Modern Django admin theme for seamless interface development
https://unfoldadmin.com
MIT License
1.76k stars 177 forks source link

Form Styling Issue: Misaligned and Unstyled Input Fields #739

Closed 4mritGiri closed 1 month ago

4mritGiri commented 1 month ago

What version of Unfold are you using?

version==0.38.0

What version of Django are you using?

django==5.1.1

What browser are you using?

Google Chrome 128.0.6613.137 Brave Browser 128.1.69.168

Did you checked changelog/commit history, if the bug is not already fixed?

Yes

Did you searched other issues, if the bug is not already fixed?

Yes

Issue

There seems to be a style issue with the form where some input fields, checkboxes, and file upload elements are not properly aligned or styled. Specifically:

Steps to Reproduce:

  1. Navigate to the page containing the form.

  2. Observe the misalignment of input fields and checkboxes.

  3. Compare the form styling to the rest of the page/theme.

  4. Expected Behavior: The form elements should be properly aligned with consistent styling. There should be adequate spacing between form inputs and buttons, and file input fields should have appropriate styling.

Screenshot: Screenshot from 2024-09-14 17-22-37

And also multiple deletion action button hidden image

4mritGiri commented 1 month ago

Issue Closed

This issue has been resolved by following the necessary steps. Specifically, I forgot to unregister the User and Group models before re-registering them with custom UserAdmin and GroupAdmin configurations.

The fix involved adding the following code in admin.py:

# admin.py

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.admin import GroupAdmin as BaseGroupAdmin
from django.contrib.auth.models import User, Group

from unfold.admin import ModelAdmin

admin.site.unregister(User)
admin.site.unregister(Group)

@admin.register(User)
class UserAdmin(BaseUserAdmin, ModelAdmin):
    pass

@admin.register(Group)
class GroupAdmin(BaseGroupAdmin, ModelAdmin):
    pass
Thank you for your support.