from django import forms
from django.contrib import admin
from .models import Language
from country.models import Country

class LanguageAdminChangeForm(forms.ModelForm):

    model = Language
    name = forms.ChoiceField(choices=Country.get_list())
    status = forms.ChoiceField(choices=Language.LIST_STATUSES)
    main = forms.ChoiceField(choices=Language.LIST_STATUSES)

class LanguageAdminForm(forms.ModelForm):

    model = Language
    name = forms.ChoiceField(choices=Country.get_list())
    status = forms.ChoiceField(choices=Language.LIST_STATUSES)

@admin.register(Language)
class LanguageAdmin(admin.ModelAdmin):

    list_display = ('name', 'iso_code', 'status', 'main')
    form = LanguageAdminForm

    def get_form(self, request, obj=None, **kwargs):
        if obj:
             kwargs['form'] = LanguageAdminChangeForm
             kwargs['exclude'] = ('iso_code',)

        else:
             kwargs['form'] = LanguageAdminForm
             kwargs['exclude'] = ('iso_code', 'main',)
        return super(LanguageAdmin, self).get_form(request, obj=None, **kwargs)




90af9a55d5e7d578def059b7843c9ea71db7fea2
<mask token>


class LanguageAdminForm(forms.ModelForm):
    <mask token>
    <mask token>
    <mask token>


@admin.register(Language)
class LanguageAdmin(admin.ModelAdmin):
    list_display = 'name', 'iso_code', 'status', 'main'
    form = LanguageAdminForm

    def get_form(self, request, obj=None, **kwargs):
        if obj:
            kwargs['form'] = LanguageAdminChangeForm
            kwargs['exclude'] = 'iso_code',
        else:
            kwargs['form'] = LanguageAdminForm
            kwargs['exclude'] = 'iso_code', 'main'
        return super(LanguageAdmin, self).get_form(request, obj=None, **kwargs)

<mask token>


class LanguageAdminForm(forms.ModelForm):
    model = Language
    name = forms.ChoiceField(choices=Country.get_list())
    status = forms.ChoiceField(choices=Language.LIST_STATUSES)


@admin.register(Language)
class LanguageAdmin(admin.ModelAdmin):
    list_display = 'name', 'iso_code', 'status', 'main'
    form = LanguageAdminForm

    def get_form(self, request, obj=None, **kwargs):
        if obj:
            kwargs['form'] = LanguageAdminChangeForm
            kwargs['exclude'] = 'iso_code',
        else:
            kwargs['form'] = LanguageAdminForm
            kwargs['exclude'] = 'iso_code', 'main'
        return super(LanguageAdmin, self).get_form(request, obj=None, **kwargs)

<mask token>


class LanguageAdminChangeForm(forms.ModelForm):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


class LanguageAdminForm(forms.ModelForm):
    model = Language
    name = forms.ChoiceField(choices=Country.get_list())
    status = forms.ChoiceField(choices=Language.LIST_STATUSES)


@admin.register(Language)
class LanguageAdmin(admin.ModelAdmin):
    list_display = 'name', 'iso_code', 'status', 'main'
    form = LanguageAdminForm

    def get_form(self, request, obj=None, **kwargs):
        if obj:
            kwargs['form'] = LanguageAdminChangeForm
            kwargs['exclude'] = 'iso_code',
        else:
            kwargs['form'] = LanguageAdminForm
            kwargs['exclude'] = 'iso_code', 'main'
        return super(LanguageAdmin, self).get_form(request, obj=None, **kwargs)

from django import forms
from django.contrib import admin
from .models import Language
from country.models import Country


class LanguageAdminChangeForm(forms.ModelForm):
    model = Language
    name = forms.ChoiceField(choices=Country.get_list())
    status = forms.ChoiceField(choices=Language.LIST_STATUSES)
    main = forms.ChoiceField(choices=Language.LIST_STATUSES)


class LanguageAdminForm(forms.ModelForm):
    model = Language
    name = forms.ChoiceField(choices=Country.get_list())
    status = forms.ChoiceField(choices=Language.LIST_STATUSES)


@admin.register(Language)
class LanguageAdmin(admin.ModelAdmin):
    list_display = 'name', 'iso_code', 'status', 'main'
    form = LanguageAdminForm

    def get_form(self, request, obj=None, **kwargs):
        if obj:
            kwargs['form'] = LanguageAdminChangeForm
            kwargs['exclude'] = 'iso_code',
        else:
            kwargs['form'] = LanguageAdminForm
            kwargs['exclude'] = 'iso_code', 'main'
        return super(LanguageAdmin, self).get_form(request, obj=None, **kwargs)

from django import forms
from django.contrib import admin
from .models import Language
from country.models import Country

class LanguageAdminChangeForm(forms.ModelForm):

    model = Language
    name = forms.ChoiceField(choices=Country.get_list())
    status = forms.ChoiceField(choices=Language.LIST_STATUSES)
    main = forms.ChoiceField(choices=Language.LIST_STATUSES)

class LanguageAdminForm(forms.ModelForm):

    model = Language
    name = forms.ChoiceField(choices=Country.get_list())
    status = forms.ChoiceField(choices=Language.LIST_STATUSES)

@admin.register(Language)
class LanguageAdmin(admin.ModelAdmin):

    list_display = ('name', 'iso_code', 'status', 'main')
    form = LanguageAdminForm

    def get_form(self, request, obj=None, **kwargs):
        if obj:
             kwargs['form'] = LanguageAdminChangeForm
             kwargs['exclude'] = ('iso_code',)

        else:
             kwargs['form'] = LanguageAdminForm
             kwargs['exclude'] = ('iso_code', 'main',)
        return super(LanguageAdmin, self).get_form(request, obj=None, **kwargs)



