Spree 2.1.3 unable to change default logo - ruby-on-rails-4

I am using spree 2.1.3 and I can't manage to change the default logo. I have tried adding it in app/assets/images/admin/bg/spree_50.png but no luck.
I have tried the following : Unable to replace spree default logo in spree 2.1.3
this user had the same problem I am having, however the answer did not work. my first solution probably worked in spree 1.3, but it is not working with the current stable version and I can't find a solution anywhere. Spree's official documentation still uses the first thing i tried so I am assuming that they did not update this.
Anyone knows what i need to do here ?
thanks

The SO post you referenced says to add the config settings in config/application.rb, but I think it needs to be in config/initializers/spree.rb.
For example,
Spree.config do |config|
# Example:
# Uncomment to override the default site name.
# config.site_name = "Spree Demo Site"
config.admin_interface_logo = 'logo/some_other_logo.png'
config.logo = 'logo/this_logo.png'
end
In a fresh installation of Spree 2.1.3 with Rails 4, the above was enough for me to change the location for the logo in both the admin interface and for the rest of the store. Hope that helps!

Related

Iframe stops working after upgrading to Django 3.2 LTS

I was using Django 2.2 up till now and I recently tried upgrading to Django 3.2
We use a website live chat plugin called tawk.to which works by embedding an iframe to our page with the chat option in there.
However, after upgrading to Django 3.2, even though the plugin's JS code is loading, the iframe is missing from the website altogether.
I am not sure what is causing the issue. Is the iframe blocked in Django 3.2 or do I have to enable any setting for it?
There are security updates are added in Django 3.2 which do not allow other frames. Refer https://docs.djangoproject.com/en/3.2/ref/clickjacking/#preventing-clickjacking.
You should change X_FRAME_OPTIONS = 'SAMEORIGIN' as explained in https://docs.djangoproject.com/en/3.2/ref/clickjacking/#how-to-use-it
I found the answer after going deep into the Django files. Add this to your settings.py file.
SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin". # when using other websites that track visitors or use their iframe on your website.
X_FRAME_OPTIONS = 'SAMEORIGIN' # Necessary to show Iframe from your own server (such as PDFs on your website)

Django admin page layout changed with new version

I am working on an existing django project where admin console is extensively used.
With my latest run of package upgrade for my application admin page layout has changed.
Models have started appearing on all the pages, leaving a small space to display form fields.
For example this is how form page look like now:
Original Form view was occupying the whole page like this:
Any clue on what has been changed and which setting to change to get back the original view?
From the django-3.1 release notes,
The admin now has a sidebar on larger screens for easier navigation.
It is enabled by default but can be disabled by using a custom
AdminSite and setting AdminSite.enable_nav_sidebar
to False.
You can refer Customizing the AdminSite class - (django doc) to know more about customizing the AdminSite
Try this, open your browser and clear all the history then login back in again and it should work. I am sure the browser has cached an old version of Django admin.
I had the same problem when using version 3.1. I started a new demo app with version 2.2 to demonstrate something and when I got back to version 3.1 I got that issue, So what I did was just clear the browser history and everything came to its original state.

Default Django Rest Framework HTML POST Forms not showing after upgrading to latest versions

Previously when using the Django REST Framework I got browsable API endpoints, and I could enter data with POST and PUT forms.
However, after I recently updated my dependencies the HTML form for POST and PUT doesn't show up anymore [picture 2], and even trying to click my user name in the top right to get options to for example log out, I'm simply redirected back to the same url with /# appended to it [picture 1].
If I go to a specific entry by entering localhost/myEndpoint/1/ and I try the DELETE button, that does not do anything either.
There are no logs indicating something went wrong in the output of manage.py runserver
Is this a bug or is there some way that I can fix this?
I was using an updated to the following versions:
Django 2.2 => 2.2.9
djangorestframework 3.9.2 => 3.11.0
djangorestframework-simplejwt => 4.4.0
Picture 1:
Picture 2:
Collect static after upgrading.
I think you are inheriting your Serializer class from serializers.Serializer, use serializers.ModelSerializer instead and this should fix the issue
that is,
from rest_framework import serializers
class MySerializer(serializers.ModelSerializer): # instead of serializers.Serializer
# your class definition here
pass
This should fix the issue
I had the same issue and after a lot of research I found the issue was with ublock origin.
Ublock origin was preventing the browser from making request on localhost so I deactivated it and now it work as expected.
Check your adblocker if you have the same issue.

How to Optimize the Sitecore Images

I would like to Optimize the Sitecore Images and I found a documentation but I struck out on the first line itself
Install the packages with the /sitecore/admin/UpdateInstallationWizard.aspx
I found the path but could not find UpdateInstallationWizard.aspx,may I know what should I do to get that aspx page
You should be able to navigate to this page just using the url http://localhost/sitecore/admin/updateinstallationwizard.aspx.
You should first see the login screen and after you login, you should see the wizard.
You can also see the blog post Easy Access to the Update Installation Wizard

How to change 'Django Administration' name to a custom name in admin login and admin page

I am trying to change the name of django administration to custom name how do i do that.Is there any way completely customize the admin page give it more professional look
There are several ways to customize the Django admin.
First of all, you can always override any template (see docs : https://docs.djangoproject.com/en/1.6/intro/tutorial02/#customize-the-admin-look-and-feel it is actually using this very case as example)
Starting with Django 1.7, it will be accessible via settings : https://docs.djangoproject.com/en/dev/ref/contrib/admin/#adminsite-attributes
Finally, you could use a admin skin app such as the wonderful Grappelli wich already provides a similar setting : http://django-grappelli.readthedocs.org/en/latest/index.html
Hope this helps,
Regards,
Copy the admin templates to your project template folders (if you don't know how, just create an admin subdirectory in your project/templates folder).
The django branding is located in: base_site.html file.
You can find the source of it either in your django installed package or by checking the source code in github:
https://github.com/django/django/blob/stable/1.6.x/django/contrib/admin/templates/admin/base_site.html
Additionally with this method you can also completely override the default admin implementation, if you are not familiar or you don't want to spend so much time in it, you can also use a ready to use package such as grapelli: http://grappelliproject.com/ or django suit: http://djangosuit.com/
Note that branding will change in the next django release, the user will be able to define those in the settings file:
https://docs.djangoproject.com/en/dev/releases/1.7/#minor-features