from django.contrib import admin
from django import forms
from .models import Sorter


class SorterAdminForm(forms.ModelForm):

    class Meta:
        model = Sorter
        exclude = ('email',)


class SorterAdmin(admin.ModelAdmin):
    class Meta:
        model = Sorter
    form = SorterAdminForm

    list_display = ('id', 'center', 'sorter_id', 'vendor',
                    'show_dashboard_link')

    list_filter = ('vendor',)
    search_fields = ('center__name', 'vendor', 'sorter_id')
    date_hierarchy = 'installation_date'
    raw_id_fields = ("center",)

    def show_dashboard_link(self, obj):
        return '<a href="{}" target="_blank">{}</a>'.format(
            obj.dashboard_link, obj.dashboard_link)
    show_dashboard_link.allow_tags = True

    def save_model(self, request, obj, form, change):
        obj.changed_by = request.user
        obj.save()

admin.site.register(Sorter, SorterAdmin)

1eff41178e812870f45b0f11dadfe1ccc84ca26a
<mask token>


class SorterAdmin(admin.ModelAdmin):


    class Meta:
        model = Sorter
    form = SorterAdminForm
    list_display = 'id', 'center', 'sorter_id', 'vendor', 'show_dashboard_link'
    list_filter = 'vendor',
    search_fields = 'center__name', 'vendor', 'sorter_id'
    date_hierarchy = 'installation_date'
    raw_id_fields = 'center',

    def show_dashboard_link(self, obj):
        return '<a href="{}" target="_blank">{}</a>'.format(obj.
            dashboard_link, obj.dashboard_link)
    show_dashboard_link.allow_tags = True

    def save_model(self, request, obj, form, change):
        obj.changed_by = request.user
        obj.save()


<mask token>

<mask token>


class SorterAdminForm(forms.ModelForm):


    class Meta:
        model = Sorter
        exclude = 'email',


class SorterAdmin(admin.ModelAdmin):


    class Meta:
        model = Sorter
    form = SorterAdminForm
    list_display = 'id', 'center', 'sorter_id', 'vendor', 'show_dashboard_link'
    list_filter = 'vendor',
    search_fields = 'center__name', 'vendor', 'sorter_id'
    date_hierarchy = 'installation_date'
    raw_id_fields = 'center',

    def show_dashboard_link(self, obj):
        return '<a href="{}" target="_blank">{}</a>'.format(obj.
            dashboard_link, obj.dashboard_link)
    show_dashboard_link.allow_tags = True

    def save_model(self, request, obj, form, change):
        obj.changed_by = request.user
        obj.save()


<mask token>

<mask token>


class SorterAdminForm(forms.ModelForm):


    class Meta:
        model = Sorter
        exclude = 'email',


class SorterAdmin(admin.ModelAdmin):


    class Meta:
        model = Sorter
    form = SorterAdminForm
    list_display = 'id', 'center', 'sorter_id', 'vendor', 'show_dashboard_link'
    list_filter = 'vendor',
    search_fields = 'center__name', 'vendor', 'sorter_id'
    date_hierarchy = 'installation_date'
    raw_id_fields = 'center',

    def show_dashboard_link(self, obj):
        return '<a href="{}" target="_blank">{}</a>'.format(obj.
            dashboard_link, obj.dashboard_link)
    show_dashboard_link.allow_tags = True

    def save_model(self, request, obj, form, change):
        obj.changed_by = request.user
        obj.save()


admin.site.register(Sorter, SorterAdmin)

from django.contrib import admin
from django import forms
from .models import Sorter


class SorterAdminForm(forms.ModelForm):


    class Meta:
        model = Sorter
        exclude = 'email',


class SorterAdmin(admin.ModelAdmin):


    class Meta:
        model = Sorter
    form = SorterAdminForm
    list_display = 'id', 'center', 'sorter_id', 'vendor', 'show_dashboard_link'
    list_filter = 'vendor',
    search_fields = 'center__name', 'vendor', 'sorter_id'
    date_hierarchy = 'installation_date'
    raw_id_fields = 'center',

    def show_dashboard_link(self, obj):
        return '<a href="{}" target="_blank">{}</a>'.format(obj.
            dashboard_link, obj.dashboard_link)
    show_dashboard_link.allow_tags = True

    def save_model(self, request, obj, form, change):
        obj.changed_by = request.user
        obj.save()


admin.site.register(Sorter, SorterAdmin)

from django.contrib import admin
from django import forms
from .models import Sorter


class SorterAdminForm(forms.ModelForm):

    class Meta:
        model = Sorter
        exclude = ('email',)


class SorterAdmin(admin.ModelAdmin):
    class Meta:
        model = Sorter
    form = SorterAdminForm

    list_display = ('id', 'center', 'sorter_id', 'vendor',
                    'show_dashboard_link')

    list_filter = ('vendor',)
    search_fields = ('center__name', 'vendor', 'sorter_id')
    date_hierarchy = 'installation_date'
    raw_id_fields = ("center",)

    def show_dashboard_link(self, obj):
        return '<a href="{}" target="_blank">{}</a>'.format(
            obj.dashboard_link, obj.dashboard_link)
    show_dashboard_link.allow_tags = True

    def save_model(self, request, obj, form, change):
        obj.changed_by = request.user
        obj.save()

admin.site.register(Sorter, SorterAdmin)
