Re: Problem with i18n in tests

2008-11-24 Thread Florencio Cano
I've done that because I want to change the default error_message and I do not know who to do it :(. I've tried error_messages={} in the field but it is now recognized in Fields in ModelForms only in plain Forms. So, how can I change the default error_message if I'm using ModelForms? > Why are doi

Problem with i18n in tests

2008-11-22 Thread Florencio Cano
Hi! I'm testing a Django application where I'm using i18n. The problem is with a test that says that a word with an accent (spanish) is the same as a word without an accent. And although I have established my own error messages it shows other error message when using a word with accents. The proble

How to test request.session after HttpResponseRedirect?

2008-11-21 Thread Florencio Cano
Hi! Is there any way to access request.session from a unit test if I have a response that is a HttpResponseRedirect. I know HttpResponse have the attribute session but HttpResponseRedirect does not. I've read that HttpResponseRedirect is a subclass of HttpResponse, can I access to the HttpResponse

Validating two forms in one

2008-11-21 Thread Florencio Cano
Hello all, I have two models called User and Responsible. When I add a Responsible automatically a User is added. I have only one form to add a User and a Responsible. class NewUserResponsibleForm(forms.Form): username = forms.CharField(max_length=30) password = forms.CharField(max_length

Re: Models not validating

2008-10-25 Thread Florencio Cano
You are saying that a Pupil is a Team and a Team is a Pupil with that OneToOneField. In the Team you are saying one Pupil belongs to many Teams and a Team have many Pupils that seems ok but the OneToOneField seems wrong. 2008/10/25 AdamC <[EMAIL PROTECTED]>: > > 2008/10/25 Manuel Held <[EMAIL PRO

Re: Newforms admin problem: TemplateSyntaxError at /admin/

2008-07-24 Thread Florencio Cano
In fact it was not the solution. I though that it was because when I browsed to localhost:8000/admin/ I saw the login form but after logging in the error appeared another time. Today I'm going to start a project from the beggining and I'm going to copy the files one by one trying to isolate the e

Re: Newforms admin problem: TemplateSyntaxError at /admin/

2008-07-21 Thread Florencio Cano
Uhm, the solution was to delete the database and recreate it. Now it runs correctly. 2008/7/21 Florencio Cano <[EMAIL PROTECTED]>: > Hi, > After viewing the new documentation for the admin interface and > modifying, properly I think, the files when I try to access > http://lo

Re: ViewDoesNotExist 'index' attribute in contrib.admin.views.main

2008-07-21 Thread Florencio Cano
t this for admin: ('^admin/(.*)', admin.site.root), 2008/7/21 cschand <[EMAIL PROTECTED]>: > > Did you add > admin.autodiscover() > in urls.py? I think the problem due to this > read > http://www.djangoproject.com/documentation/admin/#hooking-adminsite-instances-into-your-urlconf

Re: ViewDoesNotExist 'index' attribute in contrib.admin.views.main

2008-07-21 Thread Florencio Cano
hange I see is extracting the Admin class from the models and creating another class called MyModelAdmin that extends admin.ModelAdmin and modifying the urls.py to include: urlpatterns = patterns('', ('^admin/(.*)', admin.site.root), [...] Any ideas to solve this problem

ViewDoesNotExist 'index' attribute in contrib.admin.views.main

2008-07-21 Thread Florencio Cano
Hi! I have updated Django from svn, installed a new app and some new models and now when I try to browse /admin/ I get this error: ViewDoesNotExist: Tried index in module django.contrib.admin.views.main. Error was: 'module' object has no attribute 'index' I have checked that my user is the owner

Problem testing ModelChoiceField in form

2008-07-17 Thread Florencio Cano
Hi! When I try to test a post to a form that have a ModelChoiceField form I get always a form error in that field "Select a valid choice". The form is this: class OperacionForm(forms.Form): ticker = forms.ModelChoiceField(Valor.objects.all()) fecha = forms.DateField(widget=SelectD

How do I know, in a unit test, the user authenticated after login?

2008-07-16 Thread Florencio Cano
Hi, I would like to know how I can retrieve the user id of the user authenticated in the auth subsystem after login in a test. class CrearCarteraTestCase(TestCase): fixtures = ['/fixtures/initial_data.xml'] def setUp(self): self.client = Client()

Don't see form errors in template

2008-07-15 Thread Florencio Cano
Hello, I have a model Investor associated with a model User. Now I'm implementing the registration form. I want to store the name of the Investor in the Investor model and the rest of information in the User model. So I have username, password, name and email. I have a registration form in order t

Form hasn't got save attribute

2008-07-11 Thread Florencio Cano
Hello, I have this piece of code: from django import newforms as forms class RegistroForm(forms.Form): username = forms.CharField(max_length=30) password = forms.CharField(max_length=20, widget=forms.PasswordInput()) nombre = forms.CharField(max_length=50) email =

Re: Errorlist messages internalization/localization

2008-07-05 Thread Florencio Cano
I had 'es_ES'. I have reviewed http://www.i18nguy.com/unicode/language-identifiers.html and I see that for spanish (Spain) I have to use 'es-ES' so I change it, execute manage.py syndb and execute the tests but I get the same. Now I try with 'es'. The same process and I get the same...Could be the

Errorlist messages internalization/localization

2008-07-05 Thread Florencio Cano
Hi! In my app when I show the errors in errorlist because a wrong filled form it shows them in spanish (my language) but when I execute the tests (with assertContains) the messages in errorlist appear in english! How can I fix this? --~--~-~--~~~---~--~~ You receiv

Bound forms and form_from_instance

2008-07-04 Thread Florencio Cano
I'm trying to understand Django forms and I have a doubt. Imagine that you define a Form class called AddressClass. You can instantiate it like this: address_form = AddressClass() address_form will be an unbound form object and when you if you show it in the template all the fields will be blank

assertRedirects do not exist in 0.97 pre?

2008-07-03 Thread Florencio Cano
Hello, I'm writing some tests to my login views and I get this error when executing the tests: AttributeError: 'UserTestCase' object has no attribute 'assertRedirects' This is the view: import unittest from django.test.client import Client from django.contrib.auth.models import User class User

Re: Attribute Error: 'NoneType' object has no attribute 'get_field_sets'

2008-06-18 Thread Florencio Cano
What do you mean with "importing your models"? Do you mean syncing them with the database? Have you tried $ python manage.py validate? 2008/6/18 Molly <[EMAIL PROTECTED]>: > > I am creating an app to be run on the desktop, > > I am in the process of importing my models, and I got this error: > >

Re: TextField default String problem

2008-06-18 Thread Florencio Cano
I think you should map first the form to an object and then access the name attribute of that object instance. It seems that you are trying to access a model.CharField() directly. On 18 jun, 00:43, redmonkey <[EMAIL PROTECTED]> wrote: > I have two fields in a model, a name (CharField) and a descr

Re: insert row into ManyToManyField

2008-06-18 Thread Florencio Cano
Have you tried this? for border in country_instance.contries.all(): border.length = new_border On 18 jun, 10:39, Peter Bulychev <[EMAIL PROTECTED]> wrote: > Is it possible to insert additional row into table, which corresponds > to ManyToManyField? --~--~-~--~~~-

Re: how to sort in django template

2008-06-18 Thread Florencio Cano
I don't understand what exactly are you trying to do but I think the dictsort filter could help. On 18 jun, 09:53, laspal <[EMAIL PROTECTED]> wrote: > I have a list of employee and i want to sort it. --~--~-~--~~~---~--~~ You received this message because you are

Re: Authentication django

2008-04-17 Thread Florencio Cano
Here http://www.djangoproject.com/documentation/authentication/ you can find information about authentication in Django. Hope this helps. 2008/4/17 Fernanda Boronat <[EMAIL PROTECTED]>: > > Hello, I am trying to develop a small application that allows > authentication, the idea is that I have a