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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:44:14+00:00 2026-05-12T20:44:14+00:00

I have a model that looks like this: class ProjectImage(models.Model): big_thumb = ThumbnailField(upload_to=’profiles’, size=(500,

  • 0

I have a model that looks like this:

class ProjectImage(models.Model):
    big_thumb = ThumbnailField(upload_to='profiles', size=(500, 500))
    med_thumb = ThumbnailField(upload_to='profiles', size=(300, 300))
    small_thumb = ThumbnailField(upload_to='profiles', size=(100, 100))

I associate ProjectImage with a Project as a TabularInline. In the admin, I’d like to be able to say if the medium and/or small thumbnails were not provided, use the same image as the big thumbnail. However, I’m having a hard time figuring out how to specify this behavior.

  • 1 1 Answer
  • 3 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-12T20:44:14+00:00Added an answer on May 12, 2026 at 8:44 pm

    You have two options in this case, you can either over-ride ProjectImage‘s save defintion and have it copy big_thumb to med_thumb and small_thumb if they are None, or just create a simple model definition to display each field.

    def get_med_thumb_url(self):
        if self.med_thumb is None:
             return self.big_thumb.url
    
        return self.med_thumb.url
    

    And do the same for small_thumb That keeps you from fidgeting with the save method and having to copy things over and waste space.

    I can’t remember if ImageField has a get_FOO_url type definition but if it does you could always over-ride that.

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

Sidebar

Related Questions

I have a model that looks like this: class Invite(models.Model): user = models.ForeignKey(User) event
I have Django model that looks like this: class Categories(models.Model): Model for storing the
In my application I have a model that looks like this: class Talk(models.Model): title
I have a model that looks something like this class Post(models.Model): id = models.IntegerField(unique=True,
Have a class definition that looks something like this class someClass(models.Model): field1 = models.ForeignKey('other_app.field4')
I have a model that looks like this: class Category(models.Model): name = models.CharField(max_length=60) class
I have a model that looks like this: class Base(models.Model): pass class Mixin1(Base): active
I have a model that looks like this class RSVP (models.Model): def __unicode__(self): return
I have a model in Django that looks like this: class Project(models.Model): name =
I have model that looks like this: class Category(models.Model): parentCategory = models.ForeignKey('self', blank=True, null=True,

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.