Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

add annotations at django models fields

Project description

when model definition

import django_modelhint as d
d.get_default_mapping().add_reserved_words(doc="")

class Group(models.Model):
    name = d.CharField(max_length=255, verbose_name="Name", doc="名前")

class User(models.Model):
    group = d.ForeignKey(Group)
    name = d.CharField(max_length=255, verbose_name="Name", doc="名前")

when view

import django_modelhint as d
user = User.objects.get()
d.get_mapping(user)  # => ChainMap({}, {'name': ChainMap({}, {'doc': '名前'}), 'id': ChainMap({}, {'doc': ''}), 'group': ChainMap({}, {'doc': ''})})
d.get_mapping(user)["name"]["doc"]  # => '名前'

group = Group.objects.get()
d.get_mapping(group.user_set)  # => ChainMap({}, {'name': ChainMap({}, {'doc': '名前'}), 'id': ChainMap({}, {'doc': ''}), 'group': ChainMap({}, {'doc': ''})})

Project details


Release history Release notifications

This version
History Node

0.1.1.1

History Node

0.1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-modelhint-0.1.1.1.tar.gz (3.6 kB) Copy SHA256 hash SHA256 Source None Mar 21, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page