add simple model for regies

This commit is contained in:
Frédéric Péters 2015-02-08 15:01:34 +01:00
parent a836037752
commit 86e3a5607c
4 changed files with 71 additions and 3 deletions

View File

@ -1,3 +1,25 @@
# lingo - basket and payment system
# Copyright (C) 2015 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.contrib import admin
# Register your models here.
from .models import Regie
class RegieAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('label',)}
admin.site.register(Regie, RegieAdmin)

View File

@ -1,3 +1,47 @@
from django.db import models
# lingo - basket and payment system
# Copyright (C) 2015 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Create your models here.
import eopayment
from jsonfield import JSONField
from django.db import models
from django.utils.translation import ugettext_lazy as _
SERVICES = [
(eopayment.DUMMY, _('Dummy (for tests)')),
(eopayment.SYSTEMPAY, 'systempay (Banque Populaire)'),
(eopayment.SIPS, 'SIPS'),
(eopayment.SPPLUS, _('SP+ (Caisse d\'epargne)')),
]
class Regie(models.Model):
label = models.CharField(verbose_name=_('Label'), max_length=64)
slug = models.SlugField(unique=True)
description = models.TextField(verbose_name=_('Description'))
service = models.CharField(verbose_name=_('Payment Service'),
max_length=64, choices=SERVICES)
service_options = JSONField(blank=True,
verbose_name=_('Payment Service Options'))
class Meta:
verbose_name = _('Regie')
def natural_key(self):
return (self.slug,)
def __unicode__(self):
return self.label

View File

@ -1 +1,2 @@
django >= 1.7
jsonfield

View File

@ -57,6 +57,7 @@ setup(
'Programming Language :: Python :: 2',
],
install_requires=['django == 1.7',
'jsonfield',
],
zip_safe=False,
entry_points={