FAQ Database Discussion Community

Django admin list display optimize queryset

In User model i have a method: @cached_property def income(self): return PartnerIncome.objects.all().aggregate(Sum('income'))['income__sum']*self.share_of_profit PartnerIncome model: class PartnerIncome(models.Model): title = models.CharField(max_length=255) income = models.FloatField(default=0) Now i want to show 'inccome' in list_display=('income', ) at admin panel, but each object make extra query to database. How i can make PartnerIncome.objects.all().aggregate(Sum('income')) as a global...

How to get checkboxes to repopulate using xenforo options

Im using the following function in XenForo and the checkboxes are created for each node and the chosen options are saved in the db, but when the option is reloaded, the saved values are not being repopulated in the form. Option: <option option_id="hc_watched_forums_list" edit_format="callback" data_type="array" can_backup="1"> <default_value>a:6:{i:0;s:1:"4";i:1;s:1:"5";i:2;s:1:"6";i:3;s:1:"7";i:4;s:2:"36";i:5;s:2:"38";}</default_value>...

Django admin aggregation

I'm using Django to manage deposit,but I found a problem, there is a medel looks like: class Deposit(models.Model): user = models.ForeignKey(User) money_re = models.DecimalField(max_digits=11, decimal_places=2) ... I want to add a sum of money_re in the model to the admin change_list page in the right-bottom of the page. Is there...

systemd kill my processes before ExecStop completed

I'm trying to update my application to use it with systemd. When I have used Upstart, I've just create a /etc/init.d/myService script: #!/bin/bash #chkconfig: 2345 90 10 #description: myDescription ### BEGIN INIT INFO # Provides: myService # Required-Start: sshd # Required-Stop: sshd # Default-Start: 2 3 4 5 # Default-Stop:...

Admin set to true not working on Rails after forgetting to register first the admin email in app

I have created a users' registration/signedup through Devise gem. To give a user an admin role I've added a new column in users table (giving the command in the terminal followed by rake db:migrate) named "admin" and set all to "false" by default: class AddAdminToUsers < ActiveRecord::Migration def change add_column...

Django UserAdmin customization

Within my Users page, I would like to add more column fields to display for each user. By default, the User page shows username, first name, last name, email, and staff status, but I would also like to add the column "Chosen Groups" to be displayed as well. Each user...

In OpenCart, How can I customize the info visible on the product page

Okay, first I want to say that I am not a geek programmer. I am intermediate to programming. I was recently learning Php through teamtreehouse, which I have not finished yet. But instead I started making an online store from OpenCart. I watched some youtube videos and added some products,...

Magento fronted - file not found when admin hosted on different server

My website divided in 4 server. Fronted - front.mysite.com Admin panel - admin.mysite.com CDN for Images - cdn.mysite.com Database server When I upload new product images. It will auto sync on CDN server from admin server. So media folder exits on Admin and CDN server only not in fronted server....

Can't login to Magento admin panel

For test and development, I duplicated our Magento shop to a sub-domain. mysql -u root -p -e "USE bitnami_magento; UPDATE core_config_data SET value ='http://subdomain.site.com/' WHERE core_config_data.path = 'web/unsecure/base_url'; UPDATE core_config_data SET value ='https://subdomain.site.com/' WHERE core_config_data.path = 'web/secure/base_url'; Everything works, but not the admin Login. On the login page we get...

How to install npm packages to current working directory?

I want to install coffee-script to my current working directory. Therefore I run: npm install coffee-script Unfortunately an error is thrown npm ERR! Error: EACCES, symlink '../coffee-script/bin/coffee' npm ERR! { [Error: EACCES, symlink '../coffee-script/bin/coffee'] errno: 3, code: 'EACCES', path: '../coffee-script/bin/coffee' } npm ERR! npm ERR! Please try running this command...

Changing the label for the module when registering on Django admin

I have a package (Django app) named book_author_publisher_category. This name is just to clarify, because I have these four models inside this app for they have some constraints. Is there a way of changing the label of the section containing these models that I registered on my admin? My book_author_publisher_category/admin.py...

HDP Cluster | SSH password less connection failing

I had installed HDP 2.2 distribution in my hadoop cluster. Before installation we completed all pre-requisite that are required i.e. setting up password less connection,making ip table off etc. After this installation was successful. Recently when i was installing another service in my cluster where password less ssh connection was...

Testing custom admin actions in django

I'm new to django and I'm having trouble testing custom actions(e.g actions=['mark_as_read']) that are in the drop down on the app_model_changelist, it's the same dropdown with the standard "delete selected". The custom actions work in the admin view, but I just dont know how to call it in my mock...

Django Admin tables not displaying correctly

Has anyone seen this before? I've tried making new apps, projects, etc. All thats in my admin.py file is: from django.contrib import admin from . models import UserProfile, Tribe, Membership # Register your models here. admin.site.register(Tribe) admin.site.register(Membership) admin.site.register(UserProfile) I've not got any static files or css in the app..?...

Devise Giving Admin Privileges to Destroy

Just added an Admin model to Devise. I am on Rails 4. I would like to give the Admin privileges to destroy and update articles that other users have created. Having trouble finding documentation on how to do so. Right now I have this on my index page, which allows...

add 2 more attribute values to the magento order view page section

in the magento admin panel, if we go for Orders section and if we click on one order, we can see the Product name and sku at the bottom. i want to add 2 more attributes to the order section. please help me to find solution. thanks in advance....

Request file access permission

I'm trying to create a program that uses SpeechSynthisizer to save some speech to C:\speech.wav, but I get an error that I don't have permission to do so. I would like to know how I am able request admin privileges for my program, so that I will be able to...

