first
This commit is contained in:
commit
89a5d70512
284 files changed
+8364
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,22 @@
|
||||
from django.contrib import admin
|
||||
from apps.customform.models import (
|
||||
CustomForm as CustomFormModel,
|
||||
CustomFormData as CustomFormDataModel,
|
||||
CustomFormField as CustomFormFieldModel,
|
||||
)
|
||||
# Register your models here.
|
||||
|
||||
|
||||
@admin.register(CustomFormModel)
|
||||
class CustomFormAdmin(admin.ModelAdmin):
|
||||
pass
|
||||
|
||||
|
||||
@admin.register(CustomFormDataModel)
|
||||
class CustomFormDataAdmin(admin.ModelAdmin):
|
||||
pass
|
||||
|
||||
|
||||
@admin.register(CustomFormFieldModel)
|
||||
class CustomFormFieldAdmin(admin.ModelAdmin):
|
||||
pass
|
||||
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CustomformConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'apps.customform'
|
||||
@@ -0,0 +1,60 @@
|
||||
# Generated by Django 4.2.1 on 2023-07-23 06:48
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('cuser', '0002_roletype_cuserrole'),
|
||||
('workspace', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='CustomForm',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('name', models.CharField(max_length=20)),
|
||||
('desc', models.CharField(blank=True, max_length=30, null=True)),
|
||||
('sys_ws', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='workspace.workspace')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomFormField',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('field_name_fa', models.CharField(max_length=20)),
|
||||
('field_name_en', models.CharField(max_length=20)),
|
||||
('validator', models.CharField(blank=True, max_length=50, null=True)),
|
||||
('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='field', to='customform.customform')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomFormData',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('data', models.JSONField()),
|
||||
('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='customform.customform')),
|
||||
('form_filler', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cuser.cuserrole')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 4.2.1 on 2023-07-23 06:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('customform', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customform',
|
||||
name='desc',
|
||||
field=models.CharField(blank=True, max_length=50, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customform',
|
||||
name='name',
|
||||
field=models.CharField(max_length=40),
|
||||
),
|
||||
]
|
||||
Whitespace-only changes.
@@ -0,0 +1,34 @@
|
||||
from django.db import models
|
||||
from utils.base_model import BaseModel
|
||||
import uuid
|
||||
from apps.workspace.models import Workspace as WorkspaceModel
|
||||
from apps.cuser.models import CuserRole as CuserRoleModel
|
||||
# Create your models here.
|
||||
|
||||
|
||||
class CustomForm(BaseModel):
|
||||
name = models.CharField(max_length=40, null=False, blank=False)
|
||||
desc = models.CharField(max_length=50, null=True, blank=True)
|
||||
sys_ws = models.ForeignKey(WorkspaceModel, on_delete=models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.name}'
|
||||
|
||||
|
||||
class CustomFormField(BaseModel):
|
||||
form = models.ForeignKey(CustomForm, on_delete=models.CASCADE, related_name='field')
|
||||
field_name_fa = models.CharField(max_length=20, null=False, blank=False)
|
||||
field_name_en = models.CharField(max_length=20, null=False, blank=False)
|
||||
validator = models.CharField(max_length=50, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.form} -> {self.field_name_en}'
|
||||
|
||||
|
||||
class CustomFormData(BaseModel):
|
||||
form = models.ForeignKey(CustomForm, on_delete=models.CASCADE)
|
||||
form_filler = models.ForeignKey(CuserRoleModel, on_delete=models.CASCADE)
|
||||
data = models.JSONField(null=False, blank=False)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.form} -> {self.field_name_en}'
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Reference in new issue
Block a user