|
1
|
|
|
# Create your tests here. |
|
2
|
|
|
# Copyright 2013 Mathias WOLFF |
|
3
|
|
|
# This file is part of pyfreebilling. |
|
4
|
|
|
# |
|
5
|
|
|
# pyfreebilling is free software: you can redistribute it and/or modify |
|
6
|
|
|
# it under the terms of the GNU General Public License as published by |
|
7
|
|
|
# the Free Software Foundation, either version 3 of the License, or |
|
8
|
|
|
# (at your option) any later version. |
|
9
|
|
|
# |
|
10
|
|
|
# pyfreebilling is distributed in the hope that it will be useful, |
|
11
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13
|
|
|
# GNU General Public License for more details. |
|
14
|
|
|
# |
|
15
|
|
|
# You should have received a copy of the GNU General Public License |
|
16
|
|
|
# along with pyfreebilling. If not, see <http://www.gnu.org/licenses/> |
|
17
|
|
|
from django.db import models |
|
18
|
|
|
|
|
19
|
|
|
from django.utils.translation import ugettext_lazy as _ |
|
20
|
|
|
|
|
21
|
|
|
|
|
22
|
|
View Code Duplication |
class ProviderRatesDid(models.Model): |
|
|
|
|
|
|
23
|
|
|
""" Provider Rates Model for Did""" |
|
24
|
|
|
name = models.CharField(_(u'name'), max_length=128) |
|
25
|
|
|
rate = models.DecimalField(_(u'Rate'), |
|
26
|
|
|
max_digits=11, |
|
27
|
|
|
decimal_places=5) |
|
28
|
|
|
block_min_duration = models.IntegerField(_(u'block min duration'), |
|
29
|
|
|
default=1) |
|
30
|
|
|
interval_duration = models.IntegerField(_(u'Interval duration'), |
|
31
|
|
|
default=1) |
|
32
|
|
|
provider = models.ForeignKey( |
|
33
|
|
|
'pyfreebill.Company', |
|
34
|
|
|
on_delete=models.CASCADE, |
|
35
|
|
|
verbose_name=_(u"provider"), |
|
36
|
|
|
limit_choices_to={'supplier_enabled': True}) |
|
37
|
|
|
enabled = models.BooleanField(_(u"Enabled / Disabled"), |
|
38
|
|
|
default=True) |
|
39
|
|
|
date_added = models.DateTimeField(_(u'date added'), |
|
40
|
|
|
auto_now_add=True) |
|
41
|
|
|
date_modified = models.DateTimeField(_(u'date modified'), |
|
42
|
|
|
auto_now=True) |
|
43
|
|
|
|
|
44
|
|
|
class Meta: |
|
45
|
|
|
db_table = 'provider_rates_did' |
|
46
|
|
|
app_label = 'did' |
|
47
|
|
|
ordering = ('provider', 'name') |
|
48
|
|
|
unique_together = ("name", "provider") |
|
49
|
|
|
verbose_name = _(u'DID provider rate') |
|
50
|
|
|
verbose_name_plural = _(u'DID provider rates') |
|
51
|
|
|
|
|
52
|
|
|
def __unicode__(self): |
|
53
|
|
|
return u"n: %s -r: %s : %s/%s - " % (self.name, |
|
54
|
|
|
self.rate, |
|
55
|
|
|
self.block_min_duration, |
|
56
|
|
|
self.interval_duration) |
|
57
|
|
|
|
|
58
|
|
|
|
|
59
|
|
|
class CustomerRatesDid(models.Model): |
|
60
|
|
|
""" Customer Rates Model for Did""" |
|
61
|
|
|
name = models.CharField(_(u'name'), max_length=128) |
|
62
|
|
|
rate = models.DecimalField(_(u'Rate'), |
|
63
|
|
|
max_digits=11, |
|
64
|
|
|
decimal_places=5) |
|
65
|
|
|
block_min_duration = models.IntegerField(_(u'block min duration'), |
|
66
|
|
|
default=1) |
|
67
|
|
|
interval_duration = models.IntegerField(_(u'Interval duration'), |
|
68
|
|
|
default=1) |
|
69
|
|
|
enabled = models.BooleanField(_(u"Enabled / Disabled"), |
|
70
|
|
|
default=True) |
|
71
|
|
|
date_added = models.DateTimeField(_(u'date added'), |
|
72
|
|
|
auto_now_add=True) |
|
73
|
|
|
date_modified = models.DateTimeField(_(u'date modified'), |
|
74
|
|
|
auto_now=True) |
|
75
|
|
|
|
|
76
|
|
|
class Meta: |
|
77
|
|
|
db_table = 'customer_rates_did' |
|
78
|
|
|
app_label = 'did' |
|
79
|
|
|
ordering = ('name',) |
|
80
|
|
|
verbose_name = _(u'DID customer rate') |
|
81
|
|
|
verbose_name_plural = _(u'DID customer rates') |
|
82
|
|
|
|
|
83
|
|
|
def __unicode__(self): |
|
84
|
|
|
return u"%s -r: %s : %s/%s" % (self.name, |
|
85
|
|
|
self.rate, |
|
86
|
|
|
self.block_min_duration, |
|
87
|
|
|
self.interval_duration) |
|
88
|
|
|
|