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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:26:11+00:00 2026-05-11T00:26:11+00:00

I am trying to make a combined image of all images added to a

  • 0

I am trying to make a combined image of all images added to a modell in django with inline editing and a ForeignKey. Ive got these models (simplified):

class Modell(models.Model):     title = models.CharField('beskrivelse', max_length=200)     slug = models.SlugField()     is_public = models.BooleanField('publisert', default=True)      def __unicode__(self):         return self.title      def save(self, **kwargs):         super(Modell, self).save(**kwargs)          on_modell_saved(self)     class Image(models.Model):     modell = models.ForeignKey(Modell, related_name='images')     image = ThumbnailImageField('bilde', upload_to=get_upload_path_image)      class Meta:         verbose_name = 'bilde'         verbose_name_plural = 'bilder'      def __unicode__(self):         return str(self.image) 

Then i add Image to the Modell with AdminInline, so when i save the Modell i save x number of images.

But when I try to do something with Modell.images.all in the on_modell_saved function i cant get hold of the objects. Ive got this function that is executed at Modell.save()

def on_modell_saved(instance):     for img in instance.images.all():         print img 

This only prints something the second time i save the Modell and not the first time. So anybody know how to call a function after all items that you are adding with AdminInline is saved?

  • 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. 2026-05-11T00:26:12+00:00Added an answer on May 11, 2026 at 12:26 am

    Modell and Image are two seperate models connected with a ForeignKey. Even though they both seem to be saved together, they don’t. They are saved one by one (first the Modell or first the Images).

    Now logically Images are saved after Modell. Because they have a ForeignKey pointing to Modell and if you try to save them first, because there’s no Modell yes, they would point to nothing (which is possible with null=True).

    So by the time Modell.save() is called Images don’t exist.

    Solution depends on what you want to do? I suppose the aim here is not just printing out the Images.

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

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer In my opinion, only one good reason: you need interoperability… May 11, 2026 at 11:32 am
  • added an answer I don't follow your question, but maybe I can help… May 11, 2026 at 11:32 am
  • added an answer I don't know much about the Obout's 3rd Party control,… May 11, 2026 at 11:32 am

Related Questions

I am trying to make a combined image of all images added to a
I am trying to make a div, that when you click it turns into
I am trying to make a JTable that has column spans available. Specifically, I
I am trying to make a gridview sortable which uses a stored procedure as
I am trying to make a form in which the user fills in values.
I am trying to make a php login page that allows users to access
I am trying to make a copy of a database to a new database
I am trying to make a search view in Django. It is a search
I am trying to make a livesearch with Django and jQuery. What I've done
I am trying to make a form move (using the titlebar) from a button

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.