Big list of Django tips
Django snippets: Welcome - 0 views
Django snippets: Updated version of #31 - 0 views
QuerySetManager - 4 views
Big list of Django tips (and some python tips too) | Surfing in Kansas - 0 views
-
-
Writing managers is really simple, and they provide a better user interface to your code. This code snippet simply adds a latest() method to the default objects manager class ForecastDayManager(Manager): def __init__(self, *args, **kwargs): super(ForecastDayManager, self).__init__(*args, **kwargs) def latest(self): return self.get_query_set().order_by('forecast_date')[0] It can be called ForecastDay.objects.latest(). This is a trivial example, but there is a lot of power that lies in this functionality.
Tumblelog in Django - 0 views
1 - 8 of 8
Showing 20▼ items per page