Reddit reviews Two Scoops of Django: Best Practices For Django 1.6
We found 7 Reddit comments about Two Scoops of Django: Best Practices For Django 1.6. Here are the top ones, ranked by their Reddit score.
We found 7 Reddit comments about Two Scoops of Django: Best Practices For Django 1.6. Here are the top ones, ranked by their Reddit score.
Here are a couple of things I would recommend anyone diving in more depth into Django:
Like those before me, I had been doing the same thing. It's a practice I borrowed from the 2 Scoops of Django book.
It's served me well and I think it's fine to do this, but in a recent project I started using the project django-configurations which has also been pretty nice to use. It allows me to create individual python modules (common, local, staging, production, etc.), but where it's completely different is each module contains a class-based representation of the settings your'e interested in. Each non-common/base configuration (like staging) would inherit from the common class. It's quite nice in my opinion and recommend a look to see if it works for you.
EDIT: By the way, I discovered django-configurations via setting up my initial Django projects using django-cookiecutter and using the cookiecutter-django template. Take a look at their requirements files to see the load of stuff they start you off with. There's serious efficiency boosters in there that I've been using a lot lately and makes my life a bit easier once you get the hang of it all. Hope that helps!
Best practices for django 1.6:
http://www.amazon.com/Two-Scoops-Django-Best-Practices/dp/098146730X/ref=sr_1_1?ie=UTF8&qid=1415059289&sr=8-1&keywords=django+best+practices
I haven't read it, but heard really really good things about it!
http://www.amazon.es/Two-Scoops-Django-Best-Practices/dp/098146730X/ref=sr_1_1?ie=UTF8&qid=1421661687&sr=8-1&keywords=two+scoops+of+django
This book should help.
There are a few basic ways of customizing the display of form fields.
Without using outside packages
Using 3rd party packages
I recommend that you do use django forms, as they are quite easy to use and handle all of the validation for you (use required=True on each field, and you are done for the simple 'not blank' checking you mentioned). I'd start with just setting the class in the attrs dict if your needs are simple, and if you have more complex needs, check out crispy forms. I quite like that package.
The excellent Two Scoops of Django 1.6 book covers forms quite well, if you are familiar with the basics of Django and want expert advice on best practices I highly recommend it. Available on amazon.
Edit: actually I may have misread your post, if you are just talking about adding css to the form tag itself, that is simply as described here https://docs.djangoproject.com/en/dev/topics/forms/#displaying-a-form-using-a-template:
<form action="/contact/" method="post" class='myclass'>
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Submit" />
</form>
Yeah, absolutely! Feel free to PM me anytime.
Also, I'd highly recommend picking up a copy of Two Scoops of Django 1.6 if you've got $35 lying around. Even though we're in 1.7 now, the info in that book is pure gold.