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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98465410a15669d8cf10b233a176bc5886716cb2effaffde5bdff60877d5d597 |
|
MD5 | 00ac7452246262dc983996f5a980e415 |
|
BLAKE2b-256 | bc2c7073d0dbd17b7e0df5dd0d3d3bc21e4d811d72fa5ee4d1fd881f3553dbd9 |
Close
Hashes for django_webcampicture-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39ced2ffb192408de119aa33dc7d6644b6725ba6907e346861a42fd71a530ce1 |
|
MD5 | 6e34ac51ca331495f85ddf69ff1ef343 |
|
BLAKE2b-256 | e22502a2cf80ab065bb91bea95e1262edf307e37c47e4746e832e2db516b2b1a |