So I have been looking at different examples using multi-object forms where 
you bring in objects of different classes. I also looked at formsets but I 
don't think these fit what I want to do.


class Alarm(models.Model):
    location = models.ForeignKey(Location, related_name='alarms')
    owners = models.ManyToManyField(User, related_name='users')
    #active = models.NullBooleanField(default=True, blank=True, null=True)
    trigger = models.CharField(max_length=25, blank=False, null=True)
    critical_low = models.DecimalField(max_digits=10, decimal_places=3)
    critical_high = models.DecimalField(max_digits=10, decimal_places=3)


I want to present the user with a form that allows the user to select 
multiple locations without storing the locations in the one record (avoid 
using many to many relationship).  I want it to create as many alarm 
records as there is locations selected. So if location 1 & 2 is selected, 2 
alarm objects will be crated/saved with the exact  same data for owners, 
trigger and low/high fields.

I'm relatively new to Django and don't know how to approach this.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to