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 8390951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:07:50+00:00 2026-06-09T19:07:50+00:00

In a Django app, I have an extra module. So my app is called

  • 0

In a Django app, I have an extra module. So my app is called header and inside it I have a model, view and a header file. Inside of the header file I have a class called resources which does what I want, but for some reason on a page refresh, it duplicates the information.

view:

def home(request):
header = Resources("home") #generate the resources for this page

return render_to_response('pages/index.html', {'header': header, 'content': test})

resources:

class Resources(object):

javascript_resources = []
javascript_files = []
style_sheets = []

def __init__(self, page_id = "home"):
    self.page_id = page_id.lower()
    self.get_status()
    self.get_meta()
    self.get_javascript()
    self.get_style_sheets()

def get_status(self):

def get_meta(self):

def get_javascript(self):

def get_style_sheets(self):

So what happens is, the header.javascript_resources list should only be 3 members long, but each duplicate it adds to it. So for some reason this object is staying in memory, even after a page refresh. What is causing this?

  • 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-09T19:07:51+00:00Added an answer on June 9, 2026 at 7:07 pm

    The problem seems to be that you created javascript_resources as class variable. Try to move its initialisation in the __init__ method.

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

Sidebar

Related Questions

I am working on a Django app and I have a class which reads
Suppose I have a Django app named blog. There's a model called Post and
In my Django App I have the following model: class SuperCategory(models.Model): name = models.CharField(max_length=100,)
in a django-tastypie app I have the following Django-models: class Car(models.Model): name=models.CharField('name',max_length=64) class CarTrack(models.Model):
I have a django app containing a model with a file upload field. the
I have a django app with models as follows: A Question model An Answer
I have a django app which is used for managing registrations to a survey.
I have a Django app which uses LDAP as the authentication backend. I'm not
I have a Django app with custom form fields, some of which have slow
I have a ModelForm in my Django app that uses a forms.ModelMultipleChoiceField, which displays

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.