{
"info": {
"author": "Vieolo O\u00dc",
"author_email": "info@vieolo.com",
"bugtrack_url": null,
"classifiers": [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.6"
],
"description": "`Django_hint` is a module to help you type hint your django project to work with different IDEs.\n\n```\nNotice: Python3.6 or later is required for this module\n```\n
\n\n## Installation\nYou can use the `pip` to install django_hint\n\n```\npip3 install django_hint\n```\n\n## Usage\nThe following use cases can be type hinted using `django_hint` to help your IDE recognize the type of variable.\n1. Database QuerySet\n2. WSGIRequest\n3. Django-Rest-Framework Token Authentication\n4. Model Class\n\nAs a bonus, all of the native python type hints such as `List`, `Union`, `Optional` etc. from `typing` module can be imported from `django_hint`\n\n## Database QuerySet\nIt is used to hint that the variable is an `QuerySet` object containing multiple objects whose nature we will determine.
\nYou need to hint it to `QueryType` and pass the object type inside the `[]`. Example:\n```python\nfrom django_hint import QueryType\n\nsample_query: QueryType[SampleModel] = SampleModel.objects.filter(name='sample')\n```\n\nThe `sample_query` variable will be treated as a `QuerySet`. While looping through the objects, each object will be treated as a `SampleModel`\n\n## WSGIRequest\nIt is used to hint the nature of the `request` argument of the view (both function and class based). \nThe `request` will be treated as a `HttpRequest` having the `user` variable attached to it. Example:\n```python\nfrom django_hint import RequestType\n\ndef sample_view(request: RequestType):\n if request.user.is_authenticated:\n print(request.POST.get('data'))\n```\n\n## Django-Rest-Framework Token Authentication\nIf you are using the token authentication of the `Django-Rest-Framework`, the request object will have a `user` variable and an `auth` variable of `rest_framework.authtoken.models.Token` instance. `DRFTokenRequestType` will hint the IDE of those two variables.\n\n```python\nfrom django_hint import DRFTokenRequestType\n\ndef sample_view(request: DRFTokenRequestType):\n print(request.auth.key)\n```\n\n## Model Class\nDjango adds a few attributes to a `Model` instance which are not available in the `models.Model` and will not be available in your IDE. \nThe most notable attribute is the `Manager` which is accessible via an attribute called `objects`.
\nTo include these attributes in your IDE, You have to extend your model to the `StandardModelType` class of `django_hint` as well as `models.Model` and use it just like any other model class.
\nNote that `StandardModeltype` will NOT have any effect on your database and will NOT make new migrations on `makemigrations` command.\n\n```python\nfrom django.db import models\nfrom django_hint import StandardModelType\n\nclass SampleModel(models.Model, StandardModelType):\n \"\"\"Just like any other model\"\"\"\n pass\n```\n\n\n\n\n",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/Vieolo/django-hint",
"keywords": "",
"license": "",
"maintainer": "",
"maintainer_email": "",
"name": "django-hint",
"package_url": "https://pypi.org/project/django-hint/",
"platform": "",
"project_url": "https://pypi.org/project/django-hint/",
"project_urls": {
"Homepage": "https://github.com/Vieolo/django-hint"
},
"release_url": "https://pypi.org/project/django-hint/0.1.5/",
"requires_dist": null,
"requires_python": "",
"summary": "Typehinting package for django",
"version": "0.1.5"
},
"last_serial": 5660998,
"releases": {
"0.1.0": [
{
"comment_text": "",
"digests": {
"md5": "b5610eaebe75837eb860f8970222eead",
"sha256": "96ecec1d7f371762d7f693cdfec50ef329345a895ec0e0db7231c985e4551c8d"
},
"downloads": -1,
"filename": "django_hint-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b5610eaebe75837eb860f8970222eead",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6644,
"upload_time": "2019-08-05T22:57:48",
"url": "https://files.pythonhosted.org/packages/94/1e/bbb10dbffc474a48230d2c6ef2f5cbb1cead875fa6bc4bc47896ef4c763e/django_hint-0.1.0-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "dd8e8140dc7c2db85e3db95dc3786012",
"sha256": "141df4cd5ddaf7a56874beecdf3fbe4ac07ddfd08994c972352cf6306f5820fa"
},
"downloads": -1,
"filename": "django_hint-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "dd8e8140dc7c2db85e3db95dc3786012",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3772,
"upload_time": "2019-08-05T22:57:50",
"url": "https://files.pythonhosted.org/packages/02/15/5a9215b3335456bdf15d33098040672a0cf96b337bd7c0a43ba9b63afadd/django_hint-0.1.0.tar.gz"
}
],
"0.1.2": [
{
"comment_text": "",
"digests": {
"md5": "5be56a9cdc151920bdb39547cf55b0ac",
"sha256": "1d946a71cd62ca8cf6fef25352b8f01dcf5aeb0798eebea01bcce1677fc61dfe"
},
"downloads": -1,
"filename": "django_hint-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5be56a9cdc151920bdb39547cf55b0ac",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6765,
"upload_time": "2019-08-10T20:34:06",
"url": "https://files.pythonhosted.org/packages/34/d5/dd0fbc7f0932680353cdd551dc9c9f171ddc0adf754ebac4428535c190c2/django_hint-0.1.2-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "6a9861edc97aaf5db8d362e9a7f838a8",
"sha256": "5cc713c33583c41ca5ad9b1c7dd2258f328b219fcda099260cad8a609deaf6a0"
},
"downloads": -1,
"filename": "django_hint-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "6a9861edc97aaf5db8d362e9a7f838a8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3878,
"upload_time": "2019-08-10T20:34:07",
"url": "https://files.pythonhosted.org/packages/3b/4f/924fd314adfd83a3bad2232ed253ea70c34e4e58a4878d669ed0cd2fc178/django_hint-0.1.2.tar.gz"
}
],
"0.1.5": [
{
"comment_text": "",
"digests": {
"md5": "2c78058c9febcd987985ef1464b949f3",
"sha256": "3fcb945008b35cfee621def845fc06d052c1ff934c4828233430393872d2b720"
},
"downloads": -1,
"filename": "django_hint-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c78058c9febcd987985ef1464b949f3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7044,
"upload_time": "2019-08-11T04:48:01",
"url": "https://files.pythonhosted.org/packages/5b/e8/b09f4694dd462f2ac7f4b1200542862b0b4d38f593e1dd5c03fb23500758/django_hint-0.1.5-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "e9090863ff1ab26a0cf66ec2347f099f",
"sha256": "42bc3b40522759a3f55112d008d724c5d9f3b9f4da3002c04ea785e4688f97b8"
},
"downloads": -1,
"filename": "django_hint-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "e9090863ff1ab26a0cf66ec2347f099f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4169,
"upload_time": "2019-08-11T04:48:03",
"url": "https://files.pythonhosted.org/packages/ef/b6/80109866c80d14c57f25a58f3a100460ba71c6f97d7e939b0080b9830169/django_hint-0.1.5.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "2c78058c9febcd987985ef1464b949f3",
"sha256": "3fcb945008b35cfee621def845fc06d052c1ff934c4828233430393872d2b720"
},
"downloads": -1,
"filename": "django_hint-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c78058c9febcd987985ef1464b949f3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7044,
"upload_time": "2019-08-11T04:48:01",
"url": "https://files.pythonhosted.org/packages/5b/e8/b09f4694dd462f2ac7f4b1200542862b0b4d38f593e1dd5c03fb23500758/django_hint-0.1.5-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "e9090863ff1ab26a0cf66ec2347f099f",
"sha256": "42bc3b40522759a3f55112d008d724c5d9f3b9f4da3002c04ea785e4688f97b8"
},
"downloads": -1,
"filename": "django_hint-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "e9090863ff1ab26a0cf66ec2347f099f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4169,
"upload_time": "2019-08-11T04:48:03",
"url": "https://files.pythonhosted.org/packages/ef/b6/80109866c80d14c57f25a58f3a100460ba71c6f97d7e939b0080b9830169/django_hint-0.1.5.tar.gz"
}
]
}