Skip to content

Commit

Permalink
fix: import eox_support hack
Browse files Browse the repository at this point in the history
  • Loading branch information
johanseto committed Oct 31, 2024
1 parent 4f0071d commit 2d14a9e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions eox_nelp/admin/user.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
"""
This module defines the Django admin configuration for handling user model.
Classes:
NelpUserAdmin: Custom admin class for User model to include extra info fields like national_id.
"""
from django.contrib.auth import get_user_model
from eox_support.admin.user import SupportUserAdmin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin

try:
from eox_support.admin.user import SupportUserAdmin
except ImportError:
SupportUserAdmin = BaseUserAdmin

from eox_nelp.admin.register_admin_model import register_admin_model as register

Expand All @@ -8,13 +19,13 @@

class NelpUserAdmin(SupportUserAdmin):
"""EoxNelp User admin class."""

list_display = ('user_national_id',) + SupportUserAdmin.list_display
search_fields = SupportUserAdmin.search_fields + ('extrainfo__national_id',)
fieldsets = SupportUserAdmin.fieldsets + (
('Extra info Fields', {'fields': ('user_national_id',)}),
)
readonly_fields = SupportUserAdmin.readonly_fields + ('user_national_id',)

def user_national_id(self, instance):
"""Return national_id associated with the user extra_info instance."""
if getattr(instance, "extrainfo", None):
Expand Down

0 comments on commit 2d14a9e

Please sign in to comment.