I have models for the following:
Country
Prov/State
City
Region
Community
Is there a way in the Django admin to filter the values in the select boxes based on the selection in the previous select box?
eg: I select Canada in the country select box, then in the Prov/State select box I am only presented with the Provinces. Once that is selected, the City select box only presents cities within the Province selected. etc...
I have been looking at the formfield_for_foreignkey, but I haven't been able to get it working just yet. I may not be understanding the use correctly.
Thanks
As I suspected, it appears that I will have to dig into something based on the Ajax framework to do what I want to do. For those interested, the following are links to some sites that I found to be somewhat useful.
DajaxProject
Dojo
If anyone has any other suggestions, please let me know.
Related
I have to create a custom page for only one product with declinations, so I have created "product-158.tpl" file with a new hook for a new module. (158 is the ID of the targeted product)
The page works well when the product is not to complicated to select, but if I need declinations as color or size, the new layout is replaced by classic product.tpl version and every customed things desapeared. The problem comes when the hidden "refresh" button is trigged and the "add-to-cart-or-refresh" form is submitted. If I erase the hidden button, I can select what I need to select, the cart recognise my order, I can buy the right declination, but If I click the "continue shopping" button, the same problem is displayed.
The problem comes when url change, maybe because of the new ID of the product, I really don't know. I'm searching from two month.
Thanks a lot to who will help me.
Why not park the base tpl, and call your hooks, and apply only changes that the product ID is 158?
Regards
I'd like to implement select all button (e.g select all and deleting) in Django 1.9.7 but I can't find any post about it in Google Since, I'm not a non-native-english person, I'm not good at googling in correct english. Could anybody give me advices or keywords so that I can googling based on it?
Well this depends on how you implemented your table with Django. Putting javascript/bootstrap/etc aside, there are some samples on how you can implement select all in javascript. Like this.
Deleting those items requires defining a form and processing it's data in the serverside and deleting your model items. This also depends on how you are passing data between your view and your model.
I'm working on a webshop using OpenCart2.x. I would like to add category while I'm adding product and assign product to that category.
Just to clarify... Let's say I want to add "HTC One" to category "Android". I would like to go to Catalog > Product > Add Product, enter "HTC One" details and
if category "Android" dosen't exist OC should offer to create new category.
It is possible in wordpress/woocommerce so I hope it is possible in OC2.
Sorry if the question is not for this site.
Thank you!
No, this is unfortunately not possible in vanilla OpenCart. However, I did find somewhat of a trick to make this process a tad bit more convenient.
If you open your OpenCart admin panel in 2 different browser instances that use different sets of cookies (different browser or incognito/no cookie mode) you can make your categories in one instance and then the category auto complete list in your product creation page will instantly update. Not exactly the desired functionality but definitely better than having to switch back and forth.
I'm just facing the problem that I need to describe the available choices I'm adding to the model.
class Limitation(models.Model):
METHOD_CHOICES = (
('sl', 'Soft Limit'),
('hl', 'Hard Limit'),
)
#...
I'd like to display something like...a help-text...if you're selecting an option. So if the user is selecting "Soft Limit" I'd like to show "Allows save operation, will notify admins, will deny any further operation...bla bla bla".
Is there anything already built in django available? Or maybe a lightweight workaround?
Well, the selects generated by django are just selects. Where would this help text be displayed with select? Html5 allows title attribute for all elements (http://www.w3schools.com/tags/att_global_title.asp). But for this element to be displayed you would have to create your own django widget for that. A widget, which accepts not only choices, but choices and help texts. And then renders them as option titles.
That is as lightweight as possible, i guess. Use some js library to make those helptexts pretty too and you are set :)
Is there any way in Joomla2.5 to create Home/Landing Pages (ie. "default") pages for each category.
For example, I would like the user to be able to go to www.somejoomlasite.com/category1 and see a default home page for category1, and a different home page for category2 and so on. Is there any way to achieve this? Could I create an article under each category and set it's alias as index? or will I get an error about having duplicate aliases (even though they are under different categories)?
Any help is greatly appreciated. Please let me know if I need to provide further info.
An alias has to be unique within a category. So you should be fine using the same alias in different categories.
You should be able to achieve a structure like you described with menu items for each category. And of course SEF needs to be turned on with rewrite enabled.
The menu items don't need to be visible on the page, you can also create a "hidden" menu. Just don't show the accompagning menu module.
These menu items can be anything: a category list of the articles, an article itself, a featured list of articles in a category or whatever you like.