{ "message":"your message", "statusCode":200, "validationErrors":[ ] } For Success Message { "message":"success", "statusCode":200, "validationErrors":[] } For Error Message { "message":"Unauthorized Request", "statusCode":401, "validationErrors":[ "Un Authorised request" ] }
Author: Chandan Sharma
Each div contains only 3 items using foreach loops in PHP
<?php $item_count=1; $items_block=3; ?> <div class="wrapper"> <?php if(!empty($list)){ ?> <div class="item_block"> <?php foreach ($list as $val){ ?> <div>Item</div> <?php if($item_count % $items_block==0){ ?> </div> <div class="item_block"> <?php } $item_count++; ?> <?php endforeach; ?> </div> <?php } ?> </div>
You cannot call `.save()` after accessing `serializer.data`.If you need to access data before committing to the database
written codes: serializerdata = serializers.CreateSerializer(data=request.data) if serializerdata.is_valid(): user_id = serializerdata.data.get('user_id') if user_id==2: serializerdata.save(i_created_by=request.user) return JsonResponse({"message": "success"}) else: return JsonResponse({"message": "user invalid"}) else: return JsonResponse({"message": "error"}) Error Showing.. You cannot call `.save()` after accessing `serializer.data`.If you need to access data before committing to the database then inspect 'serializer.validated_data' instead. As the above error says, "If you … Continue reading You cannot call `.save()` after accessing `serializer.data`.If you need to access data before committing to the database
How to change the timezone in CodeIgniter 3.1.6
date_default_timezone_set() function is used to sets the default timezone used by all date or time functions in core PHP, CodeIgniter etc. date_default_timezone_set(); date_default_timezone_set('Asia/Kolkata'); # Option-1: In case of CodeIgniter, we can set the default timezone in the application/config.php file In case of CodeIgniter, we can set the default timezone in the application/config.php file <?php defined('BASEPATH') … Continue reading How to change the timezone in CodeIgniter 3.1.6
How To Remove Notice (1): Undefined index when getting URL Parameters
How to Download Facebook Uploaded Videos?
# How to Download Facebook Uploaded Videos? Facebook is a famous social networking platform in these days. Everyday most of people many times visits Facebook. Various type of videos uploaded to Facebook everyday. Maximum friends ask a question that, How to Download a Facebook Video? Here, is the Solution- Solution-1: First Copy the … Continue reading How to Download Facebook Uploaded Videos?
Disable Mouse Right Click, Cut, Copy & Paste
Disable Mouse Right Click, Cut, Copy & Paste? Full JavaScript code for disabling mouse right click and disable cut (CTRL+X), copy (CTRL+C) and paste (CTRL+V) from the web page. <script type="text/javascript"> $(document).ready(function () { //Disable cut copy paste $('body').bind('cut copy paste', function (e) { e.preventDefault(); }); //Disable mouse right click $("body").on("contextmenu",function(e){ return false; }); }); … Continue reading Disable Mouse Right Click, Cut, Copy & Paste
DISABLE MOUSE RIGHT CLICK
WANT TO DISABLE MOUSE RIGHT CLICK?? Disable mouse right click will prevent visitors from choosing the cut, copy and paste options. If you want to disable right mouse click for a particular section of a web page, then you can use a selector (#id, .class, etc.) otherwise use body selector for the full page. The following JavaScript … Continue reading DISABLE MOUSE RIGHT CLICK
How To Disable Copying Text On Blogger Blogs?
Want to Disable Copying Text On Blogger Blogs?? Steps to for Blogger (Disable Copying Text): Go to Dashboard > Select the blog where you would like to implement the code Go to Layout > Add a Gadget > Select “HTML/JavaScript gadget” Paste the following code in the box: <script src='demo-to-prevent-copy-paste-on-blogger_files/googleapis.js'></script> <script type='text/javascript'> if (typeof … Continue reading How To Disable Copying Text On Blogger Blogs?
How to add Whatsapp Sharing button in blogger
Want to add Whatsapp Sharing button in blogger? Here , is the Instruction how you can add the whatsapp Sharing button into your Blogger Account (blogspot page). WhatsApp has become very essential part of our daily life, It help us to communicate with our friends and family in most easiest way possible. To let you … Continue reading How to add Whatsapp Sharing button in blogger