To install python with specific version in virtualenv use the following command
virtualenv --python=/usr/bin/python3.2 MyEnv

 

Using multiple model in django form

Posted In: , . By CreativeSolutions


 To use profile model with user form we need to initialize the form fields in the form. Then to get the values on edit we need to initialize __init__ function and passing the profile object from the view

 Ex: forms.py
 class SuperUserEditForm(forms.ModelForm):
    birthday = forms.DateTimeField(input_formats=['%Y-%m-%d %I:%M %p'], required=False)
    phone_number = forms.CharField(max_length=100, required=False, label="Home Phone")
    cell_number = forms.CharField(max_length=100, required=False)
    carrier = forms.ChoiceField(choices=CARRIERS, required=False)
   
    def __init__(self, profile=None, *args, **kwargs):
        super(SuperUserEditForm, self).__init__(*args, **kwargs)
        if(profile):
            self.fields['cell_number'].initial = profile.cell_number
            self.fields['carrier'].initial = profile.carrier
            self.fields['birthday'].initial = profile.birthday
            self.fields['phone_number'].initial = profile.phone_number

 Ex: views.py
     form = SuperUserEditForm(profile=profile, instance=user)

     on POST
     form = SuperUserEditForm(data=request.POST, instance=user)

 

How to remove a category from top menu

Posted In: . By CreativeSolutions


1. Login to Admin
2. From the left menu Product > Categories  > [Select a category] > General Information (tab) > Include in Navigation Menu
3. Change it value to No

 

How to enable developer mode in magento

Posted In: . By CreativeSolutions


To check the current mode, go to the magento installed folder using terminal then use the below command bin/magento deploy:mode:show

[developer@user magento]$ bin/magento deploy:mode:show
Current application mode: default.

To change into developer mode, use the below command

[developer@user magento]$ bin/magento deploy:mode:set developer
Enabled developer mode.
[developer@user magento]$ bin/magento deploy:mode:show
Current application mode: developer.


 

Removing My Wishlist option in Magento

Posted In: . By CreativeSolutions


1. Login to Admin Panel
2. Go to Stores > Configuration > Customers > Wish list > General Options
3. Change Enabled field value to Yes/No

 


1. Login into Admin Panel
2. Take the attribute listing from Store=>Attribute=>Product, then edit the attribute
3. On Edit page there is a tab Storefront Properties and in that make the Visible on Catalog Pages         on Front value to Yes