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