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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:31:01+00:00 2026-06-13T03:31:01+00:00

Suppose I have the following model: class Cow (models.Model): name = models.CharField(max_length=100) color =

  • 0

Suppose I have the following model:

class Cow (models.Model):
    name = models.CharField(max_length=100)
    color = models.CharField(max_length=100, default="brown")

On our farm we have many cows. Typically, the farmer takes cows to the vet in defined batch:

class Cow_Batch(models.Model):
    batch_name = models.CharField(max_length=100)
    cows = models.ManyToManyField(Cow)

In our admin, we can create a Cow_Batch, allowing our farmer to easily take Daisy and Debbie (two sisters with a similar medical condition) to the vet together.

I’d like to be able to have ‘all’ as a Cow_Batch. That’s easy enough to populate myself, but I’d like the contents of ‘all’ to update automatically when new cows are added to the herd. The end purpose is to be able to use:

class Vet_Visit(models.Model):
    cows_brought_to_vet = models.ForeignKey(Cow_Batch)

and have ‘all’ as a valid possibility, among others.

  • 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-13T03:31:03+00:00Added an answer on June 13, 2026 at 3:31 am

    I think you can make use of django post_save signal for Cow model. In the signal handler when new Cow is added, you add it to all Cow_Batch.

    Django Signals

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

Sidebar

Related Questions

I have the following model: class A(models.Model): name = models.CharField(max_length=50) content_type = models.ForeignKey(ContentType) This
I have a following model: class Car(models.Model): make = models.CharField(max_length=40) mileage_limit = models.IntegerField() mileage
Suppose I have the following models: class User(models.Model): pass class A(models.Model): user = models.ForeignKey(User)
Suppose I have the following Event model: from django.db import models import datetime class
Suppose I have the following model definition: class Image(models.Model): image = models.ImageField(upload_to='images') Now further
The scenario Suppose I have the following two model classes: public class ProductColor {
Suppose the following model : class Product include MongoMapper::Document key :name, String key :product_category_id,
Suppose I have following class @Entity public class Customer extends Model { @Id public
suppose we have a model in django defined as follows: class Literal: name =
I have the following model class: class Test(db.Model): name = db.StringProperty() I am supposed

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.