Joomla 3 articles category template override not working - templates

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.

Related

Change UserCreationForm description in 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 :)

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.

Opencart product.tpl

Where did I miss to add a line of code if I try to echo php variable inside OPENCART product.tpl file and it doesn't show up on site?
Notes: there is a field in database. I am able to save to this field from admin panel ( i added a custom field there).
Did You edit also the product controller to load the variable and pass it to the template? I guess not... Edit catalog/controller/product/product.php and add $this->data['MYVARIABLE'] = $product_info['MYVARIABLE']; somewhere before $this->render() is called.

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).

Styling certain admin change list rows

Is there a straightforward, common way to apply custom styling on admin change list element depending on its properties?
update
To be more precise: let's say I have a simple model object.
Foo
field1
field2
field3
#property
property1()
#property
property2()
ModelAdmin.list_display is defined as a subset of the available fields, so not every attribute (field/property) is displayed in the change list table.
I'd like to apply custom CSS class to the object's row when certain condition is fulfilled, for example: if foo_instance.property1 is True then add class bar to the corresponding tr element.
Now copy the template admin/base_site.html from within the default Django admin template directory (django/contrib/admin/templates) into an admin subdirectory of whichever directory you're using in TEMPLATE_DIRS. For example, if your TEMPLATE_DIRS includes "/home/my_username/mytemplates", as above, then copy django/contrib/admin/templates/admin/base_site.html to /home/my_username/mytemplates/admin/base_site.html. Don't forget that admin subdirectory.
Note that any of Django's default admin templates can be overridden. To override a template, just do the same thing you did with base_site.html -- copy it from the default directory into your custom directory, and make changes.
from django's tutorial
What exactly do you mean by "change list element" and "it's properties"? Using CSS 2 or CSS 3 selectors you can do some things. Otherwise, you might be able to do it easily using jQuery (or whatever). Since it is merely presentation related, I think this would be the cleanest solution.
Old question but if you stumble across it, the following tips might be helpful.
You can use django-liststyle to customise your admin changelist rows.
It's quite simple to implement your example:
class FooAdmin(admin.ModelAdmin, ListStyleAdminMixin):
...
def get_row_css(self, obj, index):
if obj.property1:
return 'bar'
return ''
Django Suit (not free) also offers "List row and cell attributes" style customisation