Skip to content

Commit

Permalink
Merge pull request #1123 from kartoza/feature/1102-Fix-Recorded-Count…
Browse files Browse the repository at this point in the history
…ries

Add action to correct location
  • Loading branch information
tinashechiraya authored Oct 16, 2024
2 parents e4416b6 + 64870a9 commit 261e302
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions django_project/minisass_authentication/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,22 @@ class UserProfileInline(admin.StackedInline):
verbose_name_plural = 'UserProfile'


def correct_country(modeladmin, request, queryset):
for user in queryset:
if user.userprofile:
if user.userprofile.country in ['ZA', 'SA', 'South Africa', '9']:
user.userprofile.country = 'ZA'
user.userprofile.save()
correct_country.short_description = "Correct Country"


class UserAdmin(BaseUserAdmin):
inlines = (UserProfileInline, )
list_filter = (
'userprofile__expert_approval_status', 'userprofile__is_expert',
'is_staff', 'is_superuser', 'is_active'
)
actions = [correct_country]


class PasswordHistoryAdmin(admin.ModelAdmin):
Expand Down
2 changes: 1 addition & 1 deletion django_project/monitor/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib import admin
import csv
from django.contrib import admin
from django.utils.encoding import smart_str
from django.http import HttpResponse
from minisass_authentication.models import UserProfile
Expand Down

0 comments on commit 261e302

Please sign in to comment.