Hi, I'm using the verdjn PhotoField and in most of the app it works fine. But, when I try to use it for an 'old' form, I get the following error
Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/ core/handlers/base.py" in get_response 74. response = callback(request, *callback_args, **callback_kwargs) File "/home/toeknee/Projects/HairCrazyDjango/hc/../hc/users/views.py" in editProfile 23. manipulator = EditAccountForm() File "/home/toeknee/Projects/HairCrazyDjango/hc/../hc/users/forms.py" in __init__ 76. is_required=False, validator_list=None), File "/home/toeknee/Projects/HairCrazyDjango/hc/../hc/fields/ photofield.py" in __init__ 22. super(PhotoField, self).__init__(verbose_name, name, width_field, height_field, **kwargs) File "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/ models/fields/__init__.py" in __init__ 632. FileField.__init__(self, verbose_name, name, **kwargs) File "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/ models/fields/__init__.py" in __init__ 534. Field.__init__(self, verbose_name, name, **kwargs) TypeError at /account/profile/edit/ __init__() got an unexpected keyword argument 'field_name' The interesting part from the model is from django.db import models from django.contrib.auth.models import User from hc.fields.photofield import PhotoField class UserProfile(models.Model): avatar = PhotoField(upload_to='avatars/', width_field=64, height_field=64, blank=True) The interesting part from the model is from django import forms from hc.fields.photofield import PhotoField from django.core import validators from django.contrib.auth.models import User from hc.users.models import UserProfile class EditAccountForm(forms.Manipulator): def __init__(self): self.fields = ( PhotoField(field_name='avatar'), ) def save(self, new_data, user): p = UserProfile.objects.get(user=user.id) p.avatar = new_data['avatar'] p.save() return u The interesting part from the view is def editProfile(request): manipulator = EditAccountForm() data = {} data['id'] = request.user.id if request.POST: data = request.POST.copy() errors = manipulator.get_validation_errors(data) if not errors: # Save the user manipulator.do_html2python(data) user = manipulator.save(data, request.user) return HttpResponseRedirect('/accounts/profile') else: data['id'] = request.user.id data['first_name'] = request.user.first_name data['last_name'] = request.user.last_name data['email'] = request.user.email data['hair'] = request.user.get_profile().hair data['url'] = request.user.get_profile().url data['location'] = request.user.get_profile().location data['signature'] = request.user.get_profile().signature data['avatar'] = request.user.get_profile().avatar data['about_me'] = request.user.get_profile().about_me errors = {} print data form = forms.FormWrapper(manipulator, data, errors) return render_to_response('users/edit_user.html', {'form': form, 'user': request.user}, context_instance=RequestContext(request)) Does anyone have any ideas about where I'm going wrong? Cheers Tony --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---