from django import forms

from main.models import Profile, LanProfile, GRADES


class AdminLanProfileForm(forms.ModelForm):
    class Meta:
        model = LanProfile
        fields = '__all__'


class AdminProfileForm(forms.ModelForm):
    class Meta:
        model = Profile
        fields = '__all__'

    grade = forms.ChoiceField(GRADES, required=True, label='Klasse')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        instance = kwargs.get('instance', None)
        if instance:
            self.fields['grade'].choices += ((instance.grade, instance.grade), ('none', 'Ukendt'))

from django import forms

from main.models import Profile, LanProfile


class AdminLanProfileForm(forms.ModelForm):
    class Meta:
        model = LanProfile
        fields = '__all__'


class AdminProfileForm(forms.ModelForm):
    class Meta:
        model = Profile
        fields = '__all__'

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        instance = kwargs.get('instance', None)
        if instance:
            self.fields['grade'].choices += ((instance.grade, instance.grade), ('none', 'Ukendt'))

--- 
+++ 
@@ -1,6 +1,6 @@
 from django import forms
 
-from main.models import Profile, LanProfile
+from main.models import Profile, LanProfile, GRADES
 
 
 class AdminLanProfileForm(forms.ModelForm):
@@ -14,6 +14,8 @@
         model = Profile
         fields = '__all__'
 
+    grade = forms.ChoiceField(GRADES, required=True, label='Klasse')
+
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 
Make that work with admin too
