Opened 12 years ago

Closed 12 years ago

#19499 closed Bug (invalid)

databasse error

Reported by: vinthkumar@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.4
Severity: Normal Keywords: database error
Cc: vinothkumar@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

hi i'm new learner for django.

i decalare the models.py class like this

class MAccount(models.Model):
    act_id = models.CharField(primary_key=True, max_length=8, null=False, unique=True)
    pwd = models.CharField(max_length=20, null=False)
    name = models.CharField(max_length=25, null=False)
    address = models.TextField()
    phone = models.CharField(max_length=13, null=False)
    email = models.EmailField(null=False)

    
#create Event table
class MEvent(models.Model):
    event_id = models.CharField(primary_key=True, max_length=20, null=False, unique=True)
    name = models.CharField(max_length=50, null=False)    
    date = models.DateField(null=False, blank=False)
    image = models.ImageField(upload_to='img', blank=False)
    loc = models.TextField()    
    email = models.EmailField(null=False)
    acc_id = models.ForeignKey(MAccount)


views.py

def eventcreate(request):
    if request.method == 'POST': # If the form has been submitted...
        form = models.MEventForm(request.POST, request.FILES) # A form bound to the POST data
        if form.is_valid(): # All validation rules pass
            # Process the data in form.cleaned_data
            # ...
            
            form.save()
            return HttpResponseRedirect('/detail/') # Redirect after POST
    else:
        form = models.MEventForm() # An unbound form

    return render(request, 'eventcreate.html', {
        'form': form,
    })

def detail(request):
    latest_list = MEvent.objects.all().order_by('-event_id') [:10]
    temp = {'latest_list': latest_list}
    return render_to_response('detail.html', temp, context_instance=RequestContext(request))


i added a value in MAccount cllass and MEvent class i need to display that all records in MEvent class. when i goto the detail.html page i get this error. how can i solve this error.

DatabaseError at /detail/
no such column: accountapp_mevent.acc_id_id
Request Method: GET
Request URL: http://127.0.0.1:8000/detail/
Django Version: 1.4.2
Exception Type: DatabaseError
Exception Value:
no such column: accountapp_mevent.acc_id_id
Exception Location: /usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py in execute, line 344
Python Executable: /usr/bin/python2.7
Python Version: 2.7.3
Python Path:
['/home/vinod/workspace/userbackend',

'/home/vinod/workspace/userbackend',
'/home/vinod/.eclipse/org.eclipse.platform_3.8_155965261/plugins/org.python.pydev_2.7.1.2012100913/pysrc',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
'/usr/lib/python2.7/dist-packages/ubuntuone-couch',
'/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']

Server time: Thu, 20 Dec 2012 03:27:50 -0600

Change History (1)

comment:1 by Ramiro Morales, 12 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top