|
1
|
|
|
# Copyright 2013 Mathias WOLFF |
|
2
|
|
|
# This file is part of pyfreebilling. |
|
3
|
|
|
# |
|
4
|
|
|
# pyfreebilling is free software: you can redistribute it and/or modify |
|
5
|
|
|
# it under the terms of the GNU General Public License as published by |
|
6
|
|
|
# the Free Software Foundation, either version 3 of the License, or |
|
7
|
|
|
# (at your option) any later version. |
|
8
|
|
|
# |
|
9
|
|
|
# pyfreebilling is distributed in the hope that it will be useful, |
|
10
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12
|
|
|
# GNU General Public License for more details. |
|
13
|
|
|
# |
|
14
|
|
|
# You should have received a copy of the GNU General Public License |
|
15
|
|
|
# along with pyfreebilling. If not, see <http://www.gnu.org/licenses/> |
|
16
|
|
|
|
|
17
|
|
|
from import_export import resources, fields |
|
18
|
|
|
from import_export.widgets import ForeignKeyWidget |
|
19
|
|
|
|
|
20
|
|
|
from pyfreebilling.did.models import Did, RoutesDid |
|
21
|
|
|
|
|
22
|
|
|
class DidResource(resources.ModelResource): |
|
23
|
|
|
|
|
24
|
|
|
class Meta: |
|
25
|
|
|
model = Did |
|
26
|
|
|
exclude = ('date_added', 'date_modified') |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
class RoutesDidResource(resources.ModelResource): |
|
30
|
|
|
contract_did = fields.Field( |
|
31
|
|
|
column_name='did', |
|
32
|
|
|
attribute='contract_did', |
|
33
|
|
|
widget=ForeignKeyWidget(Did, 'number')) |
|
34
|
|
|
|
|
35
|
|
|
class Meta: |
|
36
|
|
|
model = RoutesDid |
|
37
|
|
|
exclude = ('date_added', 'date_modified') |
|
38
|
|
|
export_order = ( |
|
39
|
|
|
'id', |
|
40
|
|
|
'contract_did', |
|
41
|
|
|
'order', |
|
42
|
|
|
'type', |
|
43
|
|
|
'trunk', |
|
44
|
|
|
'number', |
|
45
|
|
|
'description',) |
|
46
|
|
|
|