Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8221715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:01:41+00:00 2026-06-07T14:01:41+00:00

Im working with django, building a web app. I have most stuff working. The

  • 0

Im working with django, building a web app. I have most stuff working. The general structure is I have a user tied to a list of elements. When I click on those elements, I get a 404 page not found error.

Heres some of models.py:

class Event(models.Model):
    #user that created the event

    #event title
    title = models.CharField(max_length=200)

    #time created
    created = models.DateField('Date Created',auto_now_add=True)

    #description of event from user
    description = models.CharField(max_length=400)

    #address of event if existant
    address = models.CharField(max_length=50)

class User(models.Model):

    attending = models.ManyToManyField('Event', related_name='User_attending')
    hosting = models.ForeignKey('Event', related_name='User_hosting')

    gender = models.IntegerField(max_length=1)
    password = models.CharField(max_length=100)
    email = models.CharField(max_length=100)
    age = models.IntegerField()
    fName = models.CharField(max_length=25)
    lName = models.CharField(max_length=25)
    id = models.AutoField(primary_key=True)

From views.py, when I try and access the html page attached to my "event" object, I get a 404 error because my code doesnt recognize "Event".

from list.models import *

def event(request, id):
     #e = Event()
     #code.interact(local = locals())
     try:
         e = Event.objects.get(User_hosting=id)
     except Event.DoesNotExist:
         raise Http404
     if e.user_id != request.user.id:
         raise Http404
     #code.interact(local = locals())
     return render_to_response('event/event.html', {'event':e})

When I use the shell, e = Event.objects.get(User_hosting=id) it says that "Event is not defined".

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:01:44+00:00Added an answer on June 7, 2026 at 2:01 pm

    You have to import any modules or classes you want to use in the shell. Try this (where appname is the name of your app.

    from appname.models import Event
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on building a web-application using Django. Since I'm new to working
I started working on Django 1.0 Web Site Development and have gotten my server
I am building search app using django & sphinx. I got the setup working
I'm working on a django app for a site that requires an image gallery.
I am building a high school team application using Django. Here is my working
I'm working with Django on Linux and I have an application that integrates with
I'm currently working with django generic views and I have a problem I can't
I'm working with some simple django-tastypie Resources with the following problem: Imagine I'm building
I have a working django-admin custom command that I use to populate my database
I have been trying to get xapian working django haystack for a project im

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.