Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django ComputedField()
A very common pattern, at least in code that I've written (and read) is to annotate on a field that uses an expression that is based on one or more other fields. This could then be used to filter the objects, or just in some other way. The usual method of doing this is: {% highlight python %} from django.db import models from django.db.models.expressions import F, Value from django.db.models.function import Concat class PersonQuerySet(models.query.QuerySet): def with_name(self): return self.annotate( name=Concat(F('first_name'), Value(' '), F('last_name'), output_field=models.TextField()), ) class Person(models.Model): first_name = models.TextField() last_name = models.TextField() objects = PersonQuerySet.as_manager() {% endhighlight %} Yes, I'm aware of [falsehoods programmers believe about names](https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/), but this is an easy-to-follow example. In order to be able to access the `name` field, we must use the `with_name()` queryset method. This is usually okay, but if it is something that we almost always want, it can be a little tiresome. Alternatively, you could override the `get_queryset()` method of a custom manager, but that makes it somewhat surprising to a reader of the code. There are also some places where a custom manager will not automatically be used, or where it will be cumbersome to include the fields from a custom manager … -
Custom Domains for Zappa Projects
For web applications, a custom... -
Custom Domains for Zappa Projects
For web applications, a custom... -
RDS Database for Serverless Django + Zappa on AWS Lambda
This is a critical piece of ha... -
Serverless Django with Zappa on AWS Lambda
Going serverless with Django a... -
Prepare AWS IAM User, Role, and Policies for Zappa and Serverless Python
This is [Zappa](https://www.za... -
A tour on Python Packaging
If you're new to Python or a mature one and want to share your code with other developers or you have build a library to be used by end users and you're struggle with the packaging, then this tutorial/post/explanatory guide is (possibly) for you. Prerequisites Assumptions Packaging in Python Modularity PyPI setuptools wheel twine pip Difference between sdist and bdist_wheel The basics Name Cookiecutter Structure requirements_dev.txt Makefile LICENSE docs/, AUTHORS.rst, CONTRIBUTING.rst, HISTORY.rst and README.rst tests/ and tox.ini setup.py Metadata Requirements install_requires python_requires extras_require Entry points Packaging Wheels (aka built distribution) Sdist (aka source distribution) Packages zip_safe test_suite setup.cfg MANIFEST.in Upload keyring Installing your uploaded package Sum up Resources Python packaging-related videos Python packaging-related podcasts Python packaging-related articles Prerequisites First of all, you must understand some basics around Python packaging terminology or else this (useful) post will turn into an incomprehensible one! Your first stop is packaging glossary. In there, you'll find the terminology around python packaging. Some things I would like to highlight: artifact (not listed): fancy word for file source distribution (sdist): simple, source only .tar.gz archive. Only for pure Python modules/packages (ones that do not contain any C/C++ code). The institution set up to deal with distribution in … -
Python Overtakes Java
It's fitting that the first bl... -
Get List of Current Users
We get this question a good am... -
Facebook's Parse is Closing
[Parse](http://parse.com/) is ... -
Python Cheat Sheet
A quick reference guide for us... -
My Equipment
### Computer Laptop: [http:... -
AngularJS vs jQuery
### AngularJS is a framework ... -
Django App Structure
To make your individual Django... -
Syncdb is ... gone?
Yup `python manage.py syncdb` ... -
A Fantastic Ted Talk
This is by far one of the most... -
Everything coming in 2017
Topics -
*args and **kwargs
So when you write any given fu... -
New URL Structure for Django
Django 1.10 has changed the re... -
Which Version to Use?
When you watch or read tutoria... -
Testing Email in Django with send_mail
Sometimes you need to test tha... -
TemplateDoesNotExist error
I see this error come up a lot... -
post_save vs pre_save vs override save method
Which is better ... `post_save... -
Hats off to you...
CFE Community! Hats off to ... -
Introducing Ask
At CFE, our fundamental goal i...