Magento admin product edit page remove or change for quantity attribute - admin

Who know how can I remove or modify quantity attribute in admin product edit page!
I check the magento doc for product_form.xml forUI component, I have changed qty successfully in advance stock page, but for main page quantity I didn't find out where I can change it, some people can help me?

Related

How to filter queryset of a foreignkey field in Django Admin

I have a scenario like this, I have 3 models: Category, Subcategory and Posts.
-Category is One to Many to Subcategory and Subcategory is One to Many to Posts.
My models.py looks like this (minified version).
class Category(models.Model):
cat=models.CharField(max_length=10)
class SubCategory(models.Model):
subcat=models.CharField(max_length=10)
class Posts(models.Model):
cat=models.ForeignKey(Category)
subcat=models.ForeignKey(SubCategory)
title=models.CharField(max_length=10)
I want to publish a post from admin in which I only want the queryset of subcategories based on selected dropdown from category. Like, if I select Django from dropdown in "Add Posts" section in admin, it should only give me subcategories which were linked to Django(or whatever I choose from dropdown).
I have tried searching a lot and the best I could find is render_change_form. But the problem with render_change_form is, it requires condition for filtration which I don't have as I want the Category from the form itself(based on dropdown selection).
I am not really sure if it's even possible in django.
You have to either write your own custom javascript. So whenever category is selected, subcategory dropdown will be populated based on some ajax hit.
You may also have a look at django autocomplete light.
I have used it many times in my project. Your requirement can be achieved using forward argument(send category to subcategory.)
Hope this helps.

In django, can I show post's permalink in admin page?

I have a model called Post for my Blog application in Django. I have a slug field that is prepopulated by the title field. (I also use the get_absolute_url method, if that matters). What I want is to be able to see the permalink, of course without being able to edit it! Just readonly. I also believe that this field will be empty when I create a post, so only visible-active when I update a post.
Thanks in advance.

Drupal 8 - Show all articles from same author

I'm new to Drupal.
I added articles using the user 1 account and using another authenticated user. When I click on the author name, it shows me the status of the user.
How do I show all articles from the same author?
you can create a drupal view
/admin/structure/views/add
display all fields you like from the article and filter with author
You can even exposed the filter

How to disable coupons from a certain category in opencart?

It may be a dumb question, but how can I disable coupons from a certain category in opencart 1.5.6?
Thank you.
When you create a coupon from the admin panel, there is an option for coupon to add particular product and particular categories for that coupon.

How to modify the way a ForeignKey field is rendered in a Django admin page to avoid browser crash?

I have a Customer model which contains a ForeignKey to a Contact model.
I have over 100,000 contacts in my DB and when I load the admin page for a specific customer, the dropdown menu for the contact is getting populated with ALL of the contacts in the database. This has recently, due to its shear length, started causing my Firefox to crash while the admin page is loading.
Is there a way to either:
replace the field with an integer
field I can manually modify to the
contact ID when necessary
replace the dropdown menu with some
alternative input method which won't
crash the browser
remove this input
from the Customer admin page
altogether
Thanks!
You can do any of the either of things you want to.
Simplest solution is the exclude the field from the admin. Just say so in the admin class.
You can change the field to be text input and display it's primary key rather than the item itself, by including it in the raw_id_fields of the admin class.
You can also replace the standard dropdown widget with the Auto complete text field input. Use the implemented widget, or other equivalents. - This is probably the solution you like the best.
You can also override the formfield_for_foreignkey method on the Admin model to customize the queryset that gets displayed in the foreign-key dropdown. You may want to checkout my implementation for displaying only the current User's (or subdomain's) added entities.
Sounds like specifying the contact field in raw_id_fields in your admin.py entry for the relevant model would sort you out. Docs are here.
PS. Surprised (but not that surprised) that FF gives out before your database server tanks...