Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > HTTP (WWW)

    django-generic-helpers 0.2.2

    Download button

    No screenshots available
    Downloads: 185  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    marazmiki | More programs
    MIT/X Consortium Lic... / FREE
    July 4th, 2012, 12:35 GMT
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    django-generic-helpers description

    This app makes it easy to display a map for a given address

    django-generic-helpers is a Django app that provides some snippets (such as abstract models and managers with some useful methods) to simplyfy creation of another pluggable apps.

    Installation:

    pip install django-generic-helpers

    After you can add app 'generic_helpers' to your INSTALLED_APPS. If you aren't want to run test, you can skip this step.

    Usage:

    To use this app, just import GenericRelationModel class from generic_helpers.models package and inherit your model from it:

     from django.db import models from generic_helpers.models import GenericRelationModel

     class MyModel(GenericRelationModel):
     title = models.CharField(max_length=255)


    Now MyModel class has content_object attribute and you can create MyModel instances using generic relation:

     >>> from django.contrib.auth.models import User
     >>> user = User.objects.get(pk=1)
     >>>
     >>> my_model = MyModel.objects.create(
     ... title = 'title',
     ... content_object = user,
     ... )
     >>>


    In this example how you can see we have used User.

    Also your model manager has a get_for_object method for quick filtering by content_object complex field:

     >>> from django.contrib.auth.models import User
     >>> user = User.objects.get(pk=1)
     >>>
     >>> models_for_user = MyModel.objects.get_for_object(user)
     >>>


    Contributing

    If you've found a bug, implemented a feature and think it is useful, or you've own pluggable app and want to use django-generic-helpers in it, then please consider contributing. Patches, pull requests or just suggestions are welcome!


    Product's homepage

    Requirements:

    · Python
    · Django

      


    TAGS:

    generic helpers | address map | Django | generic | helpers

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM