add hostingpackages api doc

- add to docs/code.rst toctree
- add new docs/code/hostingpackages.rst containing the autodoc directives
- document undocumented code in hostingpackages app
- update translation templates
This commit is contained in:
Jan Dittberner 2015-01-18 13:37:21 +01:00
parent 12455e2d99
commit 4f2ebbae63
6 changed files with 87 additions and 18 deletions

View file

@ -16,6 +16,7 @@ administrators and customers.
code/gvacommon code/gvacommon
code/dashboard code/dashboard
code/domains code/domains
code/hostingpackages
code/managemails code/managemails
code/mysqltasks code/mysqltasks
code/osusers code/osusers

View file

@ -0,0 +1,24 @@
:py:mod:`hostingpackages` app
=============================
.. automodule:: hostingpackages
:py:mod:`admin <hostingpackages.admin>`
---------------------------------------
.. automodule:: hostingpackages.admin
:members:
:py:mod:`apps <hostingpackages.apps>`
-------------------------------------
.. automodule:: hostingpackages.apps
:members:
:py:mod:`models <hostingpackages.models>`
-----------------------------------------
.. automodule:: hostingpackages.models
:members:

View file

@ -20,6 +20,10 @@ from .models import (
class CustomerHostingPackageCreateForm(forms.ModelForm): class CustomerHostingPackageCreateForm(forms.ModelForm):
"""
This is the form class for creating new customer hosting packages.
"""
class Meta: class Meta:
model = CustomerHostingPackage model = CustomerHostingPackage
fields = ['customer', 'template', 'name'] fields = ['customer', 'template', 'name']
@ -45,21 +49,41 @@ class CustomerHostingPackageCreateForm(forms.ModelForm):
class CustomerDiskSpaceOptionInline(admin.TabularInline): class CustomerDiskSpaceOptionInline(admin.TabularInline):
"""
This class implements the inline editor for customer hosting package disk
space options.
"""
model = CustomerDiskSpaceOption model = CustomerDiskSpaceOption
extra = 0 extra = 0
class CustomerMailboxOptionInline(admin.TabularInline): class CustomerMailboxOptionInline(admin.TabularInline):
"""
This class implements the inline editor for customer hosting package
mailbox options.
"""
model = CustomerMailboxOption model = CustomerMailboxOption
extra = 0 extra = 0
class CustomerUserDatabaseOptionInline(admin.TabularInline): class CustomerUserDatabaseOptionInline(admin.TabularInline):
"""
This class implements the inline editor for customer hosting package user
database options.
"""
model = CustomerUserDatabaseOption model = CustomerUserDatabaseOption
extra = 0 extra = 0
class CustomerHostingPackageAdmin(admin.ModelAdmin): class CustomerHostingPackageAdmin(admin.ModelAdmin):
"""
This class implements the admin interface for
:py:class:`CustomerHostingPackage`.
"""
add_form = CustomerHostingPackageCreateForm add_form = CustomerHostingPackageCreateForm
add_fieldsets = ( add_fieldsets = (
(None, { (None, {

View file

@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _
class HostingPackagesAppConfig(AppConfig): class HostingPackagesAppConfig(AppConfig):
""" """
AppConfig for the :py:mod:`osusers` app. AppConfig for the :py:mod:`hostingpackages` app.
""" """
name = 'hostingpackages' name = 'hostingpackages'

View file

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gnuviechadmin hostingpackages\n" "Project-Id-Version: gnuviechadmin hostingpackages\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-18 13:16+0100\n" "POT-Creation-Date: 2015-01-18 13:36+0100\n"
"PO-Revision-Date: 2015-01-18 13:17+0100\n" "PO-Revision-Date: 2015-01-18 13:17+0100\n"
"Last-Translator: Jan Dittberner <jan@dittberner.info>\n" "Last-Translator: Jan Dittberner <jan@dittberner.info>\n"
"Language-Team: Jan Dittberner <jan@dittberner.info>\n" "Language-Team: Jan Dittberner <jan@dittberner.info>\n"
@ -55,7 +55,7 @@ msgstr "Speicherplatz für das Hostingpaket"
msgid "unit of disk space" msgid "unit of disk space"
msgstr "Maßeinheit für den Speicherplatz" msgstr "Maßeinheit für den Speicherplatz"
#: models.py:43 models.py:172 #: models.py:43 models.py:192
msgid "name" msgid "name"
msgstr "Name" msgstr "Name"
@ -122,66 +122,66 @@ msgid_plural "{count} additional mailboxes"
msgstr[0] "{count} zusätzliches Postfach" msgstr[0] "{count} zusätzliches Postfach"
msgstr[1] "{count} zusätzliche Postfächer" msgstr[1] "{count} zusätzliche Postfächer"
#: models.py:165 #: models.py:185
msgid "customer" msgid "customer"
msgstr "Kunde" msgstr "Kunde"
#: models.py:167 #: models.py:187
msgid "hosting package template" msgid "hosting package template"
msgstr "Hostingpaketvorlage" msgstr "Hostingpaketvorlage"
#: models.py:169 #: models.py:189
msgid "The hosting package template that this hosting package is based on" msgid "The hosting package template that this hosting package is based on"
msgstr "Die Hostingpaketvorlage, auf der dieses Hostingpaket aufgebaut ist" msgstr "Die Hostingpaketvorlage, auf der dieses Hostingpaket aufgebaut ist"
#: models.py:174 #: models.py:194
msgid "Operating system user" msgid "Operating system user"
msgstr "Betriebssystemnutzer" msgstr "Betriebssystemnutzer"
#: models.py:181 #: models.py:201
msgid "customer hosting package" msgid "customer hosting package"
msgstr "Kundenhostingpaket" msgstr "Kundenhostingpaket"
#: models.py:182 #: models.py:202
msgid "customer hosting packages" msgid "customer hosting packages"
msgstr "Kundenhostingpakete" msgstr "Kundenhostingpakete"
#: models.py:191 #: models.py:211
msgid "hosting package" msgid "hosting package"
msgstr "Hostingpaket" msgstr "Hostingpaket"
#: models.py:194 #: models.py:214
msgid "customer hosting option" msgid "customer hosting option"
msgstr "kundenspezifische Hostingoption" msgstr "kundenspezifische Hostingoption"
#: models.py:195 #: models.py:215
msgid "customer hosting options" msgid "customer hosting options"
msgstr "kundenspezifische Hostingoptionen" msgstr "kundenspezifische Hostingoptionen"
#: models.py:207 #: models.py:227
msgid "disk space option template" msgid "disk space option template"
msgstr "Speicherplatzoptionsvorlage" msgstr "Speicherplatzoptionsvorlage"
#: models.py:209 #: models.py:229
msgid "The disk space option template that this disk space option is based on" msgid "The disk space option template that this disk space option is based on"
msgstr "" msgstr ""
"Die Speicherplatzoptionsvorlage auf der diese Speicherplatzoption aufgebaut " "Die Speicherplatzoptionsvorlage auf der diese Speicherplatzoption aufgebaut "
"ist" "ist"
#: models.py:223 #: models.py:243
msgid "user database option template" msgid "user database option template"
msgstr "Nutzerdatenbankoptionsvorlage" msgstr "Nutzerdatenbankoptionsvorlage"
#: models.py:225 #: models.py:245
msgid "The user database option template that this database option is based on" msgid "The user database option template that this database option is based on"
msgstr "" msgstr ""
"Die Nutzerdatenbankoptionsvorlage auf der diese Datenbankoption aufgebaut ist" "Die Nutzerdatenbankoptionsvorlage auf der diese Datenbankoption aufgebaut ist"
#: models.py:239 #: models.py:259
msgid "mailbox option template" msgid "mailbox option template"
msgstr "Postfachoptionsvorlage" msgstr "Postfachoptionsvorlage"
#: models.py:241 #: models.py:261
msgid "The mailbox option template that this mailbox option is based on" msgid "The mailbox option template that this mailbox option is based on"
msgstr "Die Postfachoptionsvorlage auf der diese Postfachoption aufgebaut ist" msgstr "Die Postfachoptionsvorlage auf der diese Postfachoption aufgebaut ist"

View file

@ -144,8 +144,28 @@ class MailboxOption(MailboxOptionBase, HostingOption):
class CustomerHostingPackageManager(models.Manager): class CustomerHostingPackageManager(models.Manager):
"""
This is the default manager implementation for
:py:class:`CustomerHostingPackage`.
"""
def create_from_template(self, customer, template, name, **kwargs): def create_from_template(self, customer, template, name, **kwargs):
"""
Use this method to create a new :py:class:`CustomerHostingPackage` from
a :py:class:`HostingPackageTemplate`.
The method copies data from the template to the new
:py:class:`CustomerHostingPackage` instance.
:param customer: a Django user representing a customer
:param template: a :py:class:`HostingPackageTemplate`
:param str name: the name of the hosting package there must only be
one hosting package of this name for each customer
:return: customer hosting package
:rtype: :py:class:`CustomerHostingPackage`
"""
package = CustomerHostingPackage( package = CustomerHostingPackage(
customer=customer, template=template, name=name) customer=customer, template=template, name=name)
for attrname in ('description', 'diskspace', 'diskspace_unit', for attrname in ('description', 'diskspace', 'diskspace_unit',