文件上下文提供了存储不同文档/附件的简单方法
django-file-context的Python项目详细描述
=========
django文件上下文图片::https://gitlab.sigmageosistemas.com.br/dev/django文件上下文/badges/master/coverage.svg
…图片::https://gitlab.sigmageosistemas.com.br/dev/django文件上下文/badges/master/pipeline.svg
…图片::https://readthedocs.org/projects/django-file-context/badge/?version=latest
文件上下文提供了存储不同文档/附件的简便方法
django文件上下文
将其添加到“已安装的应用程序”中:
…代码块::python
installed_apps=(
…
'file_context.apps.filecontextconfig',
…
)
您需要将其添加到已安装的_apps中,因为我们有自己的
模型。
add django file context的url模式:
代码块::python
从文件上下文导入url作为文件上下文url
urlpatterns=[
…
url(r'^',include(文件上下文url)),
…
]
实际上,您可以包含自己的url。
功能
--
*通用文件模型,这样您可以使用单个模型存储不同类型的文件、图像、
等;
*将文件模型附加/分离到其他模型
*很酷的描述符,因此,您不必一直在模型中损坏通用外键。首先,定义您的第一个模型
::python
来自文件上下文。管理器导入文件
2。就这样。
3.您可以使用files api将文件附加到mymodel实例,使用:
::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
----
::
source<;yourvirtualenv>;/bin/activate
(myenv)$pip install tox
(myenv)$tox
credits
----
呈现此包时使用的工具:
*django taggit的巨大道具,激发了我的创作灵感!
*炊具包_ Cookiecutter:https://github.com/audreyr/Cookiecutter
。_` Cookiecutter DjangoPackage`:https://github.com/pydanny/Cookiecutter DjangoPackage
----
<0.1.0(2017-10-25)
++++++++++++++
django文件上下文图片::https://gitlab.sigmageosistemas.com.br/dev/django文件上下文/badges/master/coverage.svg
…图片::https://gitlab.sigmageosistemas.com.br/dev/django文件上下文/badges/master/pipeline.svg
…图片::https://readthedocs.org/projects/django-file-context/badge/?version=latest
文件上下文提供了存储不同文档/附件的简便方法
django文件上下文
将其添加到“已安装的应用程序”中:
…代码块::python
installed_apps=(
…
'file_context.apps.filecontextconfig',
…
)
您需要将其添加到已安装的_apps中,因为我们有自己的
模型。
add django file context的url模式:
代码块::python
从文件上下文导入url作为文件上下文url
urlpatterns=[
…
url(r'^',include(文件上下文url)),
…
]
实际上,您可以包含自己的url。
功能
--
*通用文件模型,这样您可以使用单个模型存储不同类型的文件、图像、
等;
*将文件模型附加/分离到其他模型
*很酷的描述符,因此,您不必一直在模型中损坏通用外键。首先,定义您的第一个模型
::python
来自文件上下文。管理器导入文件
2。就这样。
3.您可以使用files api将文件附加到mymodel实例,使用:
::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
----
::
source<;yourvirtualenv>;/bin/activate
(myenv)$pip install tox
(myenv)$tox
credits
----
呈现此包时使用的工具:
*django taggit的巨大道具,激发了我的创作灵感!
*炊具包_ Cookiecutter:https://github.com/audreyr/Cookiecutter
。_` Cookiecutter DjangoPackage`:https://github.com/pydanny/Cookiecutter DjangoPackage
----
<0.1.0(2017-10-25)
++++++++++++++