<commit_before># -*- coding: utf-8 -*-

from django.contrib import admin
from pysk.vps.models import *

## Utility classes

class ForeignKeyFilter(object):
    def formfield_for_dbfield(self, db_field, **kwargs):
        # Only show the foreign key objects from the rendered filter.
        filters = getattr(self, 'foreignkey_filters', None)
        if filters and db_field.name in filters:
            kwargs['queryset'] = filters[db_field.name](get_current_user())
        return admin.ModelAdmin.formfield_for_dbfield(self, db_field, **kwargs)

## Admin classes

class DomainAdmin(admin.ModelAdmin):
    def queryset(self, request):
        if request.user.is_superuser:
            return Domain.objects.all()
        return Domain.objects.filter(owner=request.user)

    list_display = ("owner", "name", "serial", "active")
    list_display_links = ("name",)
    fieldsets = (
        (None, {
            "fields": ("name", "owner", "active")
        }),
        ("Nameservers", {
            "fields": ("ns1", "ns2", "ns3", "ns4", "ns5", "ns6")
        }),
        ("Mail Exchange", {
            "fields": ("mx1", "mx2", "mx3")
        }),
        ("Special options", {
            "fields": ("is_gafyd", )
        })
    )
<commit_msg>add mx1 column to domain admin<commit_after># -*- coding: utf-8 -*-

from django.contrib import admin
from pysk.vps.models import *

## Utility classes

class ForeignKeyFilter(object):
    def formfield_for_dbfield(self, db_field, **kwargs):
        # Only show the foreign key objects from the rendered filter.
        filters = getattr(self, 'foreignkey_filters', None)
        if filters and db_field.name in filters:
            kwargs['queryset'] = filters[db_field.name](get_current_user())
        return admin.ModelAdmin.formfield_for_dbfield(self, db_field, **kwargs)

## Admin classes

class DomainAdmin(admin.ModelAdmin):
    def queryset(self, request):
        if request.user.is_superuser:
            return Domain.objects.all()
        return Domain.objects.filter(owner=request.user)

    list_display = ("owner", "name", "mx1", "serial", "active")
    list_display_links = ("name",)
    fieldsets = (
        (None, {
            "fields": ("name", "owner", "active")
        }),
        ("Nameservers", {
            "fields": ("ns1", "ns2", "ns3", "ns4", "ns5", "ns6")
        }),
        ("Mail Exchange", {
            "fields": ("mx1", "mx2", "mx3")
        }),
        ("Special options", {
            "fields": ("is_gafyd", )
        })
    )

{'fraction_non_alphanumeric': 0.15234685759745425, 'fraction_numerical': 0.008750994431185362, 'mean_word_length': 2.6083213773314204, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '462346', 'n_tokens_mistral': 777, 'n_tokens_neox': 767, 'n_words': 182}