Add view displaying all 3rd party apps and packages' licenses.
This commit is contained in:
@@ -9,7 +9,7 @@ from django.db import models
|
||||
from django.utils.html import escape
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .classes import Filter
|
||||
from .classes import Filter, Package
|
||||
from .models import UserLocaleProfile
|
||||
from .utils import return_attrib
|
||||
from .widgets import (
|
||||
@@ -127,6 +127,21 @@ class LocaleProfileForm_view(DetailForm):
|
||||
fields = ('language', 'timezone')
|
||||
|
||||
|
||||
class PackagesLicensesForm(forms.Form):
|
||||
text = forms.CharField(
|
||||
label='',
|
||||
widget=forms.widgets.Textarea(
|
||||
attrs={'cols': 40, 'rows': 20, 'readonly': 'readonly'}
|
||||
)
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(PackagesLicensesForm, self).__init__(*args, **kwargs)
|
||||
self.fields['text'].initial = '\n\n'.join(
|
||||
['{}\n{}'.format(package.label, package.license_text) for package in Package.get_all()]
|
||||
)
|
||||
|
||||
|
||||
class UserForm(forms.ModelForm):
|
||||
"""
|
||||
Form used to edit an user's mininal fields by the user himself
|
||||
|
||||
Reference in New Issue
Block a user