import pdb; pdb.set_trace()
# You can put it anywhere in a functionpython -m pdb manage.py runserverc= continue
import pdb; pdb.set_trace()
# You can put it anywhere in a functionpython -m pdb manage.py runserverc = continueDocs: https://virtualenvwrapper.readthedocs.io/en/latest/install.html
(You need Python but you almost certainly already have it)
pip install virtualenvpip install virtualenvwrappernano ~/.zshrc
(~/.bashrc if using bash)Then paste the following
| # Put this in your .env file # | |
| DATABASE_URL # auto-generated by build-pack | |
| DJANGO_SETTINGS_MODULE # e.g. your-app.settings.production | |
| SECRET_KEY # looooooooooots of chars | |
| ALLOWED_HOSTS # ".domain.com" or ["domain.com", "otherdomain.com", "someotherdomain.com"] |
| `{% if request.path == '/' %}` |
| If you want to be able to make queries like "which myapp.FooPage pages use this image?", | |
| then you can deal with that by setting an explicit `related_name`. | |
| Usually we don't care about doing that, so we set `related_name='+'` | |
| to disable that reverse relation completely. | |
| Posted in #wagtail | |
| The main reason for using it is to avoid name collisions. | |
| If, say, you have two FooPage models in two different apps, | |
| and they both have a FK to image, they'll both try to create a | |
| reverse relation on `Image` called something like `foopage_objects`. |
| In short these are the commands you need to run | |
| first time: | |
| ```pip install twine``` | |
| package/upload: | |
| ```python setup.py bdist_wheel | |
| twine register dist/{{the file that we just made with the command above}}.whl |
| from django.db import models | |
| from wagtail.wagtailcore.models import Page, Orderable | |
| from wagtail.wagtailimages.edit_handlers import ImageChooserPanel | |
| from wagtail.wagtailsearch import index | |
| from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel | |
| from wagtail.wagtailsnippets.models import register_snippet | |
| from wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel | |
| from modelcluster.fields import ParentalKey | |
| from modelcluster.models import ClusterableModel | |
| from datetime import datetime |
| sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions |
| Use manage.py dumpdata to dump the data into a JSON fixture file. Read "django-admin.py and manage.py". |
| Couldn't find this documented in the docs or elsewhere... | |
| Using the following in a model: | |
| `download = DocumentChooserBlock(icon='fa-download', template='blocks/download.html')` | |
| You'd need to use something along the lines of: | |
| `<div class="download"><a href="{{ self.url }}">{{ self.title }}</a></div>` | |
| note: title isn't the uploaded document's title (e.g. filename) but rather the title added at the point of uploading. | |