Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
191 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Switch2bill-common | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# Copyright (C) 2011-2013 Star2Billing S.L. | ||
# | ||
# The Initial Developer of the Original Code is | ||
# Arezqui Belaid <info@star2billing.com> | ||
# | ||
from utils import Choice | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
|
||
class EXPORT_CHOICE(Choice): | ||
CSV = 'csv', _('csv').upper() | ||
XLS = 'xls', _('xls').upper() | ||
JSON = 'json', _('json').upper() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Switch2bill-common | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# Copyright (C) 2011-2013 Star2Billing S.L. | ||
# | ||
# The Initial Developer of the Original Code is | ||
# Arezqui Belaid <info@star2billing.com> | ||
# | ||
from django import forms | ||
from django.utils.safestring import mark_safe | ||
from django.utils.translation import ugettext_lazy as _ | ||
from common_constants import EXPORT_CHOICE | ||
|
||
|
||
class HorizRadioRenderer(forms.RadioSelect.renderer): | ||
"""This overrides widget method to put radio buttons horizontally | ||
instead of vertically. | ||
""" | ||
def render(self): | ||
"""Outputs radios""" | ||
return mark_safe(u'\n'.join([u'%s\n' % w for w in self])) | ||
|
||
|
||
class Exportfile(forms.Form): | ||
""" | ||
Abstract Form : export file in various format e.g. XLS, CSV, JSON | ||
""" | ||
export_to = forms.TypedChoiceField(label=_('export to').capitalize(), required=True, | ||
choices=list(EXPORT_CHOICE), | ||
widget=forms.RadioSelect(renderer=HorizRadioRenderer)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.