Merge branch 'feature/tags' of mowoe.com:reverend/lostplaces-backend into feature/tags

This commit is contained in:
reverend 2020-09-02 00:08:04 +02:00
commit 47718ce17b
4 changed files with 15 additions and 25 deletions

View File

@ -11,12 +11,13 @@ Right now it depends on the following non-core Python 3 libraries. These can be
* [easy-thumbnails](https://github.com/SmileyChris/easy-thumbnails) A powerful, yet easy to implement thumbnailing application for Django 1.11+ * [easy-thumbnails](https://github.com/SmileyChris/easy-thumbnails) A powerful, yet easy to implement thumbnailing application for Django 1.11+
* [image](https://github.com/francescortiz/image) Image cropping for django * [image](https://github.com/francescortiz/image) Image cropping for django
* [django-widget-tweaks](https://github.com/jazzband/django-widget-tweaks) Tweak the form field rendering in templates, not in python-level form definitions. * [django-widget-tweaks](https://github.com/jazzband/django-widget-tweaks) Tweak the form field rendering in templates, not in python-level form definitions.
* [django-taggit](https://github.com/jazzband/django-taggit) A simpler approach to tagging with Django.
## Development ## Development
### Setting up a (pipenv) virtual environment for development ### Setting up a (pipenv) virtual environment for development
After having obtained the repository contents (either via .zip download or git clone), you can easily setup a pipenv virtual environment. The repo provides a Pipfile for easy dependency management that does not mess with your system. After having obtained the repository contents (either via .zip download or git clone), you can easily setup a [pipenv](https://docs.pipenv.org/) virtual environment. The repo provides a Pipfile for easy dependency management that does not mess with your system.
``` ```
$ cd lostplaces-backend $ cd lostplaces-backend
@ -25,14 +26,17 @@ $ pipenv shell
(lostplaces-backend) $ lostplaces/manage.py makemigrations (lostplaces-backend) $ lostplaces/manage.py makemigrations
(lostplaces-backend) $ lostplaces/manage.py migrate (lostplaces-backend) $ lostplaces/manage.py migrate
(lostplaces-backend) $ lostplaces/manage.py createsuperuser (lostplaces-backend) $ lostplaces/manage.py createsuperuser
(lostplaces-backend) $ lostplaces/manage.py runserver (lostplaces-backend) $ lostplaces/manage.py runserver --ipv6
``` ```
### Returning to the venv ### Returning to the venv
``` ```
$ cd lostplaces-backend $ cd lostplaces-backend
$ pipenv shell $ pipenv shell
(lostplaces-backend) $ lostplaces/manage.py runserver (lostplaces-backend) $ pipenv update # If dependencies changed, or updates available
(lostplaces-backend) $ lostplaces/manage.py makemigrations # If datamodels changed
(lostplaces-backend) $ lostplaces/manage.py migrate # If datamodels changed
(lostplaces-backend) $ lostplaces/manage.py runserver --ipv6
``` ```
Visit: [admin](http://localhost:8000/admin) for administrative backend or Visit: [admin](http://localhost:8000/admin) for administrative backend or
@ -41,16 +45,15 @@ Visit: [admin](http://localhost:8000/admin) for administrative backend or
## Installing lostplaces ## Installing lostplaces
### Install dependencies ### Install dependencies
Python3, Django3, easy-thumbnails, image, django-widget-tweaks Python3, Django3, easy-thumbnails, image, django-widget-tweaks, django-taggit
``` ```
pip install --user django easy-thumbnails image django-widget-tweaks pip install --user django easy-thumbnails image django-widget-tweaks django-taggit
``` ```
Or, if you use pipenv Or, if you use pipenv
``` ```
pipenv install pipenv install / update
``` ```
### Add 'lostplaces_app' to your INSTALLED_APPS setting like this ### Add 'lostplaces_app' to your INSTALLED_APPS setting like this
``` ```
@ -59,6 +62,7 @@ INSTALLED_APPS = [
'lostplaces_app', 'lostplaces_app',
'easy_thumbnails', 'easy_thumbnails',
'widget_tweaks', 'widget_tweaks',
'django_taggit'
] ]
``` ```
@ -92,11 +96,11 @@ urlpatterns = [
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
``` ```
Run ``python manage.py migrate`` to create the lost places models. Run ``./manage.py migrate`` to create the lost places models.
Start the development server and visit http://127.0.0.1:8000/admin/ Start the development server and visit http://localhost:8000/admin/
Visit http://127.0.0.1:8000/lostplaces/ to CRUD lost places. Visit http://localhost:8000/lostplaces/ to CRUD lost places.
Happy developing ;-) Happy developing ;-)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -23,6 +23,7 @@ urlpatterns = [
path('place/update/<int:pk>/', PlaceUpdateView.as_view(), name='place_edit'), path('place/update/<int:pk>/', PlaceUpdateView.as_view(), name='place_edit'),
path('place/delete/<int:pk>/', PlaceDeleteView.as_view(), name='place_delete'), path('place/delete/<int:pk>/', PlaceDeleteView.as_view(), name='place_delete'),
path('place/', PlaceListView.as_view(), name='place_list'), path('place/', PlaceListView.as_view(), name='place_list'),
# POST-only URL for tag submission
path('place/tag/<int:place_id>', PlaceTagSubmitView.as_view(), name='place_tag_submit'), path('place/tag/<int:place_id>', PlaceTagSubmitView.as_view(), name='place_tag_submit'),
path('place/tag/delete/<int:tagged_id>/<int:tag_id>', PlaceTagDeleteView.as_view(), name='place_tag_delete') path('place/tag/delete/<int:tagged_id>/<int:tag_id>', PlaceTagDeleteView.as_view(), name='place_tag_delete')
] ]