Django - raw_id_fields title not refreshing - django

I am currently having an issue when using the raw_id_field within admin.py in my Django project.
My site's admin area has a number of image upload fields for various different model pages which are all ForeignKey fields to an Image model where all images for the site are stored.
As the site will eventually be dealing with a large quantity of images (100s, maybe 1000s) the default select box would be unusable.
I created various admin.ModelAdmin classes e.g
class InfoSlideAdmin(admin.ModelAdmin):
raw_id_fields=('image',)
These change the image selector within my Edit pages from a Select Box to a Raw ID Field.
However when I select a different image using this control although the ID of the new image is shown the title from the previous image still displays.
Any ideas?

The title is refreshed via Javascript when you close the pop-up window. It's possible that you have some sort of cross-domain issue which is preventing the JS from running - this does sometimes occur when you're running via the development server on eg port 8080.
Have a look at what the console in Firebug is showing you (you are using Firebug to debug Javascript problems, aren't you?).

I do use firebug to debug issues such as this yes. However I normally use the "Net" tab and track which files are being called by the page as it loads. However you can only use the Net tab after a page refresh and this does not occur when using the raw_id control.

Related

Add a new field to Sitecore JSS

I created a simple Sitecore JSS Application and imported the same.
In connected mode, I want to add a few new fields. I added them to the template (Image 1) and they show up in the item (Image 2). When I query the item, I get the new fields in the json object as well (Image 4).
However, I cannot see the new fields in the experience editor (Image 3) and I am assuming I need to add those in the View. I am unable to locate where I need to add these fields or what I need to do, to have these show up.
Image 1: The modified template
Image 2: Both description and photo show up in the item
Image 3: Description and photo do not show up in the experience editor
Image 4: Json however returns these 2 properties
The Experience Editor use the Node.js app inside the /dist folder of your Sitecore webroot. (See also the config, you can have multiple apps)
Change your frontend, I Guess you use React, Vue, or Angular and upload/deploy to the dist folder.
You need to choose your dev workflow see:
https://doc.sitecore.com/xp/en/developers/hd/190/sitecore-headless-development/development-workflows.html
When you add your fields in Sitecore, you are using the Sitecore-First Workflow.
Hidden gem:
JSS add a extra Field "Always Display Field Editor Button in Experience Editor" to Renderings. In the Experience editor the Chrome Toolbar from a rendering has as first icon a Pencil, That opens a Field editor for all custom fields.

Sitecore - Rendering an image with Glass has stopped working, but only on the Web database

So I have some components which render images using #Html.Glass().RenderImage. Seemingly overnight the images went from rendering to not. Everything works fine in experience editor which uses the master database but after publishing to the web database and browsing to the site no html is made for the render image call and no image is rendered. Other field types work fine, this is only happening to images.
What I've tried:
Using a breakpoint in the view and examining what I get in the Glass generated
model. I receive the correct sitecore item and the correct values for any non-image field, the image field is null.
Creating different components which use different images: same issue
rendering the imagefield.raw.url: null exception
Deleting the items from the web database and republishing: same issue
Deleting the glass generated code and regenerating: same issue
Renaming the image field names: same issue
A coworker even copied my component into his sitecore site (literally copy/pasted everything) and it worked just fine, image and all.
I am unsure what else to try.
This is sitecore mvc.

Sitecore images in the Media Library are not displaying in Page Editor on CM instance, but appear in the Media Library and on CD instance

I have a bizarre issue with one of my Sitecore sites. Most (but not all) of the images in the Media Library are not displaying in Page Editor/CM. When I view my site in Page Editor or go to mysite.prod-cm.com, the images just show the broken image icon. If I try to go to the image directly, such as mysite.prod-cm.com/~/media/Upload/exampleImage.ashx it returns an error page. However, if I go to the same path on CD, mysite.com/~/media/Upload/exampleImage.ashx, the image displays. In Sitecore, in the master database, I see all my images, I am able to preview them and download them and there appears to be nothing wrong with the files.
I checked the logs to see if there were any useful clues about why the image paths are returning an error, and I see the following message
"WARN Protected page accessed with no current user".
Is this a security setting in Sitecore? This only started happening recently, is there a way to unprotect the Media Library? Like I said, some images still show up, but any new images I add appear broken. The only other message in my logs is
"WARN Memory usage exceeded the MemoryMonitor threshold".
To add on, I can view the images by the path with their item ID, such as mysite.prod-cm.com/~/media/C98B4DAC5FBD416CABF0070D087AE5E2.ashx. That works, but the path with the item name does not.

How RelatedFieldWidgetWrapper (django admin) loads the created content

I'm building a webpage that use ModelForm with ManyToMany relations. The Admin of django has the useful RelatedFieldWidgetWrapper. It creates a + next to relationfields that, when pressed, opens a popup to create a related-object. Once the creation is made the main webpage (the one where we press the +) has the new item loaded.
Now, in my website I would like to have something similar, my questions are:
is it correct to use the RelatedFieldWidgetWrapper in a webpage outside admin?
how does the page autoloads the new content (this is mainly my curiosity)
any other applicable solution to have a handy form without requiring complex JS or several pages?
thanks

Sharing to social pages with django

In my django application I have different content across the site. Now I would like to add "Share this to... (Facebook,Twitter,Buzz)" link on each page. But instead of redirecting to a social app page I would like to open popup with (if needed) logging/adding possibility. How to get started ? What steps/operations I need to perform and what ready made applications can I use ? I have already created a twitter app and facebook app and have all the keys.
I mean something like links here http://mashable.com/awards/ (left-side).
Sharethis: http://sharethis.com/ works well in every instance I've used it.
If you want only specific 'share buttons' or with default style justy type " social_name 'share button' " and you will get the js to include on your site (here are the 3 you mentioned in post):
http://www.facebook.com/share/
http://twitter.com/goodies/tweetbutton
http://www.google.com/buzz/api/admin/configPostWidget
If you already have the app written to behave like mashable, one approach is to put the login dialog (if it's needed) in a jQuery dialog. http://jqueryui.com/demos/dialog/