File Context provides an easy way to store different documents/attachments
Project description
=============================
Django File Context
=============================
.. image:: https://gitlab.sigmageosistemas.com.br/dev/django-file-context/badges/master/coverage.svg
.. image:: https://gitlab.sigmageosistemas.com.br/dev/django-file-context/badges/master/pipeline.svg
.. image:: https://readthedocs.org/projects/django-file-context/badge/?version=latest
File Context provides an easy way to store different documents/attachments
Documentation
-------------
The full documentation is at https://django-file-context.readthedocs.io.
Quickstart
----------
Install Django File Context::
pip install django-file-context
Add it to your `INSTALLED_APPS`:
.. code-block:: python
INSTALLED_APPS = (
...
'file_context.apps.FileContextConfig',
...
)
You need to add this to your INSTALLED_APPS, because we have our own
models.
Add Django File Context's URL patterns:
.. code-block:: python
from file_context import urls as file_context_urls
urlpatterns = [
...
url(r'^', include(file_context_urls)),
...
]
This is optional. Actually, you can include your own URLs.
Features
--------
* Generic File model so you can store different kinds of files, images,
etc, using a single model;
* Attach/Detach the file model to other models
* Cool descriptor, so you don't have to keep mangling GenericForeignKeys
inside your models.
Usage
-----
1. First of all, define your first model
:: python
from file_context.managers import Files
class MyModel(models.Model):
name = models.CharField(max_length=128)
files = Files()
2. That's it.
3. You can use the Files API to attach files to MyModel instances, using:
:: python
uploaded_file = File.objects.get(pk=1)
a = MyModel.objects.create(name='foo')
a.files.attach(uploaded_file)
a.files.detach(uploaded_file)
a.files.clear()
Running Tests
-------------
Does the code actually work?
::
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox
Credits
-------
Tools used in rendering this package:
* Huge props to django-taggit that inspired me to do the descritor
idea!
* Cookiecutter_
* `cookiecutter-djangopackage`_
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage
History
-------
0.1.0 (2017-10-25)
++++++++++++++++++
* First release on PyPI.
Django File Context
=============================
.. image:: https://gitlab.sigmageosistemas.com.br/dev/django-file-context/badges/master/coverage.svg
.. image:: https://gitlab.sigmageosistemas.com.br/dev/django-file-context/badges/master/pipeline.svg
.. image:: https://readthedocs.org/projects/django-file-context/badge/?version=latest
File Context provides an easy way to store different documents/attachments
Documentation
-------------
The full documentation is at https://django-file-context.readthedocs.io.
Quickstart
----------
Install Django File Context::
pip install django-file-context
Add it to your `INSTALLED_APPS`:
.. code-block:: python
INSTALLED_APPS = (
...
'file_context.apps.FileContextConfig',
...
)
You need to add this to your INSTALLED_APPS, because we have our own
models.
Add Django File Context's URL patterns:
.. code-block:: python
from file_context import urls as file_context_urls
urlpatterns = [
...
url(r'^', include(file_context_urls)),
...
]
This is optional. Actually, you can include your own URLs.
Features
--------
* Generic File model so you can store different kinds of files, images,
etc, using a single model;
* Attach/Detach the file model to other models
* Cool descriptor, so you don't have to keep mangling GenericForeignKeys
inside your models.
Usage
-----
1. First of all, define your first model
:: python
from file_context.managers import Files
class MyModel(models.Model):
name = models.CharField(max_length=128)
files = Files()
2. That's it.
3. You can use the Files API to attach files to MyModel instances, using:
:: python
uploaded_file = File.objects.get(pk=1)
a = MyModel.objects.create(name='foo')
a.files.attach(uploaded_file)
a.files.detach(uploaded_file)
a.files.clear()
Running Tests
-------------
Does the code actually work?
::
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox
Credits
-------
Tools used in rendering this package:
* Huge props to django-taggit that inspired me to do the descritor
idea!
* Cookiecutter_
* `cookiecutter-djangopackage`_
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage
History
-------
0.1.0 (2017-10-25)
++++++++++++++++++
* First release on PyPI.
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
django-file-context-0.2.3.tar.gz
(10.4 kB
view hashes)
Built Distribution
Close
Hashes for django-file-context-0.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4db4f90ad0833a73275e5f617bc8e58d34ab85a5c9cec6c56d1638239c2fb95a |
|
MD5 | 407ff385d22e19a3bc88b94242108ba7 |
|
BLAKE2b-256 | 39328474a36e5d3836f520a219f9b39c8943ff361a0729a89fa59e0816391a92 |
Close
Hashes for django_file_context-0.2.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 710e660b13edc3eee6760d789a0870d2c7811abb3a052c8220d54fcefba324e4 |
|
MD5 | 2a9d23231725a14e272bfccd88a51fa6 |
|
BLAKE2b-256 | cb74c01686c136c91c7153c834b793a88d1a5978c4fd21a97baa5bf39b51ab56 |