forked from Fediversity/Fediversity
add first part of save able login
This commit is contained in:
parent
5a49432b47
commit
2fa4bdaa84
6 changed files with 92 additions and 52 deletions
13
panel/src/panel/forms.py
Normal file
13
panel/src/panel/forms.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
from django import forms
|
||||
from .models import DeployFormModel
|
||||
|
||||
|
||||
class DeployForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = DeployFormModel
|
||||
fields = [
|
||||
'domain',
|
||||
'mastodon',
|
||||
'pixelfed',
|
||||
'mastodon',
|
||||
]
|
11
panel/src/panel/models.py
Normal file
11
panel/src/panel/models.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from django.db import models
|
||||
|
||||
|
||||
class DeployFormModel(models.Model):
|
||||
domain = models.TextField()
|
||||
mastodon = models.BooleanField(default=False)
|
||||
pixelfed = models.BooleanField(default=False)
|
||||
peertube = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.domain
|
55
panel/src/panel/templates/deploy_services.html
Normal file
55
panel/src/panel/templates/deploy_services.html
Normal file
|
@ -0,0 +1,55 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<form method="post" enctype="multipart/form-data" action="{% url 'deploy_services' %}">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<div>
|
||||
<input type="text" id="domain" name="domain" placeholder="fediversity.net" value="fediversity.net" />
|
||||
<label for="domain">Domain</label>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Services:</legend>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="mastodon" name="mastodon" checked />
|
||||
<label for="mastodon">Mastodon</label>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div>
|
||||
<input type="text" id="subdomain-mastodon" name="subdomain-mastodon" placeholder="mastodon" value="mastodon" />
|
||||
<label for="subdomain-mastodon">subdomain for Mastodon</label>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="pixelfed" name="pixelfed" checked />
|
||||
<label for="pixelfed">Pixelfed</label>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div>
|
||||
<input type="text" id="subdomain-pixelfed" name="subdomain-pixelfed" placeholder="pixelfed" value="pixelfed" />
|
||||
<label for="subdomain-pixelfed">subdomain for Pixelfed</label>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="peertube" name="peertube" checked />
|
||||
<label for="peertube">Peertube</label>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div>
|
||||
<input type="text" id="subdomain-peertube" name="subdomain-peertube" placeholder="peertube" value="peertube" />
|
||||
<label for="subdomain-peertube">subdomain for Peertube</label>
|
||||
</div>
|
||||
-->
|
||||
|
||||
</fieldset>
|
||||
|
||||
<button class="button" disabled>Deploy</button>
|
||||
<button class="button" type="submit" >Save</button>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -3,56 +3,4 @@
|
|||
{% block content %}
|
||||
<h1>Fediversity Panel</h1>
|
||||
|
||||
<form method="post" enctype="multipart/form-data" action="">
|
||||
{% csrf_token %}
|
||||
|
||||
<div>
|
||||
<input type="text" id="domain" name="domain" placeholder="fediversity.net" value="fediversity.net" />
|
||||
<label for="domain">Domain</label>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Services:</legend>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="mastodon" name="mastodon" checked />
|
||||
<label for="mastodon">Mastodon</label>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div>
|
||||
<input type="text" id="subdomain-mastodon" name="subdomain-mastodon" placeholder="mastodon" value="mastodon" />
|
||||
<label for="subdomain-mastodon">subdomain for Mastodon</label>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="pixelfed" name="pixelfed" checked />
|
||||
<label for="pixelfed">Pixelfed</label>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div>
|
||||
<input type="text" id="subdomain-pixelfed" name="subdomain-pixelfed" placeholder="pixelfed" value="pixelfed" />
|
||||
<label for="subdomain-pixelfed">subdomain for Pixelfed</label>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="peertube" name="peertube" checked />
|
||||
<label for="peertube">Peertube</label>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div>
|
||||
<input type="text" id="subdomain-peertube" name="subdomain-peertube" placeholder="peertube" value="peertube" />
|
||||
<label for="subdomain-peertube">subdomain for Peertube</label>
|
||||
</div>
|
||||
-->
|
||||
|
||||
</fieldset>
|
||||
|
||||
<button class="button">Deploy</button>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -25,4 +25,5 @@ urlpatterns = [
|
|||
path("", include("django.contrib.auth.urls")),
|
||||
path("account/", views.AccountDetail.as_view(), name='account_detail'),
|
||||
path("services/", views.ServiceList.as_view(), name='service_list'),
|
||||
path("deploy/", views.DeployServices.as_view(), name='deploy_services'),
|
||||
]
|
||||
|
|
|
@ -2,6 +2,11 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
|||
from django.contrib.auth.models import User
|
||||
from django.views.generic import TemplateView
|
||||
from django.views.generic import DetailView
|
||||
from django.views.generic.edit import CreateView
|
||||
from django.shortcuts import render, redirect
|
||||
from django.urls import reverse_lazy
|
||||
from .models import DeployFormModel
|
||||
from .forms import DeployForm
|
||||
|
||||
class Index(TemplateView):
|
||||
template_name = 'index.html'
|
||||
|
@ -14,3 +19,10 @@ class AccountDetail(LoginRequiredMixin, DetailView):
|
|||
|
||||
class ServiceList(TemplateView):
|
||||
template_name = 'service_list.html'
|
||||
|
||||
class DeployServices(LoginRequiredMixin, TemplateView):
|
||||
template_name = 'deploy_services.html'
|
||||
model = DeployFormModel
|
||||
form_class = DeployForm
|
||||
success_url = reverse_lazy('index')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue