Skip to content

A django library for Model's __repr__ to be more informative

License

Notifications You must be signed in to change notification settings

relip/django-model-repr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-model-repr

django-model-repr is a django library that overrides Model's __repr__ and provides more detailed information with less effort.

Installation

pip install django-model-repr

Add django_model_repr in top of INSTALLED_APPS in your settings.py:

INSTALLED_APPS = (
  "django_model_repr",
  # ...
  # ...
)

This library monkey-patches the django standard library django.db.models.Model. It means libraries like django.contrib.auth inherit django.db.models.Model to create their own models, putting django_model_repr somewhere in the middle of the INSTALLED_APPS can cause errors.

Output

<User
    id: 2
    password: bcrypt_sha256$
    last_login: 2016-05-14 11:44:13.067599+00:00
    is_superuser: True
    email: [email protected]
    is_staff: True
    is_active: True
    date_joined: 2016-04-30 18:35:18.032927+00:00
    name:
    password_hint:
    groups: auth.Group.None
    user_permissions: auth.Permission.None
>

Settings

MODEL_REPR_MONKEY_PATCHING

Default: True

By default, it monkey-patches automatically when initializing. Setting this to False you can manually choose which model to be overrided. Import django_model_repr.models.Model and change your model to inherit it.

About

A django library for Model's __repr__ to be more informative

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages