Here we’ll assume you have a working Tutorial: Quickstart setup.
We’ll add camera information extracted from EXIF parsing to database, and in our photo gallery.
Add the following in INSTALLED_APPS:
"mg.metadata.camera_info",
Update the database:
user@host quickstart $ ./manage.py syncdb
In templates/element/element_detail.html, add the following:
In header, add a “load” block:
{% load mg_camera_info %}
In block content, add the following tag:
{% camera_info object %}
Code should look like:
{% extends "base.html" %}
{% load mg_element %}
{% load mg_camera_info %}
{% block title %}{{object.name}}{% endblock %}
{% block content %}
<p><a href="/">Back to list</a></p>
{% elem_view object %}
<dl>
<dt>Name</dt>
<dd>{{ object.name }}</dd>
<dt>Timestamp</dt>
<dd>{{ object.timestamp }}</dd>
</dl>
{% camera_info object %}
{% endblock %}
If we had the application present at time of import, this would have been done transparently, but now we can update database afterwards:
user@host quickstart $ ./manage.py mg_update
Supported types: photo
MetaUpdater 4/10
ExifOrientation Deleted data associated with IMG_1144
ExifPhotoInfo ExifCameraInfo Deleted data associated with IMG_1144
CreateResizedPhoto . . CreateThumbnail . .
MetaUpdater 5/10
ExifOrientation Deleted data associated with IMG_1145
ExifPhotoInfo ExifCameraInfo Deleted data associated with IMG_1145
CreateResizedPhoto . . CreateThumbnail . .
MetaUpdater 6/10
ExifOrientation Deleted data associated with IMG_1146
ExifPhotoInfo ExifCameraInfo Deleted data associated with IMG_1146
CreateResizedPhoto . . CreateThumbnail . .
user@host quickstart $
See Updating Metadata for more information.
That’s it, you successfully added Exif camera metadata support. You can see the result running the server:
user@host quickstart $ ./manage.py runserver
You may want to: