Skip to content

Commit

Permalink
Refactor #3 (#30) - redo project structure, add new user model & pseuds
Browse files Browse the repository at this point in the history
* make sure all sqlite3 dbs are ignored

* delete all migrations

* Rename fanarchive app to 'fanfic'

* modify INSTALLED_APPS

* Add users app

* Add custom user using authtools

* Add authtools to requirements

* Rename custom user & register it in settings

* Add pseuds app

* Add authorship via pseuds for fic

* Remove extra argument in pseud_owner definition

* Make new initial migrations

* split up INSTALLED_APPS

* Misc refactoring

- Move Authorship & AuthorGroup models into a misc model file
- delete unused import in Admin.py
- register moved models properly

* Renamed templates/fanarchive so templates would work

* Eradicate last 'fanarchive' references

* Eradicating ACTUAL LAST 'fanarchive' reference?

* fix flake8 errors

* Move Pseud model in under fanfic app

* rename author models file

* Add actual Pseud model file to fanfic app

* Add pseud model to model init

* Add new migrations

* Add docstrings + refactor

* Add docstrings

* renamed author-specific models file

* Register custom user in admin

* Register new fanfic models

* Add date fields to FicPart

* add date_created to Pseud

* Make pseud_names unique

* Add migration for model changes

* Add pseud __str__ method

* Non-working changes to author model stuff

* Change name of user model

Change in settings.py
Change in user app
Redo & replace migrations because I don't want to fuck around with the old set

* Add __str__ methods for author models

* Change date_updated fields to have auto_now attribute

* Add migration to reflect field changes

* Add non many-to-many Pseud/AuthorGroup style relationship

Also add the needed migrations

* Also add new models so they are loaded

* Move connector field to PseudInstance model

* Add unique_together constraint to Authorship model

* Remove PseudGroup and PseudInstance models

* Add 'name' field to AuthorGroup model

* Make AuthorGroup.name nullable and fix migration so it works

* Change __str__ method of AuthorGroup so it can also return the group name

* Add new models so you can test them

* Remove field label tests

* Add fic_part_name test, plus refactor old fic_name test

* Add new models to the class setUp function

* Add more comments re future tests

* Add new models, and refactor so class setUp is all in MyTestCase
  • Loading branch information
quivop committed Aug 27, 2018
1 parent 39af213 commit 2acdbcf
Show file tree
Hide file tree
Showing 66 changed files with 644 additions and 363 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ ENV/
.mypy_cache/

# Make sure development dbs are ignored
.sqlite3

# Ignoring db.sqlite3 in particular
db.sqlite3
*.sqlite3

# Ignore test data dumps
dump*.json
Expand Down
20 changes: 16 additions & 4 deletions archive/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,27 @@

# Application definition

INSTALLED_APPS = [
DJANGO_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Registering the Fanarchive app
'fanarchive.apps.FanarchiveConfig',
# Adding ssl server for development
]

THIRD_PARTY_APPS = [
'sslserver',
'authtools',
]

LOCAL_APPS = [
'fanfic',
'users',
]

INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand Down Expand Up @@ -135,6 +143,10 @@
}


# Custom user model

AUTH_USER_MODEL = 'users.User'

# Password validation

AUTH_PASSWORD_VALIDATORS = [
Expand Down
12 changes: 6 additions & 6 deletions archive/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
from django.urls import path, include # we need include, so add it here

# Import RedirectView so redirecting our base url
# to the fanarchive app will work
# to the fanfic app will work
from django.views.generic import RedirectView

urlpatterns = [
path('admin/', admin.site.urls),

# forward requests for 'fanarchive/' links to urls.py
# in the fanarchive app
path('fanarchive/', include('fanarchive.urls')),
# forward requests for 'archive/' links to urls.py
# in the fanfic app
path('archive/', include('fanfic.urls')),

# redirect the base url to the fanarchive app
path('', RedirectView.as_view(url='fanarchive/')),
# redirect the base url to the fanfic app
path('', RedirectView.as_view(url='archive/')),
]
7 changes: 0 additions & 7 deletions fanarchive/admin.py

This file was deleted.

5 changes: 0 additions & 5 deletions fanarchive/apps.py

This file was deleted.

34 changes: 0 additions & 34 deletions fanarchive/migrations/0001_initial.py

This file was deleted.

24 changes: 0 additions & 24 deletions fanarchive/migrations/0002_auto_20180407_0332.py

This file was deleted.

17 changes: 0 additions & 17 deletions fanarchive/migrations/0003_remove_fic_date_created.py

This file was deleted.

19 changes: 0 additions & 19 deletions fanarchive/migrations/0004_auto_20180407_0357.py

This file was deleted.

18 changes: 0 additions & 18 deletions fanarchive/migrations/0005_ficpart_fic_part_number.py

This file was deleted.

2 changes: 0 additions & 2 deletions fanarchive/models/__init__.py

This file was deleted.

24 changes: 0 additions & 24 deletions fanarchive/models/fic.py

This file was deleted.

125 changes: 0 additions & 125 deletions fanarchive/tests/test_views.py

This file was deleted.

File renamed without changes.
10 changes: 10 additions & 0 deletions fanfic/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.contrib import admin

# registering our models
from .models import Fic, FicPart, AuthorGroup, Authorship, Pseud

admin.site.register(Fic)
admin.site.register(FicPart)
admin.site.register(AuthorGroup)
admin.site.register(Authorship)
admin.site.register(Pseud)
5 changes: 5 additions & 0 deletions fanfic/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class FanficConfig(AppConfig):
name = 'fanfic'
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 2acdbcf

Please sign in to comment.