# Path: zipfelchappe/paypal/models.py
# class Preapproval(CreateUpdateModel):
# 
#     pledge = models.OneToOneField('zipfelchappe.Pledge',
#         related_name='paypal_preapproval')
# 
#     key = models.CharField(_('key'), unique=True, db_index=True, max_length=20)
# 
#     amount = CurrencyField(_('amount'), max_digits=10, decimal_places=2)
# 
#     status = models.CharField(_('status'), max_length=20, blank=True, null=True)
# 
#     approved = models.BooleanField(_('approved'), default=False)
# 
#     sender = models.EmailField(_('sender'), blank=True, null=True)
# 
#     data = models.TextField(_('data'), blank=True)
# 
#     class Meta:
#         verbose_name = _('preapproval')
#         verbose_name_plural = _('preapprovals')
# 
#     def __unicode__(self):
#         return self.key
# 
# class Payment(CreateUpdateModel):
# 
#     # These are some know statuses for payments
#     CREATED = 'CREATED'
#     COMPLETED = 'COMPLETED'
#     INCOMPLETE = 'INCOMPLETE'
#     ERROR = 'ERROR'
#     REVERSALERROR = 'REVERSALERROR'
#     PROCESSING = 'PROCESSING'
#     PENDING = 'PENDING'
# 
#     key = models.CharField(_('key'), max_length=20, blank=True)
# 
#     preapproval = models.ForeignKey('Preapproval', related_name='payments')
# 
#     status = models.CharField(_('status'), max_length=20, blank=True, null=True)
# 
#     data = models.TextField(_('data'), blank=True)
# 
#     class Meta:
#         verbose_name = _('payment')
#         verbose_name_plural = _('payments')
# 
#     def __unicode__(self):
#         return self.key


from django.contrib import admin
from .models import Preapproval, Payment
from __future__ import unicode_literals, absolute_import



class PreapprovalAdmin(admin.ModelAdmin):
    list_display = ('pledge', 'key', 'amount', 'status', 'approved', 'sender')
    list_filter = ('pledge__project', 'approved')
    readonly_fields = ('created', 'modified')
    search_fields = ('key', 'sender')

    def has_add_permission(self, request):
        return False


class PaymentAdmin(admin.ModelAdmin):
    list_display = ('key', 'status')

# Path: zipfelchappe/paypal/models.py
# class Preapproval(CreateUpdateModel):
# 
#     pledge = models.OneToOneField('zipfelchappe.Pledge',
#         related_name='paypal_preapproval')
# 
#     key = models.CharField(_('key'), unique=True, db_index=True, max_length=20)
# 
#     amount = CurrencyField(_('amount'), max_digits=10, decimal_places=2)
# 
#     status = models.CharField(_('status'), max_length=20, blank=True, null=True)
# 
#     approved = models.BooleanField(_('approved'), default=False)
# 
#     sender = models.EmailField(_('sender'), blank=True, null=True)
# 
#     data = models.TextField(_('data'), blank=True)
# 
#     class Meta:
#         verbose_name = _('preapproval')
#         verbose_name_plural = _('preapprovals')
# 
#     def __unicode__(self):
#         return self.key
# 
# class Payment(CreateUpdateModel):
# 
#     # These are some know statuses for payments
#     CREATED = 'CREATED'
#     COMPLETED = 'COMPLETED'
#     INCOMPLETE = 'INCOMPLETE'
#     ERROR = 'ERROR'
#     REVERSALERROR = 'REVERSALERROR'
#     PROCESSING = 'PROCESSING'
#     PENDING = 'PENDING'
# 
#     key = models.CharField(_('key'), max_length=20, blank=True)
# 
#     preapproval = models.ForeignKey('Preapproval', related_name='payments')
# 
#     status = models.CharField(_('status'), max_length=20, blank=True, null=True)
# 
#     data = models.TextField(_('data'), blank=True)
# 
#     class Meta:
#         verbose_name = _('payment')
#         verbose_name_plural = _('payments')
# 
#     def __unicode__(self):
#         return self.key


# Path: zipfelchappe/paypal/admin.py
from django.contrib import admin
from .models import Preapproval, Payment

from __future__ import unicode_literals, absolute_import



class PreapprovalAdmin(admin.ModelAdmin):
    list_display = ('pledge', 'key', 'amount', 'status', 'approved', 'sender')
    list_filter = ('pledge__project', 'approved')
    readonly_fields = ('created', 'modified')
    search_fields = ('key', 'sender')

    def has_add_permission(self, request):
        return False


class PaymentAdmin(admin.ModelAdmin):
    list_display = ('key', 'status')

    list_filter = ('preapproval__pledge__project', 'status')