Note that there are some explanatory texts on larger screens.

plurals
  1. POImport Error Django-profiles
    primarykey
    data
    text
    <p>I'm trying to get the django-profiles work.</p> <p>I follow the steps of <a href="http://birdhouse.org/blog/2009/06/27/django-profiles/" rel="nofollow">this manual ("The Missing Manual")</a>,</p> <p>so: </p> <ul> <li>I work in the same project I also use for the django-registration (so no app created!!!)</li> <li>In my templates I've created a folder "/profiles" (including edit_profile.html)</li> <li>My AUTH_PROFILE_MODULE is set to 'myProjectName.UserProfile'</li> <li><p>I've created in my project folder models.py containing:</p> <pre><code>from django.db import models class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) first_name = models.CharField(_('first name'), max_length=100) middle_name = models.CharField(_('middle name'), blank=True, max_length=100) last_name = models.CharField(_('last name'), max_length=100) birth_date = models.DateField(_('birth date'), blank=True, null=True) </code></pre></li> <li>In my project folder, I've created forms.py, with exactly the same code as in the manual</li> <li><p>In urls.py of my project I've added:</p> <pre><code>from myProjectName.forms import ProfileForm ('^profiles/edit', 'profiles.views.edit_profile',{'form_class':ProfileForm,'success_url':'/my/custom/url',}), (r'^profiles/', include('profiles.urls')), </code></pre> <p>So now the whole urls.py file of my project is:</p> <pre><code>from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template from django.contrib import admin from myProjectName.forms import ProfileForm admin.autodiscover() urlpatterns = patterns('', (r'^admin/', admin.site.urls), (r'^accounts/', include('registration.urls')), (r'^$', direct_to_template, { 'template': 'index.html' }, 'index'), ('^profiles/edit', 'profiles.views.edit_profile', {'form_class': ProfileForm,'success_url':'/my/custom/url',}), (r'^profiles/', include('profiles.urls')), ) </code></pre> <p>When I access now <a href="http://127.0.0.1:8000/profiles/edit/" rel="nofollow">http://127.0.0.1:8000/profiles/edit/</a>, I get this error:</p> <pre><code>Exception Value: No module named ourcrestmont.itaco.models </code></pre> <p>That's the import located in forms.py ...</p> <p>What am I doing wrong?</p></li> </ul> <p><strong>EDIT:</strong></p> <p>The code of my forms.py:</p> <pre><code>from django.db import models from django.forms import ModelForm from ourcrestmont.itaco.models import * class ProfileForm(ModelForm): class Meta: model = Foo exclude = ('field1','field2','field3',) </code></pre> <p>It's exactly the same code as in the manual, or is this code not good? (could anyone give an other, better code?)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload