A Django app to provide a WebcamPictureField, derived from FileField.
Project description
django-webcampicture
django-webcampicture is a very simple Django app that provides a specialization of Django's native FileField
: WebcamPictureField
, which allows users to save images taken from their webcams, instead of uploading.
Quick start
- Install using
pip
:
pip install django-webcampicture
- Add "webcampicture" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
'webcampicture',
]
- Use the field in your models:
from django.db import models
from webcampicture.fields import WebcamPictureField
class Child(models.Model):
name = models.CharField("Name", max_length=255)
# WebcamPictureField takes the same parameters as FileField
picture = WebcamPictureField("Picture", upload_to="pictures", blank=True)
# Image URL example...
@property
def picture_url(self):
if self.picture and hasattr(self.picture, "url"):
return self.picture.url
- Remember to include in your templates:
{% load static %}
<link rel="stylesheet" href="{% static "webcampicture/css/webcampicture.css" %}">
<script src="{% static 'webcampicture/js/webcampicture.js' %}"></script>
Demo
Settings and default values
WEBCAM_BASE64_PREFIX = "data:image/png;base64,"
WEBCAM_CONTENT_TYPE = "image/png"
WEBCAM_FILENAME_SUFFIX = ".png"
Overridable templates
webcampicture/webcampicture.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-webcampicture-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f859fa5f43eca78ff4f0d68c86a9d2fd09622fdae2a1b620a5048d9d39ff4a4 |
|
MD5 | 921bea43bde2aed585ced3963ea1a686 |
|
BLAKE2b-256 | e0148cf142b334b8109defc859be508dd379531cd936eb05f40a5ddcef109ef7 |
Close
Hashes for django_webcampicture-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36339bf5f26afcccf130e237e3f1ea9d0745026c176f373d99e79bd7ad9cff90 |
|
MD5 | 691fdc1158d319f6dbd824df106cf5a1 |
|
BLAKE2b-256 | 5133a2da4e9e9b297d7901a854e770865daefb396c40a033a40f8d8fe6f0e790 |