ViewDoesNotExist

49 views
Skip to first unread message

Ayush Sharma

unread,
Mar 2, 2010, 3:32:03 AM3/2/10
to Django users
I have an application named MusicFun inside django/mysite and
following are is the file models.py inside MusicFun-

from django.db import models
from django.forms import ModelForm

GENDER_CHOICES = (
('M', 'Male'),
('F', 'Female'),
)

class Artist(models.Model):
first_name=models.CharField("persons name",max_length=30)
last_name=models.CharField("his last name",max_length=30)
password=models.CharField("password",max_length=30)
email=models.EmailField(primary_key=True)
join_date=models.DateTimeField(auto_now_add=True)


class ArtistForm(ModelForm):
class Meta:
model=Artist
fields=['email','first_name']

The view inside MusicFun is defined as follows-

from django.shortcuts import render_to_response
from django.http import HttpResponse
import datetime
from mysite.MusicFun.models import ArtistForm
from django.core.mail import send_mail
def addArtist(request):
if request.method=='POST':
form = ArtistForm(request.POST)
if form.is_valid():
new_Artist=form.save()
email=new_Artist.email
send_mail('No Reply','Thanks for registering at our site',email,
['ayush.sh...@gmail.com'])
return render_to_response('thanks.html')
else:
form=ArtistForm()
return render_to_response('contact.html', {'form': form})


the urls.py is defined as follows-

from django.conf.urls.defaults import *
from mysite.views import current_datetime,hours
urlpatterns = patterns('',
(r'^time/$', current_datetime),
(r'^time/plus/(\d{1,2})/$', hours),
(r'^addartist/$','mysite.MusicFun.views.addArtist'),
)


i am getting the following error on the url http://127.0.0.1:8000/addartist/

ViewDoesNotExist at /uploadalbum/

Tried upload in module mysite.MusicFun.views. Error was: 'module'
object has no attribute 'Charfield'

Request Method: GET
Request URL: http://127.0.0.1:8000/uploadalbum/
Exception Type: ViewDoesNotExist
Exception Value:

Tried upload in module mysite.MusicFun.views. Error was: 'module'
object has no attribute 'Charfield'

Exception Location: /usr/local/lib/python2.6/dist-packages/django/
core/urlresolvers.py in _get_callback, line 137
Python Executable: /usr/bin/python
Python Version: 2.6.2
Python Path: ['/home/ayush/Django-1.1.1/mysite', '/usr/lib/
python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-
tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/
usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/
PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/var/lib/python-
support/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/var/
lib/python-support/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-
packages']
Server time: Tue, 2 Mar 2010 02:20:41 -0600


Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/uploadalbum/
Django Version: 1.1.1
Python Version: 2.6.2
Installed Applications:
['mysite.books', 'mysite.MusicFun']
Installed Middleware:
[]


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
83. request.path_info)
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in resolve
218. sub_match = pattern.resolve(new_path)
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in resolve
125. return self.callback, args, kwargs
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in _get_callback
137. raise ViewDoesNotExist, "Tried %s in module %s.
Error was: %s" % (func_name, mod_name, str(e))

Exception Type: ViewDoesNotExist at /uploadalbum/
Exception Value: Tried upload in module mysite.MusicFun.views. Error
was: 'module' object has no attribute 'Charfield'


Karen Tracey

unread,
Mar 2, 2010, 8:10:45 AM3/2/10
to django...@googlegroups.com
On Tue, Mar 2, 2010 at 3:32 AM, Ayush Sharma <ayush.sh...@gmail.com> wrote:
i am getting the following error on the url http://127.0.0.1:8000/addartist/

ViewDoesNotExist at /uploadalbum/

Tried upload in module mysite.MusicFun.views. Error was: 'module'
object has no attribute 'Charfield'

Wherever in your code you have spelt Charfield with a lowercase f, you need to fix it to use the correct capitalization.

Karen

Ayush Sharma

unread,
Mar 3, 2010, 9:21:42 AM3/3/10
to Django users
Thanks..sometimes v just don't see small things..thanks..

On Mar 2, 5:10 am, Karen Tracey <kmtra...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages