# Path: findingaids/fa/models.py
# class Deleted(models.Model):
#     """
#     Information about a previously published finding aid that has been deleted.
#     """
#     eadid = models.CharField('EAD Identifier', max_length=50, unique=True)
#     title = models.CharField(max_length=200)
#     date = models.DateTimeField('Date removed', auto_now_add=True)
#     note = models.CharField(
#         max_length=400, blank=True,
#         help_text="Optional: Enter the reason this document is being deleted. " +
#                   "These comments will be displayed to anyone who had the finding " +
#                   "aid bookmarked and returns after it is gone.")
# 
#     class Meta:
#         verbose_name = 'Deleted Record'
# 
#     def __unicode__(self):
#         return self.eadid
# 
# class Archive(models.Model):
#     '''Model to define Archives associated with EAD documents, for use with
#     admin user permissions and to identify subversion repositories where
#     content will be published from.'''
#     label = models.CharField(max_length=10,
#         help_text='Short label to identify an archive')
#     name = models.CharField(max_length=255,
#         help_text='repository name (subarea) in EAD to identify finding aids associated with this archive')
#     svn = models.URLField('Subversion Repository',
#         help_text='URL to subversion repository containing EAD for this archive')
#     slug = models.SlugField(help_text='''shorthand id
#         (auto-generated from label; do not modify after initial archive definition)''')
#     contacts = models.ManyToManyField(settings.AUTH_USER_MODEL,
#         help_text='Contact person for display on the Request Materials page (email required)',
#         blank=True)
# 
# 
#     def __unicode__(self):
#         return self.label
# 
#     @property
#     def svn_local_path(self):
#         return os.path.join(settings.SVN_WORKING_DIR, self.slug)
# 
#     def contact_names(self):
#         '''List of contact names method for display in django admin list
#         display.  Shows email if user has no full name.'''
#         return ', '.join([contact.get_full_name() or contact.email
#                           for contact in self.contacts.all()])
#     contact_names.short_description = "Contacts"


from django.contrib import admin
from django import forms
from findingaids.fa.models import Deleted, Archive

class DeletedAdmin(admin.ModelAdmin):
    list_display = ('eadid', 'title', 'date', 'note')
    list_filter = ('date',)

    # don't allow creating deleted records via admin site
    def has_add_permission(self, request):
        return False

admin.site.register(Deleted, DeletedAdmin)


class ArchiveAdmin(admin.ModelAdmin):

# Path: findingaids/fa/models.py
# class Deleted(models.Model):
#     """
#     Information about a previously published finding aid that has been deleted.
#     """
#     eadid = models.CharField('EAD Identifier', max_length=50, unique=True)
#     title = models.CharField(max_length=200)
#     date = models.DateTimeField('Date removed', auto_now_add=True)
#     note = models.CharField(
#         max_length=400, blank=True,
#         help_text="Optional: Enter the reason this document is being deleted. " +
#                   "These comments will be displayed to anyone who had the finding " +
#                   "aid bookmarked and returns after it is gone.")
# 
#     class Meta:
#         verbose_name = 'Deleted Record'
# 
#     def __unicode__(self):
#         return self.eadid
# 
# class Archive(models.Model):
#     '''Model to define Archives associated with EAD documents, for use with
#     admin user permissions and to identify subversion repositories where
#     content will be published from.'''
#     label = models.CharField(max_length=10,
#         help_text='Short label to identify an archive')
#     name = models.CharField(max_length=255,
#         help_text='repository name (subarea) in EAD to identify finding aids associated with this archive')
#     svn = models.URLField('Subversion Repository',
#         help_text='URL to subversion repository containing EAD for this archive')
#     slug = models.SlugField(help_text='''shorthand id
#         (auto-generated from label; do not modify after initial archive definition)''')
#     contacts = models.ManyToManyField(settings.AUTH_USER_MODEL,
#         help_text='Contact person for display on the Request Materials page (email required)',
#         blank=True)
# 
# 
#     def __unicode__(self):
#         return self.label
# 
#     @property
#     def svn_local_path(self):
#         return os.path.join(settings.SVN_WORKING_DIR, self.slug)
# 
#     def contact_names(self):
#         '''List of contact names method for display in django admin list
#         display.  Shows email if user has no full name.'''
#         return ', '.join([contact.get_full_name() or contact.email
#                           for contact in self.contacts.all()])
#     contact_names.short_description = "Contacts"


# Path: findingaids/fa/admin.py
from django.contrib import admin
from django import forms
from findingaids.fa.models import Deleted, Archive


class DeletedAdmin(admin.ModelAdmin):
    list_display = ('eadid', 'title', 'date', 'note')
    list_filter = ('date',)

    # don't allow creating deleted records via admin site
    def has_add_permission(self, request):
        return False

admin.site.register(Deleted, DeletedAdmin)


class ArchiveAdmin(admin.ModelAdmin):

    list_display = ('label', 'name', 'svn', 'contact_names')