forked from Fediversity/Fediversity
don't use hungarian notation for model names
This commit is contained in:
parent
c8062a87d4
commit
af1c051498
5 changed files with 29 additions and 11 deletions
panel/src/panel
|
@ -1,4 +1,4 @@
|
|||
from django.contrib import admin
|
||||
from .models import DeployFormModel
|
||||
from panel.models import Configuration
|
||||
|
||||
admin.site.register(DeployFormModel)
|
||||
admin.site.register(Configuration)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django import forms
|
||||
from .models import DeployFormModel
|
||||
from panel.models import Configuration
|
||||
|
||||
|
||||
class DeployForm(forms.ModelForm):
|
||||
class Deployment(forms.ModelForm):
|
||||
class Meta:
|
||||
model = DeployFormModel
|
||||
model = Configuration
|
||||
fields = [
|
||||
'domain',
|
||||
'mastodon',
|
||||
|
|
18
panel/src/panel/migrations/0003_renamemodel.py
Normal file
18
panel/src/panel/migrations/0003_renamemodel.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 4.2.16 on 2025-02-20 09:20
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('panel', '0002_deployformmodel_user'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameModel(
|
||||
old_name='DeployFormModel',
|
||||
new_name='Configuration',
|
||||
),
|
||||
]
|
|
@ -4,7 +4,7 @@ from django.contrib.auth.models import User
|
|||
DOMAIN_LIST = [("fediversity_eu", "fediversity.eu"), ("fediversity_net", "fediversity.net")]
|
||||
|
||||
|
||||
class DeployFormModel(models.Model):
|
||||
class Configuration(models.Model):
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE, default=1)
|
||||
domain = models.CharField(choices=DOMAIN_LIST, max_length=255)
|
||||
mastodon = models.BooleanField(default=False)
|
||||
|
|
|
@ -5,8 +5,8 @@ from django.views.generic import DetailView
|
|||
from django.views.generic.edit import UpdateView
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse_lazy
|
||||
from .models import DeployFormModel
|
||||
from .forms import DeployForm
|
||||
from panel.models import Configuration
|
||||
from panel import forms
|
||||
|
||||
|
||||
class Index(TemplateView):
|
||||
|
@ -27,11 +27,11 @@ class ServiceList(TemplateView):
|
|||
|
||||
class DeployServices(LoginRequiredMixin, UpdateView):
|
||||
template_name = 'deploy_services.html'
|
||||
model = DeployFormModel
|
||||
form_class = DeployForm
|
||||
model = Configuration
|
||||
form_class = forms.Deployment
|
||||
success_url = reverse_lazy('deploy_services')
|
||||
|
||||
def get_object(self, queryset=None):
|
||||
obj, created = DeployFormModel.objects.get_or_create(
|
||||
obj, created = Configuration.objects.get_or_create(
|
||||
user=self.request.user)
|
||||
return obj
|
||||
|
|
Loading…
Add table
Reference in a new issue