New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError unhashable type: 'dict' #180
Comments
Hi Bryan, Thanks for reporting this. One thing that would be great is to see is what It looks like some app might be causing trouble, I've tried to reproduce it installing django-registration here, but that's not the one. From your traceback I'm guessing you are rendering RegistrationForm using a helper and a layout, is that right? Maybe, could you post what other Thanks, cheers |
I can't print self.context.dicts because it doesn't exist, but I can print self.context I did print self.context in base.py KeepContext enter and got:
My App list: Things relating to BioCrowd or pycrowd are might stuff, which should't be causing a problem since most of them are empty placeholders. The form is: class UserForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
confirm_password = forms.CharField(widget=forms.PasswordInput)
class Meta:
model = User
fields = ('first_name', 'last_name', 'email', 'password', 'confirm_password', )
def __init__(self, *args, **kwargs):
super(UserForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = 'id-registration'
#self.helper.form_class = 'form-horizontal'
self.helper.form_method = 'post'
self.helper.form_action = '/account/register/'
#self.helper.add_input(Submit('submit', 'Sign up'))
self.helper.layout = Layout(
Fieldset(
'Sign up',
'first_name',
'last_name',
'email',
'password',
'confirm_password'
),
FormActions(
Submit('submit', 'Signup', css_class="btn-large")
)
)
self.helper.filter(basestring, greedy=True).wrap(Field, css_class="input-xlarge")
def clean_confirm_password(self):
password = self.cleaned_data.get('password')
confirm_password = self.cleaned_data.get('confirm_password')
if not confirm_password:
raise forms.ValidationError("You must confirm your password")
if password != confirm_password:
raise forms.ValidationError("Your passwords do not match")
return confirm_password
def save(self):
new_user = User.objects.create_user(
email=self.cleaned_data['email'],
password=self.cleaned_data.get('password'),
first_name=self.cleaned_data['first_name'],
last_name=self.cleaned_data['last_name'],
is_active=True,
)
new_user.save()
return new_user |
I've been some days trying to reproduce the bug without luck. I've tried everything: different Django/Python versions, installing some of the apps you are using and checking if they somehow affect context variable, etc. Reproducing your same It is very weird that your context doesn't have a
Anyway, this needs to be patched, but I rather know what I'm patching. Cheers, |
this happened to me when using RequestContext and passing it as context to render_to_template instead of context_instance
|
HI Esteban, Thanks for adding more information to this. I'm not sure I know a Thanks, cheers |
you're right!! my bad, this happens with render_to_response using both Django 1.5 and 1.4 and de dev version of crispy forms |
No problem :) I've tried this right now in a test project and nothing. any chance you can send me your project zipped? I hate when I cannot reproduce bugs... Cheers, |
I can't send the project, but I'll try to create a working example later. anyway with this workaround I don't have any issues |
Thanks Esteban, that would be extremely helpful! Cheers, |
you can get the example here http://informalthinkers.com/example.tar.gz access /form1 and /form2 basically the same code, the second one isn't working |
I have same issue with
My view returns
|
Mine uses render_to_response as well. |
This fixes issue #180 and adds a test for avoiding regressions
Ok, thanks to the examples you've submitted, I've been able to reproduce the issue. Apparently Thanks, cheers |
Will do later today On Saturday, May 18, 2013, Miguel Araujo wrote:
Esteban Soler |
I can confirm that as of commit 472889f this issue no longer exists for me. Thanks you very much! |
Thanks a lot @josharenson for confirming it. This is going to be released in version 1.3.0 as soon as possible. Cheers, |
Same issue here, and I can confirm that the dev branch fixes it. |
Version 1.3.0 released :) |
After upgrading from 1.2.7 to 1.2.8, I receive an error message when calling:
{% crispy form %}
crispy_forms/base.py in enter, line 25
Traceback:
File "/Users/Bryan/PythonEnvs/BioCrowd/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
Exception Type: TypeError at /account/register/
Exception Value: unhashable type: 'dict'
The text was updated successfully, but these errors were encountered: