Change UserCreationForm description in django - django

I created my own user class according to:
https://docs.djangoproject.com/en/1.7/topics/auth/customizing/
Having this user created I would like to change description of the creation form. For now it's "First, enter a username and password. Then, you'll be able to edit more user options.".
Here's a screenshot:
I checked all meta fields and found how to change label of field but still can't figure out how to accomplish change of form description.

That's not in the form at all, it's just in a template:
https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/auth/user/add_form.html

Extension of Daniel answer:
The Django template engine has a defined order for loading templates. When it loads a template, it uses the first template that matches the name. You can override admin templates by using the same directory structure and file names.
You can add a custom admin template in the next steps:
Add template in the root of your project
Include the templates (settings.py)
Enjoy :)

Related

Django-cms aldryn forms

I'm following this tutorial (https://www.django-cms.org/en/blog/2016/02/27/build-a-website-without-knowing-python-django-part-six/) to create custom forms with aldryn-forms but this tutorial, I believe, was made for django-cms.org online service and would like to know how to do the same with a local installation of django-cms.
Essentially, I want to know how to define my own "FORM TEMPLATE" for this plugin.
Thank you
Once you install Aldryn Forms in your project you can set the ALDRYN_FORMS_TEMPLATES setting in your settings.py with an iterable of tuples mapping the template path with the human readable name of the theme like so:
ALDRYN_FORMS_TEMPLATES = (
('path/to/event_form.html, _('Event only')),
('path/to/contact_form.html, _('Contact only')),
)
This allows content managers to pick this "Event only" template whenever they create an "Event" form and "Contact only" whenever they create a "Contact" form.
Also you can set the default template using ALDRYN_FORMS_DEFAULT_TEMPLATE

Joomla 3 articles category template override not working

I try to override an article category template with file newslist.php located in \templates\mediavolga\html\com_content\category\newslist.php
I set this file as alternative layout in category settings, but it does't works.
What I'am doing wrong, how to override default category blog template?
If you want to override the default category blog template, then it needs to have the same name as the default does. Try this:
1) copy all the files in components/com_content/views/category/tmpl/ into the folder \templates\mediavolga\html\com_content\category\
2) edit them and add an "echo 'this is my override blog.php'" to the files. If you see the output, then you can start modifying it.

Django Grappelli Rearrange Inlines id override

According to the docs:
http://django-grappelli.readthedocs.org/en/latest/customization.html#rearrange-inlines
The two classes for the placeholder are important. First, you need a class placeholder. The second class has to match the id of the inline–group.
All's well and good, I was able to set up my inlines fine, my issue is now - where does grappelli get the "id of the inline group" I can't find any reference, and pouring through the source code is offering me no solace.
Simply, I want to change the element-id that grappelli is using. Currently, it looks to me that it is taking the object name itself and converting to a lowercase name and appending set to the end. Do we have access to override the "id of the inline-group"?
Also, I am not 100% sure exactly how (or where) grappelli is doing this, it is definitely not documented... at all in fact.
Any help would be much appreciated.
It is the id of the inline element on HTML page. You can check the id of the default HTML inline element.
<div id="[related_name of ForeignKey]-group">
For example:
If in model "MyModel2", you have a ForeignKey like this:
my_model_1 = models.ForeignKey(MyModel1, related_name='my_model_2')
Then the id should be "my_model_2-group".
The id of the inline group is set in grappelli/templates/admin/edit_inline, in stacked.html line 5, or tabular.html line 6 (depending on which type of inline you're usng):
id="{{ inline_admin_formset.formset.prefix }}-group" >
You can override this by copying the file (stacked.html or tabular.html) into your template directory and setting the variable "template" to the file's new location e.g.:
# admin.py
class MyModelInline(admin.StackedInline):
template = 'path/to/stacked.html'
...
Then edit whatever you want in e.g. stacked.html.
I don't know if this is the best-practices way of doing this, but it's similar to what's done in the django tutorial.

Customising specific fields in Django Admin change form

I have a couple of fields in my model that to which I wish to add a link that will allow the user to search for names/files (external from the application's database).
So what I would like is:
Field name: [text box] - LINK
Is there a straightforward django way of achieving this?
Cheers.
You need to change the widget that the form field uses to display the models information. You basically add some html after the input to link to where you want.
Here's some code I put together to create a widget that displays how many characters are left for a CharacterField so it's similar to what you are looking to do:
https://github.com/pastylegs/django-widget-charsleft/blob/master/widget_charsleft/widgets.py

drupal7 page template for profile2 module

I want to present User fields from the profile2 module in drupal 7 in a custom template file.
I can edit profile2--bewerbungsprofil.tpl.php (where bewerbungsprofil is the name of the profile2 type) - but i want to edit the page.tpl.php-type output, so I have control over head and footer of the resulting html file.
Is there a special naming convention, like page--profile2--bewerbungsprofile.tpl.php, or is there some other way?
Try: page--profile-bewerbungsprofil.tpl.php
Here is a link to explain how template overrides are named
[[http://drupal.org/node/1089656]]
I think what you'd want to do is copy any tpl.php files into your local theme (sites/all/themes/yourtheme).