overriding admin field label content in django - django

I am using admin forms for the CRUD operations. However, I want to add certain characters in the labels generated by the admin. For example, * in case the field is required. How can I accomplish it?
I can directly go into django admin code and add the * in there (in the file contrib/admin/helpers.py in this case) But it is not the right way. How can I do it?

There's no "great" way to do this, so your options will be css (add background img), subclassing form, template tags, or template modification. There are some good answers to this previous question here:
How to render form field with information that it is required

Related

Sitecore 6 WFFM: How to hide fields?

In Web Forms for Marketers, I have a few fields that I am using to pass values to the pipeline processors and to append CSS code to the form.
I don't want these fields to appear on the form. How can I mark a field to be invisible? Right now I am doing this via CSS, but I am quite sure there must be a better way to do so.
Thanks!
You can extend the Single Line Text field class and change the container CSS class to your own CSS class that hides the field and label. You can also add value to that field when the form is loaded through the querystring.
I believe there is a Hidden Field type in WFFM. Could you use that?

Django admin: 'add' page, want to add multiple objects on one page

class Country(models.Model):
name = fields.CharField()
In admin, I want to display multiple forms for Country so I can add multiple different country objects at once. I don't know where to start? Please help, thanks.
I can't think of any way to do this inside the admin. The admin is a ready-made interface for editing single objects (and, optionally, multiple objects related to that object), but doesn't give you any way to edit multiple objects at once.
If you need this, write your own view using a formset.
My idea is you could extend the admin template change_form.html to display a formset, and have the 'add' url point to a view that would handle the page rendering. You will also need to override the url in your urls.py. Not the best but it would work.

How customize fields in the Django admin interface

I have a model in my Django project with a member which is a char field. Basically data in this field will be entered as comma-separated values.
Without a long-winded explanation of what the overall goal of this is, basically rather than having the admin interface use a simple text field, I'd rather have have some custom HTML for the form so I can just use checkboxes and assemble the values of the checked boxes into a CSV string myself once the form is submitted.
Most of the django customization I was able to find on Google didn't answer my particular problem.
If I understand your question correctly I think you want to search for writing custom widgets. Perhaps start here: http://docs.djangoproject.com/en/dev/topics/forms/

Django admin output extra HTML in ModelSite

Ultimately, I want to add an <iframe> to the display of a particular model on Django's admin page. Django is already rendering the form for this model correctly, but I want to add this <iframe> in addition to Django's form. The src attribute needs to involve the primary key for the currently-displayed record.
I've learned how to properly override the change_form.html template through Django's documentation, and I can add markup to the right block, but I can't figure out how to access the primary key value. (No amount of determined Googling has helped at all.)
Alternatively, is there a direct way to specify that I want to produce extra output in my ModelSite definition?
Overriding "change_form.html" is the right way to go. You can access the current object with
{{ original }}

Django Admin Template Overriding: Displaying checkboxselectmultiple widget

Have 2 tables Domain and Group having one to many relationship.
These tables have many to many relationship with User table
On the User admin interface I am rendering the Group and Domain as CheckboxSelectMultiple
widgets.
Is it possible to present this in a table form with 2 columns: Domain in one column and the list of groups belonging to the domain in the other column.
I want to override the fieldset template of the admin. However I am having difficulties knowing which methods/properties I can use with an AdminField.
Thanks
I'm not quite sure I 100% follow what you are trying to display.
AdminField is not documented unfortunately but its a short class, only 18 lines long so you can read it here.
I have a feeling you might be trying to step beyond what the admin allows you to do easily, once you are trying to combine more than two different models on the same page things can get a bit messy and you are soon in the business of customizing the admin by writing custom views and templates.
Am I correct in thinking you want to change the list of the objects? Rather than changing the editing/creating page?
I had similar problem and what I did is that I created new html pages and copied the same code from the Admin Template directory HTML pages to my template directory which will be overridden automatically, and then changed the HTML code to what I wanted to be. hope this is useful.