<commit_before># -*- coding: utf-8 -*-
#
# inventory/projects/admin.py
#

from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from inventory.common.admin_mixins import UserAdminMixin

from .models import Project, Membership
from .forms import ProjectForm


#
# Membership
#
class MembershipInline(admin.TabularInline):
    fields = ('user', 'role',)
    extra = 0
    can_delete = False
    model = Membership


#
# Project
#
@admin.register(Project)
class ProjectAdmin(UserAdminMixin, admin.ModelAdmin):
    fieldsets = (
        (None, {'fields': ('name', 'public',)}),
        (_('Status'), {'classes': ('collapse',),
                       'fields': ('active', 'creator', 'created', 'updater',
                                  'updated',)}),
        )
    readonly_fields = ('creator', 'created', 'updater', 'updated',)
    list_display = ('name', 'public', 'active', 'updater', 'updated',)
    search_fields = ('name',)
    list_filter = ('public', 'active', 'memberships__role',)
    inlines = (MembershipInline,)
    form = ProjectForm<commit_msg>Updated the admin for projects.<commit_after># -*- coding: utf-8 -*-
#
# inventory/projects/admin.py
#

from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from inventory.common.admin_mixins import UserAdminMixin

from .models import Project, Membership
from .forms import ProjectForm


#
# Membership
#
class MembershipInline(admin.TabularInline):
    fields = ('user', 'role',)
    extra = 0
    can_delete = False
    model = Membership


#
# Project
#
@admin.register(Project)
class ProjectAdmin(UserAdminMixin, admin.ModelAdmin):
    fieldsets = (
        (None, {'fields': ('name', 'public',)}),
        (_('Status'), {'classes': ('collapse',),
                       'fields': ('active', 'creator', 'created', 'updater',
                                  'updated',)}),
        )
    readonly_fields = ('creator', 'created', 'updater', 'updated',)
    list_display = ('name', 'public', 'active', 'updater', 'updated',)
    list_editable = ('active',)
    search_fields = ('name', 'memberships__user__username',)
    list_filter = ('public', 'active', 'memberships__role',)
    inlines = (MembershipInline,)
    form = ProjectForm
{'fraction_non_alphanumeric': 0.1561535068372298, 'fraction_numerical': 0.00176444640494045, 'mean_word_length': 3.3783783783783785, 'pattern_counts': {'":': 0, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '895527', 'n_tokens_mistral': 681, 'n_tokens_neox': 677, 'n_words': 162}