Package: lck.django
This library consists of various Django-related routines that extend or modify
the behaviour of the framework:lots of composable abstract models to usea user activity log app storing users’ IP addresses and user agents (useful
for hunting down multi-accounts)ascoreapp enabling users on websites to vote on objectsatagsapp which supports tagging by users and localized tagsabadgesapp which enables users to receive badges for actions on the
websiteextensions forsettings.py(current directory resolution, namespace
package support, settings profile support)typical filters, template tags, form fields, etc.Complete documentation for the package can be found here:http://packages.python.org/lck.django/The latest version can be installed viaPyPI:$ pip install lck.djangoor:$ easy_install lck.djangoThesource code repositoryandissue
trackerare maintained onGitHub.This package bundles some royalty free static images that are useful in almost
every Django project:Silk icons 1.3 by FamFamFam- requires attributing the authorSilk Companion 1 by Damien Guard- requires
attributing the authorCountry Flags by SenojFlags.com- requires
using the following HTML:<a href="http://www.senojflags.com">Country flag</a> image from
<a href="http://www.senojflags.com">Flags of all Countries</a>For the curious,lckstands for LangaCore Kit. LangaCore is a one man
software development shop of mine.Note:lck.commonrequiresPython 2.7because all of its code is using
the so-called four futures (absolute_imports,division,print_functionandunicode_literals). One of the virtues in the creation of this library
is to make the code beautiful. These switches give a useful transitional
state between the old Python 2.x and the new Python 3.x. You should use them as
well.Note:Since 0.5.0lck.djangorequiresDjango 1.3because
it makes my monkey-patching efforts much easier. Moreover, 1.3 nicely deprecates
behaviour which I consider ugly.How to run the testsThe easiest way would be to run:$ DJANGO_SETTINGS_MODULE="lck.dummy.settings" DJANGO_SETTINGS_PROFILE="test" django-admin.py testThis command runs the internal Django tests as well and that’s fine because
there are monkey patches and other subtleties that should better be tested for
potential breakage.The dummy project is also used as an example of setting up a Django project.
However, it seems Django tests are not happy with some changes to the settings
so we’re using thetestprofile (which loads overrides fromsettings-test.py) to avoid that.Change Log0.8.10profilenow properly rolls back a failed transaction increate_a_user_profile_ignoring_dberrors()(fixes initial syncdb’s
superuser creation on PostgreSQL)introduced automatic resolution of dependencies for initial migration.  If
you useactivitylog,badges,scoreortags, unless you’re
using the plainauth.User, their initial migrations depend on your
profile module being ready. Migrations currently depend on the initial
migration of your respectiveACTIVITYLOG_PROFILE_MODEL,EDITOR_TRACKABLE_MODEL,SCORE_VOTER_MODELorTAG_AUTHOR_MODEL. If
those migrations should depend on a different migration or none, new settings
have been added.0.8.9fixed a regression from 0.8.8 in synchronousactivitylogmodelsdj.choicesrequirement bumped to 0.9.2 (support for Python 2.6 - 3.3)dj.chainrequirement bumped to 0.9.2 (support for Python 2.7 - 3.3)0.8.8activitylognow properly encloses database updates in transactionsactivitylogon RQ and Celery now properly handles non-null constraints on
modelsSessionAwareLanguageMiddlewaresimplified, now simply sets the language
argument in the session. This requires changing middleware order: this
middleware should come afterSessionMiddlewareand beforeLocaleMiddleware.The defaultINSTRUMENTATION_RULEis now simplylambda request: Falsewhich makesTimingMiddlewarebehave better with front-end caches (if
session is not accessed,Vary: Cookieis not set).0.8.7activitylognow sports new async modes with built-in support for RQ or
Celery workersminor performance updates intagsmodels0.8.6minor performance updates inactivitylogmiddleware. Now behaves better
in low-memory + slow I/O environments.0.8.5whoismanagement command introduced to help find users by session IDusingUserattributes proxied from aProfileinstance no longer
causes a query for each call0.8.4TimeTrackablemodels can now force marking fields as dirty withmark_dirty()andmark_clean()methods0.8.3concurrent_get_or_createwill now raise AssertionErrors if given either
too many fields (e.g. not all of which are unique or compose
a unique-together constraint) or too few (e.g. fields do not form a whole
unique-together constraint). Non-unique fields should be passed in thedefaultskeyword argument if needed at object creation time.profilenow implements automatic profile account synchronization by
registering a post-save signal on User and creating anAUTH_PROFILE_MODELinstance. A management command for existing applications calledsync_profileshas been created.Unit tests converted to unittest2 format0.8.2fixed regression from 0.8.1: removed savepoint support since the updatedconcurrent_get_or_createfails miserably on MySQL due to dogdy savepoint
support inMySQL-python0.8.1concurrent_get_or_createbased onget_or_createfrom Django 1.4.2namespace_package_supportextended to coverdjango.utils.translationas well (previously namespace-packaged projects only worked with I18N ifsetup.py developorpip install-e.was used to install them)dj.chainrequirement bumped to 0.9.1 (supports more collective methods)0.8.0lazy_chainmoved to a separatedj.chainpackage. The old interface is thus
deprecated and will be removed in a future version.activitylogupdates: removed redundant user fields so it works again withACTIVITYLOG_PROFILE_MODELset toauth.UserEditorTrackabledoesn’t require overridingget_editor_from_requestanymore ifEDITOR_TRACKABLE_MODELis set to a profile model instead ofauth.Userprofile admin module includes a predefinedProfileInlineFormSetfor
inclusion of profile-tied models to theUserAdminas inlinesthe dummy application now passes all internal Django unit tests in versions
1.4.0 - 1.4.20.7.14lazy_chain: the fix from 0.7.13 introduced a different kind of bug,
reverted and fixed properly now. More tests included.flatpagesnow serve content in the default language if the language
requested by the browser is unavailable.some internal cleanups0.7.13lazy_chain: when iterating over a slice, the iterator fetched one item too
many. It didn’t yield it back so the result was correct but if usingxfilter()that caused unnecessary iteration.dj.choicesrequirement bumped to 0.9.0 (choices areintsubclasses,unicode(choice)is now equivalent tochoice.desc)0.7.12namespace package support now works with Unicode literals in settings.pydummy app settings refinements: timing middleware moved down the stack because
it uses the user session, WSGI app definition was wrong0.7.11No code changesdj.choicesrequirement bumped to 0.8.6 (fully compatible with
0.8.5 and significantly improvesChoiceFields)0.7.10BACKLINKS_LOCAL_SITESsetting to control if all configured sites should be
considered local upon backlink discoveryMore backlink fixes data model fixes to make it more cross-compatible with
different backends0.7.9Fixed backlink hash generation inactivitylogactivitylogaccepts UTF-8 characters inUser-AgentheadersactivitylogSouth migration #0002 now also works on backends with DDL
transactions (e.g. Postgres)0.7.8Fixed South support for custom fields (DefaultTagsandMACAddressField).0.7.7South migrations supported across the board. For existing installations you
should run:$ python manage.py migrate APP_NAME 0001 --fake
$ python manage.py migrate APP_NAMEwhereAPP_NAMEisactivitylog,badges,common,flatpages,profile,scoreortags.uniqueness constraints inactivitylog.models.Backlinkandactivitylog.models.UserAgentmoved to separatehashfields to make
MySQL happy. South migrations should handle schema evolution regardless of the
backend you’re using.0.7.6Further Django 1.4 compatibility improvements: auto-compelete foreign key
mixin works correctly now0.7.5Django 1.4 compatibility improved0.7.4Django 1.4USE_TZ = Truecompatibilityexample settings updated to support new Django 1.4 settingsUserattribute proxying inProfilemodels rewritten to support all
built-in and custom attributes on theUsermodelactivitylog.middlewarenow records IPs and user agents for unauthenticated
requests as well.  Possibly a performance hit.0.7.3Addedorder_byargument to TagStem.objects.get_content_objects()0.7.2choices moved to a separatedj.choicespackage. The old interface is thus
deprecated and will be removed in a future version.0.7.1fixed a regression from 0.7.0 inlck.django.scoreafter cleaning up helpers0.7.0lck.django.badgesintroducedlck.django.commoncleaned up,lazy_chainsignificantly upgraded (now
properly supports multiple iterables with filtering, slicing and sorting)0.6.7lck.django.score: send a signal on total score change (allows for caching
strategies on the app side)maxidmanagement command introduced: for every registered model returns
the current maximum value for primary keys0.6.6MACAddressFieldMAC address normalization ignores empty values, supports
Cisco0000.0000.0000notation and fixes a minor regression from 0.6.5SessionAwareLanguageMiddlewareintroduceda convenient tag getter for taggables, improved compatibility withEditorTrackable0.6.5more rigorous normalization of MAC addresses inMACAddressField0.6.4ImageModelintroducedNamedmodels name field extended to 75 characters of length0.6.3fixed an embarassing bug with the human-readabletimedifffilter0.6.2MACAddressFieldnormalization bug fixed0.6.1buttonable Django admin withModelAdmin“Edit separately” links for ForeignKey fields supported inModelAdmincompressingPyLibMCCachebackend inlck.django.cache_backendsbacklinks support inactivitylogimages crushed and optimizeduse Pillow instead of PIL0.6.0Oh boy, lots of changes!TimeTrackablejust got a lot smarter. Includescache_versionattribute automatically updated on significant changes to the object.modifiedgets updated only when there are actual changes to the object.dirty_fieldsproperty shows changed attributes from last save (works also
for objects composed from multiple models, including abstract ones).Inspired by David Cramer and Simon Willison at EuroPython 2011.The dogpile-safelck.django.cachenow supports custom invalidators which
enables invalidation not only by time but also by e.g. model changes (thinkTimeTrackable.cache_version).Settings profile support now requires a modifiedmanage.pyscript in the
Django project. This is forced by the unfortunate design of how Django loads
settings.Activity logging moved to its own app,lck.activitylog, which now also
tracks IPs and user agents of logged-in visitors (useful in hunting
multi-accounts).Introduced aSavePrioritizedabstract model which adds priorities to
saves on models. Various parts of the application can specify which priority
they use. If they update an attribute which was first saved by something with
higher priority, the update is silently ignored.Introduced a concurrency-aware variant of the popularModel.objects.get_or_create(unsurprisingly calledconcurrent_get_or_create)Introduced acommit_on_successvariant that supports nesting
(unsurprisingly callednested_commit_on_success)IntroducedBasicAuthMiddlewarefor simplistic private URL protecting.EditorTrackableis now safe in terms of foreign key cascading (content
authored or modified by a user won’t get deleted after this user is removed
from the DB). Plus some nice admin refinements.NowTimingMiddlewaredoesn’t break other middlewares usingprocess_view()and is generally smarter.AddedX-Sloheader in responses forTimingMiddleware.render()now calculates and emits ETags based on the rendering output.typical_handler()can nowredirect_on_success.Links from the BBCode filter now open in a new window and haverel="nofollow"set.Introduced a{%settings KEY%}templatetag.Introduced a{%git_version%}templatetag which returns a short string
useful to present as an app version. This is based on the latest commit in
the Git repository where the Django project lies in.Thecycle_filtertemplate filter now supports explicit counter settings
and incrementation.Introduced template filters converting to and from Base64.Introduced JQuery UI and JQueryMobile integrated radio widgets.Improved documentation.More complete translations.0.5.8SimplisticTimingMiddlewareintroduced.Profiles based onBaseProfilenow returnselfforget_profile().Trophy icons added.Console tag library introduced with the {%color%} tag.Allow rendering non-request contexts.Choices.ToNamesdecorator introduced.Pre-importing inmanage.py shellworks also for models with
a custom``app_model``.0.5.7EditorTrackableintroducedChoices can be rendered in grouped form. Currently requires adding'--keyword=Group:2'to xgettext invocations in
django/core/managemenet/commands/makemessages.py. Cleaning that up is planned
for 0.6.0.typical_handlerworks now with forms w/o asave()methodupperfirstfilter introduced: ups only the first characterSquare thumbnails for wide images now work properlymoved contents of helpers to common (enables i18n and cleans up the API), the
helpers module is therefore deprecatedsome i18n updates0.5.6in the thumbnail filter, support for automatic cropping to square introducedminor translation updates0.5.5group members inherit shifted attributes0.5.4minor updates toPolishDateWidget0.5.3AvatarSupportabstract model for custom avatars.GravatarSupportcan
be used as fallback or independently.typical_handlernow properly supports file uploadsbugfixes: objects without any score don’t cause exceptions anymoreleftovers from namespace changes cleaned up0.5.2monkey patches of core Django annotated and regrouped for easier management in
the future (yup, more to come)a stats calculatorminor bugfixes0.5.1tags now support models with custom managersfor Named and Titled models a read-onlyname_urlencodedandtitle_urlencodedproperties were introduced. Useful as arguments in
template tags.support for setting additional attributes on choices using an unholy<<operator overloadin tags, support for getting objects marked with specific stems0.5.0migrated to thelcknamespace fromlangacore.kitmigrated licensing from GPL 3 to MITbumped the trove from alpha status to beta, the code is in production for over
a year nowAncient historyNo proper change log was kept before 0.5.0