Tutorial by Examples: admin

Suppose you have a simple Customer model: class Customer(models.Model): first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) is_premium = models.BooleanField(default=False) You register it in the Django admin and add search field by first_name...
Mage::getSingleton('admin/session')->getUser();
You can get rid of manage.py and use the django-admin command instead. To do so, you will have to manually do what manage.py does: Add your project path to your PYTHONPATH Set the DJANGO_SETTINGS_MODULE export PYTHONPATH="/home/me/path/to/your_project" export DJANGO_SETTINGS_MODULE...
Add the following code to functions.php to remove it from everyone except the Administrator user level: add_action('after_setup_theme', 'no_admin_bar'); function no_admin_bar() { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); ...
Everything you need to get started with Django admin is already setup in Django's default project layout. This includes: # settings.py # `django.contrib.admin` and its dependancies. INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes',...
Another way to hide admin bar is to add if ( !current_user_can( 'manage_options' ) ) { add_filter( 'show_admin_bar', '__return_false' , 1000 ); } The users who don't have privileges to access Settings page, won't be able to see the admin bar.
class MyDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar' ); private static $has_one = array( 'OtherDataObject' => 'OtherDataObject' ); private static $summary_fields = array( 'Name', 'OtherDat...
class MyAdmin extends ModelAdmin { ... function getEditForm($id = null, $fields = null) { $form = parent::getEditForm($id, $fields); if ($this->modelClass == 'MyDataObjectName') { $form->Fields() ->fieldByName($this->sanitis...
When you created your own Models in a app, they still need to be registered in order to become available in the admin pages. This is done in the admin submodule. If your app was created using manage.py startapp, an admin.py file should already lay in you app module. Otherwise create it. #myapp/a...
Here is a workaround to temporary reset your password for your account. Login to your hosting panel and use the database tool that is available (probably PHPmyAdmin). Load the appropriate database and then go to the jos_users table. (The database prefix might be different for your case). ...
4.0 #requires -RunAsAdministrator After trying to run this script without admin privileges, you will see this error message .\script.ps1 : The script 'script.ps1' cannot be run because it contains a "#requires" statement for running as Administrator. The current Windows PowerShell s...
Django Admin comes with some Models registerd by default. There a some occasions where you might want to remove a Model from the admin pages. This is done in the admin submodule. If your app wass created using manage.py startapp, the admin.py file should already lay in your app module. Otherwise cr...
We can use the get_bloginfo function to retrieve the email address of the site administrator. <?php echo get_bloginfo('admin_email'); ?>
Developers can use admin_bar_menu action to remove items from WordPress admin bar or toolbar. add_action('admin_bar_menu', 'remove_wp_logo_from_admin_bar', 999); function remove_wp_logo_from_admin_bar( $wp_admin_bar ) { $wp_admin_bar->remove_node('wp-logo'); } Above code removes WordPr...
Merge JS and CSS Files This particular tweak will reduce the number of HTTP requests on your eCommerce site. [box type=”alert” border=”full”]Note: This can sometimes break some applications. After performing the following steps, please ensure that the site still performs as it did before enabling ...
You can add below hooks to add your own logo and link to replace default wordpress logo. To add custom logo function custom_login_logo() { echo '<style type="text/css"> h1 a { background-image: url('.get_bloginfo('template_directory').'/images/custom-logo.png) !important; backgro...
As you can see the layout of this gem is very catching and user friendly.
BITSADMIN was used to transfer documents, download website, download files from websites, etc... This command is a deprecated command, and may be removed on next Windows updates. To prevent this issue, use the new Powershell BIT cmdlet. Here is a sample code utilizing BITSADMIN. @echo off Bitsa...
At first initilize the firebase sdk and admin SDK const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp({ credential: admin.credential.cert({ //your admin credential certificate generated from the console. Follow this [link][1]...
from django.contrib.auth.models import User class UserAdmin(admin.ModelAdmin): list_display = ('email', 'first_name', 'last_name') list_filter = ('is_staff', 'is_superuser') admin.site.unregister(User) admin.site.register(User, UserAdmin) We need to unregister before regis...

Page 1 of 1