Re: 'module' object has no attribute 'Manipulator'

2012-07-19 Thread JDaniel
You may autopopulate created_by field via admin interface following this 
guideline:

http://stackoverflow.com/questions/3986963/prepopulate-an-admin-field-from-logged-in-user

Hope it helps!

El viernes, 24 de junio de 2011 22:00:28 UTC+2, django_cd escribió:
>
> Hey,
>
> I am very new to Django just started working around with forms. I have 
> been facing difficulty in getting a user registered. Anyways i was 
> following steps given in James Bennet blog.
>
> http://www.b-list.org/weblog/2006/sep/02/django-tips-user-registration/
>
> I have defined my classes, forms similar to whats given on the blog post.
>
> Here is my traceback :
>
> ---
> Environment:
>
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/cd/
>
> Django Version: 1.3
> Python Version: 2.7.1
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'django.contrib.admin',
>  'registration']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.csrf.CsrfResponseMiddleware')
>
>
> Template error:
> In template c:\users\pradeep\desktop\cd\templates\index.html, error at 
> line 6
>Caught AttributeError while rendering: 'module' object has no attribute 
> 'Manipulator'
>1 : 
>
>
>2 : 
>
>
>3 : 
>
>
>4 : 
>
>
>5 : Hey you are on index page
>
>
>6 : Register
>
>
>7 : 
>
>
>8 : 
>
> Traceback:
> File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in 
> get_response
>   111. response = callback(request, 
> *callback_args, **callback_kwargs)
> File "C:\Users\pradeep\Desktop\cd\views.py" in indexPage
>   8. return direct_to_template(request, template='index.html')
> File "C:\Python27\lib\site-packages\django\views\generic\simple.py" in 
> direct_to_template
>   28. return HttpResponse(t.render(c), mimetype=mimetype)
> File "C:\Python27\lib\site-packages\django\template\base.py" in render
>   123. return self._render(context)
> File "C:\Python27\lib\site-packages\django\template\base.py" in _render
>   117. return self.nodelist.render(context)
> File "C:\Python27\lib\site-packages\django\template\base.py" in render
>   744. bits.append(self.render_node(node, context))
> File "C:\Python27\lib\site-packages\django\template\debug.py" in 
> render_node
>   73. result = node.render(context)
> File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in 
> render
>   437. url = reverse(view_name, args=args, kwargs=kwargs, 
> current_app=context.current_app)
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in reverse
>   391. *args, **kwargs)))
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in reverse
>   312. possibilities = self.reverse_dict.getlist(lookup_view)
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in 
> _get_reverse_dict
>   229. self._populate()
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in 
> _populate
>   208. for name in pattern.reverse_dict:
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in 
> _get_reverse_dict
>   229. self._populate()
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in 
> _populate
>   197. for pattern in reversed(self.url_patterns):
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in 
> _get_url_patterns
>   279. patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in 
> _get_urlconf_module
>   274. self._urlconf_module = import_module(self.urlconf_name)
> File "C:\Python27\lib\site-packages\django\utils\importlib.py" in 
> import_module
>   35. __import__(name)
> File "C:\Users\pradeep\Desktop\cd\registration\urls.py" in 
>   2. from registration import views
> File "C:\Users\pradeep\Desktop\cd\registration\views.py" in 
>   10. from registration.forms import UserForm, StateForm, CityForm, 
> RegForm, LoginForm, UserSchoolForm, UserCollegeForm, UserUnivForm, 
> UserCompanyForm
> File "C:\Users\pradeep\Desktop\cd\registration\forms.py" in 
>   15. class UserForm(forms.Manipulator):
>
> Exception Type: TemplateSyntaxError at /cd/
> Exception Value: Caught AttributeError while rendering: 'module' object 
> has no attribute 'Manipulator'
>  
>
> 
>
> I tried 

Additional data to user and User admin breaks.

2011-04-20 Thread JDaniel
Hello,

I'm new to Django and wonder how to solve this problem. I am trying to
add some additional data to the User standard model.

I follow the instructions here:
http://digitaldreamer.net/blog/2010/12/8/custom-user-profile-and-extend-user-admin-django/
That I believe they're pretty the same as in Django docs (but in more
detail).

My models.py:
...
# Class for the client data:
class client(models.Model):
user = models.OneToOneField(User)
name = models.CharField(max_length=100)
description = models.CharField(max_length=250)
# Now some standard methods overriden:
def __unicode__():
return self.name
# This is to link the client (user profile) to the user standard
saving.
def create_client(sender, instance, created, **kwargs):
""" Create a new client when a User is saved."""
if created:
myClient = client() # This creates the client object.
myClient.user = instance # This updates the user with the
newly created instance
myClient.save() # This saves the model.
# And this connects to the saving user signal the creation of the
client:
post_save.connect(create_client,sender=User)
...
And my admin.py:
...
# This class allows to link the client with the user admin interface:
class ClientInline(admin.StackedInline):
model = client
fk_name = 'user'
max_num = 1

class ClientUserAdmin(UserAdmin):
inlines = [ClientInline,]

admin.site.unregister(User)
admin.site.register(User,ClientUserAdmin)
...
But the server raises an error:
DatabaseError at /admin/auth/user/3/
no such column: d2w3_client.user_id
Request Method: GET
Request URL:http://localhost:8000/admin/auth/user/3/
Django Version: 1.2.3
Exception Type: DatabaseError
Exception Value:
no such column: d2w3_client.user_id
Exception Location: /usr/lib/pymodules/python2.6/django/db/backends/
sqlite3/base.py in execute, line 200
Python Executable:  /usr/bin/python
Python Version: 2.6.6

Apparently Django is trying to access to user_id field (from user, but
related to client by OneToOneField relation), and it's not found.
Where's the error.
Thanks in advance,
Daniel.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.