Saturday, August 30, 2014

Re: Change "Add another" text in inline views

Hi Mike,
On 31/08/14 15:46, Mike Dewhirst wrote:
>> i.e. the related object is optional, not provided by default, and at
>> most there can only be one. You'll note that despite max_num being set
>> to 1, it still says "Add//another". Is it possible to delete the word
>> "another" from that text to make it more sensible? (Better yet, can it
>> drop the word "another" when the count currently sits at 0 since
>> "another" implies an object of that type already exists?)
>
> I'm somewhat interested in your success with this because I enjoy it
> when the user interface helps the user understand the software. But I
> think you might have to dig a little deeper for a nice solution.
>
> I found where the Admin has "add another" ...
>
> Searching for: add another
> options.py(945): msg = _('The %(name)s "%(obj)s" was added successfully.
> You may add another %(name)s below.') % msg_dict
> options.py(983): msg = _('The %(name)s "%(obj)s" was changed
> successfully. You may add another %(name)s below.') % msg_dict
> widgets.py(262): % (static('admin/img/icon_addlink.gif'), _('Add
> Another')))
> Found 3 occurrence(s) in 2 file(s)
>
> ... which all looks interesting but maybe too big a job for the
> anticipated benefit.

I'll admit I didn't think to just do a grep of the file structure. When
I do it I get:

> /usr/lib/python2.7/dist-packages/django/contrib/admin/locale/en/LC_MESSAGES/django.po:msgid "Add another %(verbose_name)s"
> /usr/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/edit_inline/tabular.html: addText: "{% blocktrans with inline_admin_formset.opts.verbose_name|capfirst as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}",
> /usr/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/edit_inline/stacked.html: addText: "{% blocktrans with verbose_name=inline_admin_formset.opts.verbose_name|capfirst %}Add another {{ verbose_name }}{% endblocktrans %}"

The latter two being the HTML templates used for the stacked and tabular
inline widgets. I guess that's a starting point then. :-)

Regards,
--
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
...it's backed up on a tape somewhere.

--
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+unsubscribe@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5402B8C9.5020606%40longlandclan.yi.org.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment