Before we begin I am using Python 3.5.2 and Django 1.11.3 and basic knowledge of Django models, forms and views is required, so let’s begin. When I first started learning Django one of the things I needed to do was create a user and a user profile at the same time in the same view Read More
Category: Django
Articles for Djangonauts
How to access URL parameters in Django CBVs
Another common question in regards to Django is, how do I access a URL parameter captured from your URLconf(urls.py)? The and the answer is simpler than you might think. Before we get started I’m using Python 3.5.2 and Django 1.11.3. and assumes you have basic knowledge of Django Classed Based Views(CBVs) and its URL configuration. Read More
Pass object to formset to filter form ChoiceField
One of the initial problems I encountered with developing Django for the first time was how to pass object information to a formset so I could filter out a choices field based on the current user. There are two methods you need to override to accomplish this task, one is get_form_kwargs in the generic view Read More
Using get, get_queryset, get_context_data in Django CBVs
When I first started learning Django I had a lot of questions and while the Django documentation is absolutely excellent, sometimes you just may not know where to start. Which methods to use and override is pretty cut and dry for the experienced Djangonaut but for many first-time starters it can be a little confusing. Read More