GithubHelp home page GithubHelp logo

idlesign / django-etc Goto Github PK

View Code? Open in Web Editor NEW
38.0 5.0 1.0 139 KB

Tiny stuff for Django that won't fit into separate apps.

Home Page: https://github.com/idlesign/django-etc

License: BSD 3-Clause "New" or "Revised" License

Python 99.30% HTML 0.70%
python django miscellaneous utils gravatar

django-etc's Introduction

django-etc

https://github.com/idlesign/django-etc

Description

Tiny stuff for Django that won't fit into separate apps.

Utils

  • etc.toolbox.get_site_url does its best to provide you with a site URL whether request object is available or not.
  • etc.toolbox.import_app_module imports and returns a module from a specific app by its name.
  • etc.toolbox.import_project_modules imports modules from registered apps using given module name and returns them as a list.

Models

  • etc.toolbox.InheritedModel allows to override fields attributes in inherited models.
  • etc.toolbox.get_model_class_from_string allows getting model class from its string representation.
  • etc.toolbox.get_model_class_from_settings allows getting model class from its string representation in settings module.
  • etc.toolbox.ChoicesEnumMixin helps to define choices for models using Enum from Python 3.
  • etc.toolbox.choices_list helps to define choices for models, that could be addressed later as dictionaries.
  • etc.toolbox.get_choices returns model field choices from a given choices list.

Admin

  • etc.admin.CustomModelPage allows easy construction of custom admin pages processing user input.

Forms

  • etc.toolbox.set_form_widgets_attrs allows bulk apply HTML attributes to every field widget of a given form.

Template tags

  • model_field:
    • model_field_verbose_name returns model field verbose name.
    • model_field_help_text returns model field help text.
  • model_meta:
    • model_meta_verbose_name returns model verbose name singular.
    • model_meta_verbose_name_plural returns model verbose name plural.
  • gravatar
    • gravatar_get_url returns Gravatar image URL for a given string or UserModel.
    • gravatar_get_img returns Gravatar image HTML tag for a given string or UserModel.
  • etc_misc
    • site_url does its best to provide you with a site URL whether request object is available or not.
    • include_ allows a template name to include template variables. Allows fallback template if the target is not found.

Documentation

http://django-etc.readthedocs.org/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.