Skip to content

Commit

Permalink
rename testapp -> demoapp
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Jan 3, 2025
1 parent 619cd51 commit 44efd86
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 44 deletions.
15 changes: 7 additions & 8 deletions README-Finder.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Django-Filer ("Finder" branch)

The "Finder" branch of django-filer is a complete rewrite of the original **django-filer** project.
It is 'work in progress' and is not yet ready for production use. However, the code is in a state
It is 'work in progress' and not yet ready for production use. However, the code is in a state
where it can be used for testing and development purposes.

A rewrite was necessary because the original codebase was not maintainable anymore. Please read this
Expand Down Expand Up @@ -136,7 +136,7 @@ In `settings.py` of your project, add these extra dependencies or those you real
'finder',
'finder.contrib.archive', # supports zip, tar, tar.gz, tar.bz2, tar.xz
'finder.contrib.audio', # supports mp3, ogg, flac, wav
'finder.contrib.common', # supports pdf, spreadsheets
'finder.contrib.common', # supports PDF, spreadsheets
'finder.contrib.image.pil', # supports bmp, gif, jpeg, png, tiff
'finder.contrib.image.svg', # supports svg
'finder.contrib.video', # supports mp4, webm, ogv
Expand All @@ -145,10 +145,9 @@ In `settings.py` of your project, add these extra dependencies or those you real
```

If you use:
* `finder.contrib.audio`, assure that `ffmpeg-python` is installed.
* `finder.contrib.audio` or `finder.contrib.video`, assure that `ffmpeg-python` is installed.
* `finder.contrib.image.pil`, assure that `Pillow` is installed.
* `finder.contrib.image.svg`, assure that `reportlab` and `svglib` are installed.
* `finder.contrib.video`, assure that `ffmpeg-python` is installed.
* Postgres as database, install `psycopg2` or `psycopg2-binary` if available for your platform.

Run the migrations for app `finder`:
Expand Down Expand Up @@ -233,9 +232,9 @@ rendered as HTML, this widget becomes the webcomponent `<finder-file-select …>
with a few additional attributes. The JavaScript part of the widget must be included using the
script tag `<script src="{% static 'finder/js/finder-select.js' %}"></script>`.

The testapp provides an example how this field can be used in a form. Just vist the URL
http://localhost:8000/admin/finder/foldermodel/ and click on the blank area to either select an
existing file or upload a new one.
The demonstration app provides an example how this field can be used in a form. Just vist the URL
http://localhost:8000/demoapp/ and click on the blank area to either select an existing file or
upload a new one.


## Permission System (Proposal)
Expand All @@ -261,7 +260,7 @@ Each `AccessControlEntry` has a these fields:
a file, it allows the currently loggedin user to view and use that file.
* A generic foreign key pointing onto the `InodeModel`. This creates a one-to-many relation between
different file types and folders on one side and the access control list on the other.
* A foreign key onto the folder model to set a permission template. Read below for details.
* A foreign key onto the folder model to set a permission template. Read below for details.
* The `execute` flag as seen in Unix file systems and other ACL implementations does not make sense
in this context and is not implemented.

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions testapp/admin_site.py → demoapp/admin_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from finder.models.folder import FolderModel


class TestappAdminSite(admin.AdminSite):
class DempappAdminSite(admin.AdminSite):
pass


admin_site = TestappAdminSite(name="testapp_admin")
admin_site = DempappAdminSite(name="demoapp_admin")
admin_site.register(FolderModel, FolderAdmin)
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 4.2.15 on 2024-10-26 08:46
# Generated by Django 5.2.dev20241203005448 on 2025-01-03 08:36

from django.db import migrations, models
import finder.models.fields
from django.db import migrations, models


class Migration(migrations.Migration):
Expand All @@ -13,7 +13,7 @@ class Migration(migrations.Migration):

operations = [
migrations.CreateModel(
name='TestAppModel',
name='DemoAppModel',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('file', finder.models.fields.FinderFileField(blank=True, null=True, verbose_name='Demo File')),
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion testapp/models.py → demoapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from finder.models.fields import FinderFileField


class TestAppModel(models.Model):
class DemoAppModel(models.Model):
file = FinderFileField(
verbose_name="Demo File",
null=True,
Expand Down
24 changes: 5 additions & 19 deletions testapp/settings.py → demoapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,18 @@
'finder.contrib.image.pil',
'finder.contrib.image.svg',
'finder.contrib.video',
'testapp',
'demoapp',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'demoapp.middleware.AutoLoginMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
]

ROOT_URLCONF = 'testapp.urls'
ROOT_URLCONF = 'demoapp.urls'

TEMPLATES = [
{
Expand Down Expand Up @@ -103,20 +101,10 @@

TIME_ZONE = 'UTC'

MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'testapp.middleware.AutoLoginMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
]

SILENCED_SYSTEM_CHECKS = ['admin.E408'] # required for AutoLoginMiddleware

USE_I18N = True

ROOT_URLCONF = 'testapp.urls'

STATICFILES_DIRS = [
('node_modules', BASE_DIR / 'node_modules'),
]
Expand All @@ -127,8 +115,6 @@

MEDIA_URL = '/media/'

WSGI_APPLICATION = 'wsgi.application'

LOGGING = {
'version': 1,
'disable_existing_loggers': True,
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions testapp/urls.py → demoapp/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""testapp URL Configuration
"""demoapp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.1/topics/http/urls/
Expand All @@ -20,13 +20,13 @@

from finder.browser import urls as browser_urls

from testapp.views import TestAppView
from demoapp.views import DemoAppView


urlpatterns = [
path('admin/', admin.site.urls),
path('finder-api/', include(browser_urls)),
path('testapp/', TestAppView.as_view(), name='testapp'),
path('finder-api/', include(browser_urls)), # endpoints for demoapp
path('demoapp/', DemoAppView.as_view(), name='demoapp'),
]
if settings.DEBUG:
urlpatterns.extend(static(
Expand Down
12 changes: 6 additions & 6 deletions testapp/views.py → demoapp/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from django.views.generic.edit import UpdateView

from testapp.models import TestAppModel
from demoapp.models import DemoAppModel


class TestAppView(UpdateView):
model = TestAppModel
class DemoAppView(UpdateView):
model = DemoAppModel
fields = '__all__'
template_name = 'testapp.html'
template_name = 'demoapp.html'

def get_object(self, queryset=None):
if obj := TestAppModel.objects.first():
if obj := DemoAppModel.objects.first():
return obj
return TestAppModel.objects.create()
return DemoAppModel.objects.create()

def get_success_url(self):
return self.request.path
Expand Down
2 changes: 1 addition & 1 deletion testapp/wsgi.py → demoapp/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
WSGI config for testapp project.
WSGI config for demoapp project.
It exposes the WSGI callable as a module-level variable named ``application``.
Expand Down

0 comments on commit 44efd86

Please sign in to comment.