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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:13:45+00:00 2026-06-05T07:13:45+00:00

I want to save and filter user’s objects in my django app. After inputting

  • 0

I want to save and filter user’s objects in my django app. After inputting the below codes, the imagefield is not uploading any image to my database and it’s not returning any image in my template.

Models

class Fin(models.Model):
    user=models.ForeignKey(User)
    title=models.CharField(max_length=250, help_text='3 bedroom flat for lease')
    main_view=models.ImageField(upload_to="photos",blank=True, null=True)
    side_view=models.ImageField(upload_to="photos",blank=True, null=True)
    address=models.CharField(max_length=200)
    city=models.CharField(max_length=200)
    state=models.CharField(max_length=200)
    guideline=models.TextField(max_length=1000)

   def __unicode__(self):
       return self.title


 class FinForm(ModelForm):
   class Meta:
      model=Fin
     fields=('title','main_view','side_view', 'address','city','state','guideline')
     exclude=('user')

Views

     def fincrib(request):
          extra_data_context={}
          #if there's nothing in the field do nothing.
          if request. method=="POST":
             form =FinForm(request.POST)
             if form.is_valid():
                data=form.cleaned_data
                newfincribs=Fin(
                   user= request.user,
                   title=data['title'],
                   main_view=data ['main_view'],
                   side_view=data['side_view'],
                   address=data['address'],
                   city=data['city'],
                   state=data['state'],
                   guideline=data['guideline'])
               newfincribs.save()
             extra_data_context.update({'FinForm':form})
      else:
          form = FinForm()
          extra_data_context.update({'FinForm':form})
      extra_data_context.update({'Fins':Fin.objects.filter(user=request.user)})
      return render_to_response('post.html',extra_data_context,context_instance=RequestContext(request))

Template

     {% block content %}
        <form action="." method="POST">
            {% csrf_token %}
    <center> {{FinForm.as_p}}  </center>
       <input type="submit" value="Submit"/>
       </form>

         {% for Fin in Fins %}
             <tr>
            <a href="{% url profiles_edit_profile %}"> {{Fin.user}} </a> </p> </strong>
             <p>{{Fin.title}}</p>
             <p><img src="{{MEDIA_URL}}/{{Fin.main_view}}"/></p>
             <p> <img src="{{MEDIA_URL}}/{{Fin.side_view}}"/></p>
              <p> {{Fin.address}} </p>
              <p> {{Fin.city}}</p>
              <p> {{Fin.state}}</p>
              <p> {{Fin.guideline}}</p>
              {% endfor %}
           {% endblock %}
  • 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-05T07:13:46+00:00Added an answer on June 5, 2026 at 7:13 am

    You’re missing a number of things on the template and view layer.

    Read this: https://docs.djangoproject.com/en/1.3/topics/http/file-uploads/#basic-file-uploads

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

Sidebar

Related Questions

While showing a save dialog, I want to hook user's filter type change and
I want save the username and password when user login, and I added the
I want to save the arabic word into oracle database. User type a arabic
I want to store which user invited another user to a group... but django
I want to open a save file dialog, have the user enter a filename,
I have created a django app. It has got a user login/registration on the
I'm working on a system were a user can edit existing objects (Filter domain
After autheticating my user, I want to put a reference in the session to
Possible Duplicate: Save my cookie data to MySQL database? I want save data into
I want to save rich text to CoreData and then print it out. What

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.