django-orchestra/orchestra/apps/saas/services/wordpress.py

31 lines
1.1 KiB
Python
Raw Normal View History

2014-10-10 17:17:20 +00:00
from django import forms
2014-10-11 16:21:51 +00:00
from django.utils.safestring import mark_safe
2014-10-10 17:17:20 +00:00
from django.utils.translation import ugettext_lazy as _
2014-11-12 16:33:40 +00:00
from orchestra.apps.plugins.forms import PluginDataForm
2014-10-10 17:17:20 +00:00
from .options import SoftwareService
2014-10-11 16:21:51 +00:00
class WordPressForm(PluginDataForm):
2014-10-10 17:17:20 +00:00
username = forms.CharField(label=_("Username"), max_length=64)
password = forms.CharField(label=_("Password"), max_length=64)
site_name = forms.CharField(label=_("Site name"), max_length=64,
help_text=_("URL will be <site_name>.blogs.orchestra.lan"))
email = forms.EmailField(label=_("Email"))
2014-10-11 16:21:51 +00:00
def __init__(self, *args, **kwargs):
super(WordPressForm, self).__init__(*args, **kwargs)
instance = kwargs.get('instance')
if instance:
url = 'http://%s.%s' % (instance.data['site_name'], 'blogs.orchestra.lan')
url = '<a href="%s">%s</a>' % (url, url)
self.fields['site_name'].help_text = mark_safe(url)
2014-10-10 17:17:20 +00:00
2014-11-10 17:18:04 +00:00
class WordPressService(SoftwareService):
2014-10-11 12:43:08 +00:00
verbose_name = "WordPress"
2014-10-11 16:21:51 +00:00
form = WordPressForm
2014-10-10 17:17:20 +00:00
description_field = 'site_name'
2014-10-11 12:43:08 +00:00
icon = 'saas/icons/WordPress.png'