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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:53:55+00:00 2026-06-14T16:53:55+00:00

I have class: class Image(models.Model): title = models.CharField(max_length=100) imgFile1 = models.FileField(upload_to=’%Y/%m/%d’) vote1 = models.IntegerField(default=0)

  • 0

I have class:

class Image(models.Model):
    title = models.CharField(max_length=100)
    imgFile1 = models.FileField(upload_to='%Y/%m/%d')
    vote1 = models.IntegerField(default=0)
    trofeum1 = models.IntegerField(default=0)
    imgFile2 = models.FileField(upload_to='%Y/%m/%d')
    vote2 = models.IntegerField(default=0)
    trofeum2 = models.IntegerField(default=0)
    home = models.IntegerField(default=0)

and function in views.py:

def vote1(request,i_id=0):
    imgId = str(i_id)
    try:
        if (request.session[imgId] == True):
            return HttpResponseRedirect(reverse('app.views.err'))              
    except Exception:
        request.session[imgId] = True
    try:
        image = Image.objects.get(pk=i_id)
    except Exception:
        image = None
    image.vote1+=1
    image.save()
    if image.vote1 == 5:
        image.trofeum1 += 1
        image.trofeum2 = 0
        image.vote1 = 0
        image.vote2 = 0
        image.imgFile2 = None
        image.save()
    return HttpResponseRedirect('app.views.index'))

So it updates certain object in my database after clicking some link on my site, but I dont want to redirect after that, just want to change object in my database – CLICK->UPDATE->NOTHING ELSE. Do you know any solutions to avoid error:The view app.views.vote1 didn’t return an HttpResponse object or any other way to do that?

I redirect to the same page but after that I’m on the top of the page – I want to be on the same place where I clicked the link.

  • 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-14T16:53:56+00:00Added an answer on June 14, 2026 at 4:53 pm

    Try to do the same thing with Ajax. It will do that.

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

Sidebar

Related Questions

class Foo(models.Model): title = models.TextField() userid = models.IntegerField() image = models.CharField(max_length=100) def __unicode__(self): return
I have a model in which I specify certain fields. class Upload_files(models.Model): title =models.CharField(max_length=100,
I have 2 model: class Sideshow_manager(models.Model): url_id = models.CharField(max_length=250,editable=False,unique=True) title = models.CharField(max_length=250) date =
Let's say I have the following model: class Contest: title = models.CharField( max_length =
I have an object: class Image(models.Model): width = models.IntegerField(...) height = models.IntegerField(...) class Foo(models.Model):
I have the following model classes... class Image < ActiveRecord::Base attr_accessible :description, :title has_many
Trying to work with ImageField in django. Here are my models class Album(models.Model): title
I have a two models, Items and Images. Under image model belongs_to :item and
I have this model: class Entry(db.Model): title = db.StringProperty() url = db.URLProperty() date =
I have this Pin Model: class Pin < ActiveRecord::Base belongs_to :user belongs_to :image accepts_nested_attributes_for

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.