Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fai-webapi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Libraries
fai-webapi
Commits
6c221715
Verified
Commit
6c221715
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Add abstract/default forms and formsets for hooks and scripts
parent
20c1a89f
Branches
10-ipxe-booting
main
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fai_webapi_djrf/conf.py
+4
-0
4 additions, 0 deletions
fai_webapi_djrf/conf.py
fai_webapi_djrf/forms.py
+18
-0
18 additions, 0 deletions
fai_webapi_djrf/forms.py
fai_webapi_djrf/views.py
+8
-0
8 additions, 0 deletions
fai_webapi_djrf/views.py
with
30 additions
and
0 deletions
fai_webapi_djrf/conf.py
+
4
−
0
View file @
6c221715
...
...
@@ -11,10 +11,14 @@ class FAIAppConf(AppConf):
FORM_CLASS
=
"
fai_webapi_djrf.forms.AbstractClassForm
"
FORM_DEBCONFANSWER
=
"
fai_webapi_djrf.forms.AbstractDebconfAnswerForm
"
FORM_VARIABLE
=
"
fai_webapi_djrf.forms.AbstractVariableForm
"
FORM_HOOK
=
"
fai_webapi_djrf.forms.AbstractHookForm
"
FORM_SCRIPT
=
"
fai_webapi_djrf.forms.AbstractScriptForm
"
FORM_PACKAGECONFIG
=
"
fai_webapi_djrf.forms.AbstractPackageConfigForm
"
FORMSET_DEBCONFANSWER
=
"
fai_webapi_djrf.forms.AbstractDebconfAnswerFormset
"
FORMSET_VARIABLE
=
"
fai_webapi_djrf.forms.AbstractVariableFormset
"
FORMSET_HOOK
=
"
fai_webapi_djrf.forms.AbstractHookFormset
"
FORMSET_SCRIPT
=
"
fai_webapi_djrf.forms.AbstractHookFormset
"
FORMSET_PACKAGECONFIG
=
"
fai_webapi_djrf.forms.AbstractPackageConfigFormset
"
VIEW_BASECONFIGSPACE_LIST
=
"
fai_webapi_djrf.views.AbstractBaseConfigSpaceListView
"
...
...
This diff is collapsed.
Click to expand it.
fai_webapi_djrf/forms.py
+
18
−
0
View file @
6c221715
...
...
@@ -46,6 +46,18 @@ class AbstractVariableForm(ModelForm):
fields
=
[
"
name
"
,
"
value
"
]
class
AbstractHookForm
(
ModelForm
):
class
Meta
:
model
=
Hook
fields
=
[
"
task
"
,
"
content
"
,
"
sourced
"
]
class
AbstractScriptForm
(
ModelForm
):
class
Meta
:
model
=
Script
fields
=
[
"
priority
"
,
"
name
"
,
"
content
"
,
"
sourced
"
]
class
AbstractPackageConfigForm
(
ModelForm
):
class
Meta
:
model
=
PackageConfig
...
...
@@ -61,6 +73,12 @@ DebconfAnswerFormset = import_string(settings.FAI_FORMSET_DEBCONFANSWER)
VariableForm
=
import_string
(
settings
.
FAI_FORM_VARIABLE
)
AbstractVariableFormset
=
modelformset_factory
(
Variable
,
form
=
VariableForm
,
extra
=
3
)
VariableFormset
=
import_string
(
settings
.
FAI_FORMSET_VARIABLE
)
HookForm
=
import_string
(
settings
.
FAI_FORM_HOOK
)
AbstractHookFormset
=
modelformset_factory
(
Hook
,
form
=
HookForm
,
extra
=
3
)
HookFormset
=
import_string
(
settings
.
FAI_FORMSET_HOOK
)
ScriptForm
=
import_string
(
settings
.
FAI_FORM_SCRIPT
)
AbstractScriptFormset
=
modelformset_factory
(
Hook
,
form
=
HookForm
,
extra
=
3
)
ScriptFormset
=
import_string
(
settings
.
FAI_FORMSET_SCRIPT
)
PackageConfigForm
=
import_string
(
settings
.
FAI_FORM_PACKAGECONFIG
)
AbstractPackageConfigFormset
=
modelformset_factory
(
PackageConfig
,
form
=
PackageConfigForm
,
extra
=
3
)
PackageConfigFormset
=
import_string
(
settings
.
FAI_FORMSET_PACKAGECONFIG
)
This diff is collapsed.
Click to expand it.
fai_webapi_djrf/views.py
+
8
−
0
View file @
6c221715
...
...
@@ -80,6 +80,14 @@ class AbstractClassUpdateView(UpdateView):
queryset
=
Variable
.
objects
.
filter
(
for_class
=
self
.
object
),
initial
=
[{
"
for_class
"
:
self
.
object
}
for
_
in
range
(
VariableFormset
.
extra
)],
)
context
[
"
hook_formset
"
]
=
HookFormset
(
queryset
=
Hook
.
objects
.
filter
(
for_class
=
self
.
object
),
initial
=
[{
"
for_class
"
:
self
.
object
}
for
_
in
range
(
HookFormset
.
extra
)],
)
context
[
"
script_formset
"
]
=
ScriptFormset
(
queryset
=
Script
.
objects
.
filter
(
for_class
=
self
.
object
),
initial
=
[{
"
for_class
"
:
self
.
object
}
for
_
in
range
(
ScriptFormset
.
extra
)],
)
context
[
"
package_config_formset
"
]
=
PackageConfigFormset
(
queryset
=
PackageConfig
.
objects
.
filter
(
for_class
=
self
.
object
),
initial
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment