mirror of
https://github.com/Xevion/simple-viewer.git
synced 2026-01-31 04:26:05 -06:00
create ServedDirectory model, setup project settings, add Viewer app to project, uuid migration
This commit is contained in:
@@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
|
|||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
'viewer.apps.ViewerConfig',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
@@ -106,7 +107,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||||||
|
|
||||||
LANGUAGE_CODE = 'en-us'
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
TIME_ZONE = 'CST'
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# Generated by Django 3.1.2 on 2020-10-31 10:20
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ServedDirectory',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('path', models.CharField(max_length=260, verbose_name='Directory Path')),
|
||||||
|
('recursive', models.BooleanField(default=False, verbose_name='Files Are Matched Recursively')),
|
||||||
|
('regex_pattern', models.CharField(default=None, max_length=100, verbose_name='RegEx Matching Pattern')),
|
||||||
|
('regex', models.BooleanField(default=False, verbose_name='Directory RegEx Option')),
|
||||||
|
('match_filename', models.BooleanField(default=True, verbose_name='RegEx Matches Against Filename')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 3.1.2 on 2020-10-31 10:26
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('viewer', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='serveddirectory',
|
||||||
|
name='id',
|
||||||
|
field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
+22
-1
@@ -1,3 +1,24 @@
|
|||||||
|
import uuid
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
# Create your models here.
|
|
||||||
|
class ServedDirectory(models.Model):
|
||||||
|
"""
|
||||||
|
A reference to a specific directory on the host machine for hosting files.
|
||||||
|
|
||||||
|
A regex pattern is stored for filtering files in the directory down to what is intended.
|
||||||
|
A recursive option is also stored, in case the user wishes to serve files in directories below the one specified.
|
||||||
|
The regex pattern can be turned on or off using the boolean field.
|
||||||
|
The regex pattern can be matched against the file path (False), or just the filename (True).
|
||||||
|
"""
|
||||||
|
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True, editable=False, unique=True)
|
||||||
|
path = models.CharField('Directory Path', max_length=260)
|
||||||
|
recursive = models.BooleanField('Files Are Matched Recursively', default=False)
|
||||||
|
regex_pattern = models.CharField('RegEx Matching Pattern', max_length=100, default=None)
|
||||||
|
regex = models.BooleanField('Directory RegEx Option', default=False)
|
||||||
|
match_filename = models.BooleanField('RegEx Matches Against Filename', default=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.path
|
||||||
|
|||||||
Reference in New Issue
Block a user