-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
198 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from django import forms | ||
from .models import Setting | ||
|
||
class SettingForm(forms.ModelForm): | ||
class Meta: | ||
model = Setting | ||
fields = ( | ||
'api_url', | ||
'completed_directory', | ||
'input_directory', | ||
'num_cpus', | ||
'output_directory', | ||
'output_scheme' | ||
) | ||
labels = { | ||
'api_url': 'Custom API URL', | ||
'completed_directory': 'Directory for original input files', | ||
'input_directory': 'Input directory path', | ||
'num_cpus': 'Number of CPUs to use (0 will use all available)', | ||
'output_directory': 'Output directory path', | ||
'output_scheme': 'Output format' | ||
} | ||
widgets = { | ||
'api_url': forms.URLInput(attrs={'class': 'input is-fullwidth'}), | ||
'completed_directory': forms.TextInput(attrs={'class': 'input is-fullwidth'}), | ||
'input_directory': forms.TextInput(attrs={'class': 'input is-fullwidth'}), | ||
'num_cpus': forms.NumberInput(attrs={'class': 'input is-fullwidth'}), | ||
'output_directory': forms.TextInput(attrs={'class': 'input is-fullwidth'}), | ||
'output_scheme': forms.TextInput(attrs={'class': 'input is-fullwidth'}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 3.2.5 on 2021-11-13 22:04 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('importer', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Setting', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('api_url', models.CharField(max_length=255)), | ||
('completed_directory', models.CharField(max_length=255)), | ||
('input_directory', models.CharField(max_length=255)), | ||
('num_cpus', models.IntegerField()), | ||
('output_directory', models.CharField(max_length=255)), | ||
('output_scheme', models.CharField(max_length=255)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<div class="columns"> | ||
<div class="column"> | ||
<div class="card"> | ||
<div class="card-header is-center"> | ||
<div class="card-header-title"> | ||
<p class="title">Settings</p> | ||
</div> | ||
</div> | ||
<form action="/import/setting" method="POST"> | ||
{% csrf_token %} | ||
<div class="card-content"> | ||
{% for field in form %} | ||
<div class="field is-horizontal"> | ||
<div class="field-body"> | ||
<div class="field"> | ||
{{ field.label_tag }} | ||
<div class="control"> | ||
{{ field }} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
<footer class="card-footer"> | ||
<div class="card-footer-item"> | ||
<div class="control"> | ||
<button class="button is-link is-fullwidth">Save</button> | ||
</div> | ||
</div> | ||
</footer> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters