Empty context within template tag render() method after using django.test.client.Client.login() method

2013-09-22 Thread jondbaker
Within my integration tests, it appears that after using the login() method of django.test.client.Client the context dict consists only of: [{'False': False, 'None': None, 'True': True}, {}, {}]. If I remove the use of login(), then the request dict consists of: [{'False': False, 'None': None,

URL is successfully reversed and then not found

2013-04-10 Thread jondbaker
I'm working on tests for a Django app that I'm contributing to the community (https://github.com/jondbaker/django-critique) and have become stuck on a problem. After I perform a GET request for the app's sole URL within my integration tests: response = self.client.get(reverse(&

psycopg2.DataError

2012-10-29 Thread jondbaker
When I run 'python manage.py validate' the following error is returned: *psycopg2.DataError: invalid value for parameter "TimeZone": "UTC"* * * settings.py TIME_ZONE = 'America/Denver' USE_TZ = True I'm using Django 1.4.2 with Postgres 9.1/PostGIS on OSX. To test, I went back and commented out m

Django-SEO issue

2012-08-17 Thread jondbaker
I've successfully installed Django-SEO, but when I try to limit the number of backends (I only need/want my admin to have 'path' and not the other three) I am met with the following error: AttributeError at /admin/'NoneType' object has no attribute '_meta' I am using the documentation here: htt

TinyMCE config

2012-08-01 Thread jondbaker
I'm trying to install django-tinymce so that I can use utilize it within the admin when editing flatpages and flatblocks. I've been following the instructions at http://django-tinymce.readthedocs.org/en/latest/installation.html, but I can't seem to get TinyMCE to display. django-tinymce has bee

Return SQL calculation within queryset

2012-07-24 Thread jondbaker
I've implemented the spherical law of cosines to aid in proximity-based searching. Everything works correctly, but I'm a bit stumped as to how I can return the calculated distance for a record given that it's not a field in the model. In the Model Manager below, row[1] represents the dynamically

Re: Saving test user as a foreign key in unit tests

2012-04-11 Thread jondbaker
Problem solved. Within my view I needed use the following: def create_tasting(request): if request.method =='POST': form = TastingForm(request.POST) if form.is_valid(): *obj = form.save(commit=False)* *obj.author = request.user* *obj.save()*

Saving test user as a foreign key in unit tests

2012-04-11 Thread jondbaker
I have a Tasting model with an 'author' field that is a ForeignKey to the User model. Within my unit test I'm attempting to create a test user, and pass that user object as the author of a test Tasting, but I keep getting the following error: "IntegrityError: tastings_tasting.author_id may not b

django.contrib.auth.views.login no response

2012-03-28 Thread jondbaker
I'm trying to build a login form by following the instructions on this page https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.login. The form is rendered in the template with a username and password field, but the hidden "next" field has no value, the form does not re

Re: TestCase Client.login() fails

2012-03-28 Thread jondbaker
ypted and it's > not equal 't3stp@s$' ! > > Alexey rudyryk > /// > > On Wed, Mar 28, 2012 at 10:05 AM, jondbaker > wrote: > > I'm trying to write a unit test that will verify that the login form > > authenticates a user. Whenever I run 'manage

Re: TestCase Client.login() fails

2012-03-28 Thread jondbaker
Problem solved. I forgot that .create_user will create and return a hashed password, which obviously won't work if said returned object password property is entered into the password field of the login form. On Wednesday, March 28, 2012 12:05:49 AM UTC-6, jondbaker wrote: > > I&

Re: Need help creating model.

2012-03-27 Thread jondbaker
I think the Foreign Key route is the way to go. After setting up the fields on both the Student and Point models and establishing the FK relationship between the two, you could write a table-level method that returned the number of corresponding Points. On Tuesday, March 27, 2012 7:18:12 PM UTC

TestCase Client.login() fails

2012-03-27 Thread jondbaker
I'm trying to write a unit test that will verify that the login form authenticates a user. Whenever I run 'manage.py test' the runner fails with this message: *AssertionError: False is not True* *tests.py* from django.test import TestCase from django.test.client import Client from django.contrib

Django ManyToManyField JSON Fixture

2012-01-28 Thread jondbaker
Hi - I'm working on my first Django project and am trying to set up the fixture data for my blog app using JSON. Everything works correctly until I try to set up 'tags' on a 'post' which is a ManyToManyField. When I run '>>> python manage.py sqlall blog' and check out the proposed SQL, the table 'b

Re: Parsing HTML

2012-01-28 Thread jondbaker
Thanks, that's good to know. I'm just a few months into using Python (and weeks with Django), hence the familiarity with that one book and not real-world application just yet. On Jan 28, 9:45 am, Masklinn wrote: > On 2012-01-27, at 23:40 , jondbaker wrote: > > > Chapter

Re: Parsing HTML

2012-01-28 Thread jondbaker
Chapter 8 of Dive Into Python demonstrates what you're describing using sgmllib. http://www.diveintopython.net/ On Jan 27, 3:31 pm, Dennis Lee Bieber wrote: > On Fri, 27 Jan 2012 13:35:42 +0700, ddtopgun wrote: > >i'am new to django and i want to try get the content of HTML. > >can help me how t