Can't create user in MySQL 5.6

I want to create a user, which will be an admin in my classicmodels database. I want that my admin user can create other user accounts and assign them only to classicmodels database. I have already done the following steps: logged as root create user [email protected]'%' identified by 'qwerty'; grant...

Disable Parallels Plesk Panel admin account

In Plesk Panel you have always an Administrator account with the username "admin". I did not find any setting to change the username to something else than "admin". I don´t like the idea that someone can try to login with the username "admin" until he find the correct password. Is...

drupal commerce kickstart admin access denied

I am new to drupal and I have completed the installation process for commerce kickstart in my Ubuntu system. The thing is that when I am trying to access the admin page i get an error "403 access denied". I am using the predefined Username and password which is admin...

foreign key is not equal to primary key

So my query looks like this `$dbUser = "SELECT * FROM accaount, role WHERE Username = :username AND Password = :password UNION SELECT * FROM role , accaount WHERE Role_idRole = idRole "; $query = $conn->prepare( $dbUser); $query->bindParam(":username", $Username); $query->bindParam(":password", $Password); $query->execute();` The mistake is UNION SELECT * FROM role...

Create an .inf script to open a batch file as administrator

I`ve been looking around the web for a tutorial on how to make .inf scripts so I can execute a batch file from it. The problem is that the batch script needs admin to run so i have to get that in some way. Here is my code: :start echo...

Cannot access my magento admin after change in admin secure category “http” to “https://”

Cannot access my magento admin after change in admin secure category "http" to "https://" this is the error: 404 Not Found The server can not find the requested page: EXAMPLE.COM/index.php/admin (port 443)

How can I add a Submenu to the WordPress Admin Bar

I need to add a dropdown menu to Wordpress in the admin bar to include multiple links. What is the best solution?

Magento : Admin Page No Display

I need some help, how can I debugged this, since it has no display. How can I see the error of it? Thank You!

change custom product tab position in admin grid Magento

Hi i have added a new product tab in admin grid by following the below link http://inchoo.net/magento/how-to-add-custom-product-relations-in-magento/ Everything is working fine. BUt this has added the new tab at the last position in product edit section. Can you please suggest me how can i change the position of that tab....

Django Admin Adding data

I am trying to learn Django through Coding for Entrepreneur. The problem is in the tutorial, when the tutor adds the models in the admin.py, the values of the fields are shown. While I do it, it shows "something object" only. models.py from django.db import models class Join(models.Model): email =...

Two login screens or one with restricted permissions?

I need this login screen http://getbootstrap.com/examples/signin/ to the client (user) and standard Admin screen for the back-office (manager or director, for example). The first screen, which is for the client (user) allows it to choose and buy your products on the site, and the second is the normal Admin. Question:...

Laravel 5 Entrust one route - load different controller based on Role

So I'm just starting to learn Laravel and I've implemented the Entrust Role Permission package, which works really well. Now my question is, I'd like to have a 'Dashboard' page like so: example.com/dashboard. The thing is, I'm not sure how to set this up. Since In my App\Http\Controllers folder I...

Wordpress Password Encryption

I am not familiar with Wordpress so sorry if this is a stupid question. For some reason, when a user logs in to admin (or is registered), her/his password is sent to the database in plain text. I have read that one should not use MD5 with WP, but use...

How can I access Windows SBS 2008 without the admin domain password or boot disk?

I have an old Dell Poweredge T100 from my fathers old business running Windows Small Business server 2008, however I do not know the admin password nor do I have the boot/windows install disk. Is there any possible way to access the server or reset the admin password? Bare in...

Operand should contain 1 column(s)

So I am trying to write a SQL statement as follows... I need to Find a list of artist names, the number of CDs they have produced, and the average price for their CDs. Only returning results for artists with more than one CD. Problem is every time i think...

Wordpress submenu_page variable

I'm working on a wordpress plugin for a school project, but currently i'm stuck at one point. I used to have my code on a regular html/php site, not in wordpress. I generated a link with a variable which could be used on the site. How can i do this...

Add django class based view to admin site

I have created some forms using class based views, now I like to add them to the Django Admin site. I have only found this link which describes adding normal views to the Admin site.

Run Alfresco Java code as Administrator

I'm trying to implement an action in which I will add permissions to all parent nodes. However, I need to run as admin to manage the permissions. Currently my code looks like this: permissionService = serviceRegistry.getPermissionService(); //Read the username of the current user final String loggedInUser = authenticationService.getCurrentUserName(); ChildAssociationRef childAssociationRef...

Error in laravel 4

When i try to log in , it redirects me to www.example.com/admin/{username} but it shows a NotFoundHttpException error. Thank you in advance! The routes.php file Route::get('/admin', '[email protected]'); Route::get('/logout', '[email protected]'); Route::get('profile', function() { return "welcome! Your username is" . Auth::admin()->username; }); Route::resource('sessions', 'SessionsController', ['only' => ['index', 'create', 'destroy', 'store']]); here is...

How do I add an arbitrary link to the WordPress Admin Menu?

I am looking to add an arbitrary link to the WordPress Admin Menu. Example: | Dashboard | | Posts | | Media | | Custom Arbitrary Link | The functionality of this acts just like a normal button but when you press it it redirects you to any URL given...

Can't get access to configuration.php Joomla 2.5

Got a site to make some changes. Unfortunately I can't get an access to www/root/configuration.php . Suppose the file was blocked by another user who had admin rights. Am I right?

Django : admin hide add button

Is it possible to hide the "Add another" link but keep the "Save and continue editing" button to have the possibility to add other lines ?