Django :: Editing comment within the page - django

I am making a simple bbs application but I ran into a problem.
I want to be able to edit comments on the page.
At the moment, I know how to edit comments/ posts by taking the user to a different page but with comments, I think it will be a good UX if users can edit comments on the post page.
What I mean is if users click the "edit" button next to a comment, a TextField input box will come out below and users can register their comments by clicking the "submit" button next to the textfield.
How would I go about doing this?
Would this require knowledge of javascript and if yes, how would I do it?

Related

Is there some way to "lock" page in case another user is editing - DJANGO

I need some help. I got a page and I can switch it to another view where I got a form and I can change some texts on that page and save it. Is there any way how to lock/hide button if some user is editing, so another user can not access the editing form page and is only allowed to see the "view" of the page. I want to implement, so two users will not be able to edit page at the same time.
I was trying to find something on the internet but I did not found anything useful for DJANGO.
Thanks a lot for some recommendation how to do it.
You could create a foreign key on the model that's mapped to a user. Then you would set that field to a user when they browse to the edit page.
You'd need to do it as follows.
has_lock = Page.objects.filter(id=page_id).filter(
Q(editing_user__isnull=True)
| Q(editing_user=request.user)
).update(editing_user=request.user)
if not has_lock:
# Do something here to when another user is editing the page.
# Raise 404, message the user and redirect, it's up to you.
# continue the editing view flow.
If you do go this route, you'll also need to handle unsetting that value and expiring it.

Facebook likes (with comments) not working well on a password/login protected website

I am working with our web developer to integrate Facebook Likes (with comments) onto our website. However, he is having problems because FB doesn't work very well with sites where a log in is required. Currently when you click on the 'like' button the 'like' turns into 'confirm'. You then have to click on 'confirm' and another box appears showing how the like will appear on your FB page saying 'Click Like to post this to your profile' with the option of 'like' or cancel. If you click on 'like' then it allows the comment box to pop up then you can add a comment and post to FB.
There are currently too many clicks for this to work. Does anyone have any advice? Would it be better to just use straight likes with the number perhaps or is this a common problem with website that require a login. We just want users to be able to click once, add their comment and post it to FB.
Any help would be really apprecaited. If it is technical that is fine as I will pass replies onto my developer.
Many thanks
This will generally happen for URLs and sites that are new to the Facebook scraper. It is a security measure to prevent like-jacking that some sites have done in the past. You should ensure that you test your site fully with the Debug tool and after some confirmed 'likes', that step will be automatically removed and future users will just have to click like once.
Where you are gating content behind a login, I would additionally recommend that you show different HTML (including OG tags) for anything detected with the Facebook scraper User Agent (see When does Facebook scrape my page? on the Like Button FAQ) so that, for example, the OG tags for a product detail page are picked up correctly even though the scraper is technically not logged in.

Facebook Comment page through API

I've searched for a while but I've only found the Facebook UI, that has some basic dialogs. Maybe some of you know some iOS apps that can open the comments page in a new "page" (e.g. Flipboard). Is there a way to show the comment page directly from Facebook or I have to simulate it through the API?
UPDATE: Not a page comment box. I want to show the comments of a post.
It is possible to create a facebook app showing your comment box. The same comment box can be showed in different pages/ urls using the "data-href" url.
<div class="fb-comments" data-href="http://example.com" data-num-posts="2" data-width="470"></div>
You could eventually add an static url in a database or something like that to wich you can always refer.
I dont exactly know what you want but i hope this helps

Facebook Like Button for Facebook Page for Blog

I just created a Facebook page for my blog and am working on adding the like button. I suppose my first question is, is there already a like button added to a Facebook fan page itself and the code for the like button is so you can create a like button on a whole different page, like my Blogspot blog page? Since I'm the admin I'm not sure if I'm seeing whatever else is. If not, I'd like to add a like button to my Facebook page for people to like, but for the life of my cannot figure out where to paste the code. I know it says behind the tag, but that doesn't mean anything to me. Please help.
http://developers.facebook.com/docs/plugins/
On the Facebook page is a like button of course already integrated, on that page you can get code for your Blog or website.
Specifically, you're looking for this plugin:
https://developers.facebook.com/docs/reference/plugins/like/
Specify the URL you want the like button to like, whether that be your blog post or your facebook page.
You are looking for the facebook Like Box.
https://developers.facebook.com/docs/reference/plugins/like-box/

How to access admin page - website like button

I am in the process of adding Like buttons to all of the product pages on a website. I am using all of the proper open graph tags and an app_id and everything seems to be working fine. I will be using a version of the button that does not give you the Admin or Insights links to choose from. I am wondering if there is an easy way to access those pages without the links?
Even though I am listed as an admin of the App, I am not automatically listed as an admin of each of the product pages as they are created. The only way I have been able to do it is to:
Add the default Like button code to another area of the page.
Click on the admin link then add myself as a page admin.
Delete the extra button on the page.
Access the admin area by going to facebook/pages.
This will be a pain as I add in hundreds of products! Any advice would be appreciated.
I'm facing the same issue. Sadly your way of being admin of a page via an extra button didn't work for me.
I've found this related bug in facebook developers website : http://developers.facebook.com/bugs/160664854023586?browse=search_4e946433c82379f78564182