=============================
acdh-django-handle
=============================
.. image:: https://badge.fury.io/py/acdh-django-handle.svg
:target: https://badge.fury.io/py/acdh-django-handle
A django app to create and manage handle-pids_.
Quickstart
----------
Install acdh-django-handle::
pip install acdh-django-handle
Add it to your `INSTALLED_APPS`:
.. code-block:: python
INSTALLED_APPS = (
...
'handle',
...
)
Provide a handle-config dict:
.. code-block:: python
HANDLE = {
'resolver': "http://hdl.handle.net",
'user': "your handle-provider user",
'pw': "your handle-provider password",
'url': "base url to your handle-provider api",
'app_base_url': "the base url of your application"
}
example:
.. code-block:: python
HANDLE = {
'resolver': "http://hdl.handle.net",
'user': "user11.1234567-01",
'pw': "password1234",
'url': "http://pid.gwdg.de/handles/11.1234567-01/",
'app_base_url': "https://myproject.com"
}
The value of `app_base_url` will be concaneted with the value of the `get_absolute_url` method of the model instance you want to register a handle for.
And run
python manage.py migrate handle
Create/register handle-pids
----
The package provides a management command to bulk create/register handle-pids. For this you'll have to
* add a `GenericRelation` property to the model class you would like register handles for
* and make sure you have a `get_absolute_url` method defined
.. code-block:: python
from django.contrib.contenttypes.fields import GenericRelation
from handle.models import Pid
...
class Example(models.Model):
name = models.CharField(
max_length=255, blank=True,
)
...
pid = GenericRelation(Pid, blank=True, null=True, related_query_name="get_pid")
...
def get_absolute_url(self):
return reverse('example_detail', kwargs={'pk': self.id})
To register/create handle-pids run:
python manage.py crate_handles example
In case your GenericRelation property is named something else than `pid` you need to pass in the name as second argument, e.g:
python manage.py crate_handles example --pid=<name>
Handle-Pids will only be crated for objects which do not have a handle-pid yet.
Features
--------
* Provides a `Pid` class which stores
* a handle-pid
* creation and modification date
* a generic relation to any other class of your django project.
* an overidden save-method which will register/create a handle-pid on save in case you didn't provide a handle-pid
* Provides a `handle.utils.create_handle` function to register/create a new handle-pid
* Register/Create handle-pid for any objects in your project via admin-interface.
* Provides a management command to bulk create/register handle-pids for all instances of a model-class in your project.
Build and publish
-----
.. code-block:: console
python setup.py sdist bdist_wheel
twine upload dist/*
Credits
-------
Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-djangopackage`_
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage
.. _handle-pids: http://www.handle.net/
History
-------
0.1.0 (2018-06-28)
++++++++++++++++++
* First release on PyPI.
acdh-django-handle
=============================
.. image:: https://badge.fury.io/py/acdh-django-handle.svg
:target: https://badge.fury.io/py/acdh-django-handle
A django app to create and manage handle-pids_.
Quickstart
----------
Install acdh-django-handle::
pip install acdh-django-handle
Add it to your `INSTALLED_APPS`:
.. code-block:: python
INSTALLED_APPS = (
...
'handle',
...
)
Provide a handle-config dict:
.. code-block:: python
HANDLE = {
'resolver': "http://hdl.handle.net",
'user': "your handle-provider user",
'pw': "your handle-provider password",
'url': "base url to your handle-provider api",
'app_base_url': "the base url of your application"
}
example:
.. code-block:: python
HANDLE = {
'resolver': "http://hdl.handle.net",
'user': "user11.1234567-01",
'pw': "password1234",
'url': "http://pid.gwdg.de/handles/11.1234567-01/",
'app_base_url': "https://myproject.com"
}
The value of `app_base_url` will be concaneted with the value of the `get_absolute_url` method of the model instance you want to register a handle for.
And run
python manage.py migrate handle
Create/register handle-pids
----
The package provides a management command to bulk create/register handle-pids. For this you'll have to
* add a `GenericRelation` property to the model class you would like register handles for
* and make sure you have a `get_absolute_url` method defined
.. code-block:: python
from django.contrib.contenttypes.fields import GenericRelation
from handle.models import Pid
...
class Example(models.Model):
name = models.CharField(
max_length=255, blank=True,
)
...
pid = GenericRelation(Pid, blank=True, null=True, related_query_name="get_pid")
...
def get_absolute_url(self):
return reverse('example_detail', kwargs={'pk': self.id})
To register/create handle-pids run:
python manage.py crate_handles example
In case your GenericRelation property is named something else than `pid` you need to pass in the name as second argument, e.g:
python manage.py crate_handles example --pid=<name>
Handle-Pids will only be crated for objects which do not have a handle-pid yet.
Features
--------
* Provides a `Pid` class which stores
* a handle-pid
* creation and modification date
* a generic relation to any other class of your django project.
* an overidden save-method which will register/create a handle-pid on save in case you didn't provide a handle-pid
* Provides a `handle.utils.create_handle` function to register/create a new handle-pid
* Register/Create handle-pid for any objects in your project via admin-interface.
* Provides a management command to bulk create/register handle-pids for all instances of a model-class in your project.
Build and publish
-----
.. code-block:: console
python setup.py sdist bdist_wheel
twine upload dist/*
Credits
-------
Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-djangopackage`_
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage
.. _handle-pids: http://www.handle.net/
History
-------
0.1.0 (2018-06-28)
++++++++++++++++++
* First release on PyPI.
Release files for acdh-django-handle 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| acdh-django-handle-0.1.1.tar.gz | 9.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| acdh_django_handle-0.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 20.4 kB
Release files / acdh-django-handle-0.1.1.tar.gz
| Download URL | acdh-django-handle-0.1.1.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d425e69dccbfc2f974288caf953bfb3721c509168464b01f419cc27eefb2b26
|
|
BLAKE2b-256 checksum How to use checksums |
4783e8095b30adf193a80ab3105e76d843e764e61d800e5c77798731f7af2f24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / acdh_django_handle-0.1.1-py2.py3-none-any.whl
| Download URL | acdh_django_handle-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
322b086ad2a458eb3d18d088e042d9d0186aac211f35e38873c6826cbc6188eb
|
|
BLAKE2b-256 checksum How to use checksums |
78083f3160f447f2cb6c6bdef58ff98bdb293217dcc87dff34c13fa0745ab67c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |