Quantcast
Channel: python | Laurence Gellert's Blog
Browsing all 6 articles
Browse latest View live

Python Strategy Pattern

The strategy pattern can be a nice way to improve flexibility when accessing external resources. For example an application might have images referenced in Flickr and a relational database. You want to...

View Article



Image may be NSFW.
Clik here to view.

Example Django Model Count and Group By Query

The Django framework abstracts the nitty gritty details of SQL with its Model library (the M in MVC). It is straight forward for standard lookups involving WHERE clauses. 10% of the time I need it to...

View Article

Django Automatic Slug Generator Abstract Class

Using Django, an example of how to auto populate a slug field based on the name or title of whatever the thing is. Correctly handles duplicate values (slugs are unique), and truncates slug if value too...

View Article

Django – Correctly Wiring to AWS CloudFront for Static and Media Files

When it comes to “How To Setup a CDN for Django” most people suggest the following “half way” setup that can lead to stale cache problems and slowness in the admin. Configure Django to upload media and...

View Article

Image may be NSFW.
Clik here to view.

Django Tricks for Processing and Storing JSON

In this post I’ll show a few tricks I use to make JSON fit into Django more seamlessly. The first is a lesson on coding that everybody should know. Parsing external JSON: Whenever you take in JSON from...

View Article


Querying Complex Data in Django with Views

Django has a powerful ORM, but like any ORM it suffers when querying data that has complex relationships. Django supports foreign keys and many to many relationships out of the box with ease. Sometimes...

View Article
Browsing all 6 articles
Browse latest View live




Latest Images