forked from Fediversity/Fediversity
WIP: unbreak
This commit is contained in:
parent
d4a5b99762
commit
066671d860
4 changed files with 19 additions and 7 deletions
|
@ -23,7 +23,8 @@ let
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
${codegen} --input ${schema} | sed 's/from pydantic/from drf_pydantic/' > $out
|
${codegen} --input ${schema} | sed '/from pydantic/a\
|
||||||
|
from drf_pydantic import BaseModel' > $out
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,7 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'django_pydantic_field',
|
'django_pydantic_field',
|
||||||
|
'rest_framework',
|
||||||
'debug_toolbar',
|
'debug_toolbar',
|
||||||
'compressor',
|
'compressor',
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% load rest_framework %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="post" enctype="multipart/form-data" action="{% url 'save' %}">
|
<form method="post" enctype="multipart/form-data" action="{% url 'save' %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
{{ form.as_p }}
|
{% render_form serializer %}
|
||||||
<button id="deploy-button" class="button"
|
<button id="deploy-button" class="button"
|
||||||
hx-post="{% url 'deployment_status' %}"
|
hx-post="{% url 'deployment_status' %}"
|
||||||
hx-trigger="click"
|
hx-trigger="click"
|
||||||
|
|
|
@ -8,11 +8,14 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.views.generic import TemplateView, DetailView
|
from django.views.generic import TemplateView, DetailView
|
||||||
from django.views.generic.edit import FormView
|
from django.views.generic.edit import FormView
|
||||||
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from panel import models, settings
|
|
||||||
from panel.configuration import forms
|
|
||||||
|
|
||||||
|
from rest_framework.renderers import TemplateHTMLRenderer
|
||||||
|
from rest_framework.response import Response
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
from panel import models, settings
|
||||||
|
from panel.configuration import schema
|
||||||
|
|
||||||
class Index(TemplateView):
|
class Index(TemplateView):
|
||||||
template_name = 'index.html'
|
template_name = 'index.html'
|
||||||
|
@ -30,10 +33,10 @@ class ServiceList(TemplateView):
|
||||||
template_name = 'service_list.html'
|
template_name = 'service_list.html'
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationForm(LoginRequiredMixin, FormView):
|
class ConfigurationForm(LoginRequiredMixin, APIView):
|
||||||
|
renderer_classes = [TemplateHTMLRenderer]
|
||||||
template_name = 'configuration_form.html'
|
template_name = 'configuration_form.html'
|
||||||
success_url = reverse_lazy('configuration_form')
|
success_url = reverse_lazy('configuration_form')
|
||||||
form_class = forms.Form
|
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
"""Get or create the configuration object for the current user"""
|
"""Get or create the configuration object for the current user"""
|
||||||
|
@ -43,6 +46,12 @@ class ConfigurationForm(LoginRequiredMixin, FormView):
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
def get(self, request):
|
||||||
|
config = self.get_object()
|
||||||
|
return Response({
|
||||||
|
'serializer': schema.Model.drf_serializer(instance=config.parsed_value),
|
||||||
|
})
|
||||||
|
|
||||||
# TODO(@fricklerhandwerk):
|
# TODO(@fricklerhandwerk):
|
||||||
# this should probably live somewhere else
|
# this should probably live somewhere else
|
||||||
def convert_enums_to_names(self, data_dict):
|
def convert_enums_to_names(self, data_dict):
|
||||||
|
|
Loading…
Add table
Reference in a new issue