I am working on an app that needs to send emails to multiple users. Users are picked from a separate admin page, then a newsletter object is created in “send newsletter” action and an HttpResponseRedirect is returned to the admin edit page for the newsletter. What I want to do is instead of having a multiple select list for the recipients (there are too many addresses in the list for it to be of any use) I just want to have a div that lists the selected email addresses for reference, without any ability to edit. How do I do that?
Not sure why this is relevant, but the Newsletter model looks something like this
class Newsletter(models.Model):
owner = models.ForeignKey(User, related_name='+', blank=False)
sent = models.BooleanField(default=False)
date_created = models.DateTimeField(auto_now_add=True)
date_sent = models.DateTimeField(null=True)
subject = models.CharField(max_length=255)
content = HTMLField()
recipients = models.ManyToManyField(Email, related_name='+')
class Meta:
ordering = ['date_sent', 'date_created']
There are no views, what I want is to display recipients as non-editable list of email addresses in django admin. I don’t want to just disable the widget, since there are too many emails in the Email model, I just want the ones selected for this particular newsletter listed somewhere on the admin edit page.
Easiest way: a readonly field.