Exemplo n.º 1
0
from sitename.admin import admin as sitename_admin
from solo.admin import SingletonModelAdmin

from .models import Xero, Gmail

sitename_admin.register(Xero, SingletonModelAdmin)
sitename_admin.register(Gmail, SingletonModelAdmin)
Exemplo n.º 2
0
    def name(self, obj):
        return obj.name

    def contact_id(self, obj):
        return obj.contact.id

    def second_contact_id(self, obj):
        return obj.second_contact.id

    def organisation_id(self, obj):
        return obj.organisation.id


class OrganisationAdmin(admin.ModelAdmin):
    readonly_fields = ('id', )
    fieldsets = ((None, {
        'fields': ('id', 'name', 'main_line', 'website', 'industry',
                   'location', 'postal_location', 'group_status',
                   'group_parent', 'business_search_words')
    }), )
    autocomplete_fields = ('location', 'postal_location')


sitename_admin.register(User, UserAdmin)
sitename_admin.register(Organisation, OrganisationAdmin)
sitename_admin.register(Contact, ContactAdmin)
sitename_admin.register(Client, ClientAdmin)
sitename_admin.register(Location, LocationAdmin)
sitename_admin.register(Group, GroupAdmin)
Exemplo n.º 3
0
        return 'None'


class NoteAdmin(admin.ModelAdmin):
    fieldsets = ((None, {
        'fields': ('matter', 'client_name', 'text', 'user', 'date_time')
    }), )
    readonly_fields = ('client_name', )
    list_display = ('client_name', 'matter', 'date_time', 'note_text')
    list_filter = (('date_time', DateRangeFilter), )
    list_display_links = ('note_text', 'client_name')
    search_fields = ('text', 'matter__name')

    def client_name(self, obj):
        if obj.matter:
            return obj.matter.client.name
        return 'None'

    def note_text(self, obj):
        if len(obj.text) < 50:
            return obj.text
        return obj.text[:50] + '...'


sitename_admin.register(Matter, MatterAdmin)
sitename_admin.register(TimeEntry, TimeEntryAdmin)
sitename_admin.register(StandartDisbursement)
sitename_admin.register(Note, NoteAdmin)
sitename_admin.register(EntryType)
Exemplo n.º 4
0
    fieldsets = (
        (None,
            {'fields': (
                'invoice_id', 'matter_id', 'matter', 'created_date',
                'payment_terms', 'status', 'billing_method')},
         ),
    )

    def number(self, obj):
        return obj.number

    def client_name(self, obj):
        try:
            return obj.matter.client.name
        except AttributeError:
            return None

    def matter_name(self, obj):
        return obj.matter.name

    def matter_id(self, obj):
        return obj.matter.id

    def invoice_id(self, obj):
        return obj.id


sitename_admin.register(Invoice, InvoiceAdmin)
sitename_admin.register(Payment)
sitename_admin.register(PaymentTerms)
Exemplo n.º 5
0
from django.contrib import admin

from sitename.admin import admin as sitename_admin
from simple_history.admin import SimpleHistoryAdmin
from solo.admin import SingletonModelAdmin

from .forms import PdfForm
from .models import (PDF, Document, DocumentType, EmailMessage, General,
                     Industry, InvoiceStatus, Logo, MatterSubType, MatterType,
                     Office, Section, Occupation, MatterStatus, LeadStatus,
                     TimeEntryType, AccountNumber)


sitename_admin.register(Section)
sitename_admin.register(DocumentType)
sitename_admin.register(MatterType)
sitename_admin.register(MatterStatus)
sitename_admin.register(MatterSubType)
sitename_admin.register(Occupation)
sitename_admin.register(InvoiceStatus)
sitename_admin.register(LeadStatus)
sitename_admin.register(TimeEntryType)
sitename_admin.register(AccountNumber)


class DocumentAdmin(admin.ModelAdmin):
    list_display = ('id', 'contact', 'organisation')
    list_display_links = ('id', 'contact', 'organisation')
    list_filter = ('status', 'document_type')