Django stuck on validating models
-- but if you're stuck with an earlier version, you should find most things work with a little tweaking, as long as you get yourself a hold of a Live Server Test Case backport) If you then fire up your web browser and go to you should see something a bit like this: There's more information about the development server here: https://docs.djangoproject.com/en/1.4/intro/tutorial01/#the-development-server Now, manual tests like the one we've just done are all very well, but in TDD they're exactly what we're tring to avoid! You can describe the chunks of functionality as "user stories", if you like, and each user story tends to have a set of tests associated with it, and the tests track the potential behaviour of a user.We have to go all the way to the second page of the Django tutorial to see an actual user-visible part of the application: the .So let's start by creating our (NB - on Django 1.3 and earlier, ``startproject`` would only create a single ``mysite`` folder, which would contain both ``manage.py`` and ``settings.py``.This tutorial is written for 1.4 -- bleeding edge FTW! In the test-driven methodology, we tend to group functionality up into bite-size chunks, and write functional tests for each one of them. It's also written in step-by-step tutorial form, it uses the latest django, and it really is free.Once we've written our functional tests (which, incidentally, have forced us to think through the way our application will work, from the point of view of the user - never a bad thing...) we can start to think about how we want to implement that functionality from a technical point of view.Ostensibly, the idea is that apps can be self-contained, so that you could use one app in several projects...
So here are our objectives for this first tutorial: Django structures websites as "projects", each of which can have several constituent "apps"...
These are the tests that will tell us whether or not our application behaves the way we want it to, from the user's point of view.
No catch., a test tool which actually opens up a real web browser, and then drives it like a real user, clicking on links and buttons, and checking what is shown on the screen.
The admin site is a really useful part of Django, which generates a UI for site administrators to manage key bits of information in your database: user accounts, permissions groups, and, in our case, polls.
Thankfully we won't have to do too much difficult thinking, because the functional tests will be our guide - what do we have to do to get the functional tests to get a bit further towards passing? Once we've settled on the function or the class that will solve our first problem, we can write a unit test for it.
Again, it forces us to think about how it will work from the outside, before we write it.