Skip to content

Commit

Permalink
Added docs on how to use Photologue.
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Barran committed Mar 18, 2019
1 parent d881797 commit fe8817f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Changelog
----------------

- Fixes when file doesn't exist in the file system but still is in S3.
- Doc tweaks.
- Doc tweaks - and added a page on how to actually use Photologue!
- Make setup compatible with latest version of pip.
- Checked compatibility with Django 2.1 and Python 3.7.
- Missed a Django migration (issue #194).
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Contents:
:maxdepth: 2

pages/installation
pages/usage
pages/customising/templates
pages/customising/settings
pages/customising/admin
Expand Down
45 changes: 45 additions & 0 deletions docs/pages/usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#####
Usage
#####

Now that you've installed Photologue, here are a few suggestions on how to use it:

Upload some photos in the admin
-------------------------------
The ``Photo`` model in the admin allows you to add new photos to Photologue. You can add photos one by one - and
it the top-right corner there is a 'Upload a Zip archive' button that will allow you to upload many photos at once.

Define some Photosizes
----------------------
Photologue will create thumbnails of the photos that you upload, and the thumbnails are what is displayed in the
public website. By default Photologue comes with a few Photosizes to get you started - feel free to tweak them, or
to create new ones.

Just note that the ``admin_thumbnail`` size is used by the admin pages, so it's not a good idea to delete it!

Built-in pages and templates
----------------------------

If you've followed all the instructions in the installation page, you will have included Photologue's
urls at ``/photologue/`` - you can use these, tweak them, or discard them if they do not fit in with your website's
requirements.

Custom usage
------------
The base of Photologue is the ``Photo`` model. When an instance is created, we automatically add methods to retrieve
photos at various photosizes. E.g. if you have an instance of ``Photo`` called ``photo``, then the
following methods will have been added automatically::

photo.get_thumbnail_url()
photo.get_display_url()
photo.get_admin_thumbnail_url()

These can be used in a custom template to display a thumbnail, e.g.::

<a href="{{ photo.image.url }}">
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
</a>

This will display an image, sized to the dimensions specified in the Photosize ``display``,
and provide a clickable link to the raw image. Please refer to the example templates for ideas on how to use
``Photo`` and ``Gallery`` instances!

0 comments on commit fe8817f

Please sign in to comment.