Commit 7e5cb8b6 authored by frekk's avatar frekk
Browse files

make old memberdb read-only

parent 38748d51
......@@ -22,13 +22,19 @@ def import_old_member(modeladmin, request, queryset):
nm.display_name = om.real_name
nm.is_guild = om.guild_member
nm.phone_number = om.phone_number
nm.id_number = om.student_no
nm.id_number = ""
nm.email_address = om.email_address
if (om.membership_type == 1 or om.membership_type == 2): # O'day special or student
if om.membership_type == 1: # O'day special
# O'day special or student
#membership_type = 'oday'
nm.is_student = True
else:
elif om.membership_type == 2: # student
#membership_type = 'student_and_guild' if nm.is_guild else 'student_only'
nm.is_student = True
else: # non-student
#membership_type = 'guild_only' if nm.is_guild else 'non_student'
nm.is_student = False
if (nm.username == '' or nm.username is None):
raise ValidationError("username cannot be blank")
nm.save()
......
from django.db.models import Q
from gms import admin
from memberdb.actions import download_as_csv
from memberdb.admin import ReadOnlyModelAdmin
from .models import OldMember
from .actions import import_old_member
......@@ -31,7 +32,7 @@ class UsernameNullListFilter(admin.SimpleListFilter):
return queryset.filter(~fresh)
class MemberAdmin(admin.ModelAdmin):
class MemberAdmin(ReadOnlyModelAdmin):
list_display = ('real_name', 'username', 'membership_type', 'guild_member')
list_filter = ['guild_member', UsernameNullListFilter, 'membership_type']
search_fields = ('real_name', 'username', )
......
......@@ -25,6 +25,6 @@ class MemberDbRouter:
"""
Make sure we don't do any migrations to the old database, it would only break things.
"""
if app_label == 'import_members':
if app_label == 'import_members' or db == 'memberdb_old':
return False
return None
\ No newline at end of file
return None
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment