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

  • Home
  • SEARCH
  • 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 6629317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:14:35+00:00 2026-05-25T22:14:35+00:00

I have an app called blog that has a model called Entry. I use

  • 0

I have an app called “blog” that has a model called “Entry”. I use a class based generic to view this Entry and I am happy with this.

Now, along comes another app called “Eventapp” that has a model called “Event”. Now I want to query this model for a few events, and then send it to the class based generic mentioned above. How do I do this?

Here is what I have in my urls.py so far to view the Entry model:

urlpatterns = patterns('',

    url(r'^$', ArchiveIndexView.as_view(
        model=Entry, paginate_by=5, date_field='pub_date',template_name='homepage.html'),
        ),

   url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>\w+)/$', 
     DetailView.as_view(model=Entry, queryset=Entry.objects.all(), slug_field='slug')),)

Is there a way to pass the Event model to ArchiveIndexView.as_view() and DetailView.as_view() somehow?

  • 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-05-25T22:14:36+00:00Added an answer on May 25, 2026 at 10:14 pm

    As it looks to me you would like to have your events on more than one page, a context processor may be the right tool for you. It should allow you to access a queryset of events within the context of every template:

    from eventapp.models import Event
    
    def event_provessor(request):
        return {'events': Event.objects.all()}    
    

    Because of the queryset’s laziness you don’t have to be afraid to hit the database if you don’t need the list, the query is only run if you would iterate over events.

    Of course you could also eg. subclass the views and add the events there to the context, but if more than one view is affected a context processor might make more sense!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have A WCF service that has a class that inherits System.Web.Security.RoleProvider. In this
Suppose I have a Django app named blog. There's a model called Post and
Hello i'm working on a blog app and I have a model: class Post(models.Model):
Let's say I have a class in my web app called class Foo. It
I have an app holding an array of instances of a class called SwimmingPool.
I have been writing some code that creates a generic blog. Its features are
I have an app called lastapp that I would like it to be viewable
I have a module that builds an app called MyApp. I have another that
I'm developing for Android and I have an app (called Forget-Me-Not) that uses a
I have seen an app called ZuluTrade, which has a charts in there tableView

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.