Overriding the save method in Django
Django | Overriding the save method The save method is inherited from models.Model class. It is used to override the save method before storing the data in the database. This is used when there is …
Insert and Get data from an Elasticsearch index in python
Python | Insert and Get data from an index in Elasticsearch To do so we need to import the Elasticsearch package and create an instance of that by providing the host and port. >>> from elasticsearch …
Count number of words in a string in python
Python | Program to count the number of words in a string split() and len() method is used to get the number of words in a string. The split() method split a string into a list …
Add gradient text using CSS
CSS | Gradient Text There are three different CSS properties required to add a gradient overlay to a text. background-image: <gradient> background-clip: text text-fill-color: transparent background-image: <gradient> <gradient> will replace with any gradient style which …
Ternary Operator in Python
Python | Ternary Operator python uses an if-else conditional statement in a single line to represent the Ternary Operator. [true] if [expression] else [false] Let's see an example of Ternary Operator a, b = …
Create and delete an elasticsearch index in Python
Python | Create and delete an index in Elasticsearch To use the elastic search we need to import the Elasticsearch package >>> from elasticsearch import Elasticsearch now create an object of Elasticsearch search class by providing …
Compare timestamp with date only
SQL | Compare timestamp with date only Timestamp holds Date and Time both with 19 characters. To filter table record with the only date parameter can be achieved by SQL DATE() function. Consider the Employee table …
Select date range from timestamp column
SQL | Timestamp in where clause to select the date range Select date range from the timestamp column with where clause can be done by using the BETWEEN operator. BETWEEN Operator : The BETWEEN operator selects …
The view account.views.register did not return an HttpResponse object. It returned None instead.
Django | The view account.views.register didn't return an HttpResponse object. It returned None instead. This error usually occurs when missed writing a return before render. The render is used to render the view to the browser. It …
How to start array index from 1 in PHP
PHP | Start array index from 1 To change the array index start from 1 instead of 0 can be done using array_unshift() and unset() function. array_unshift() Function The array_unshift() function inserts new elements to …
How to make an anchor tag to do nothing?
HTML | Make an anchor tag to do nothing | href="javascript:void(0);" To prevent reloading a page when a link clicked is something like preventing the default behavior of an element. It can be achieved by providing …
Input type number maxlength not working
HTML | Input type number maxlength not working The "maxlength" attribute of an input field is used to limit the length entered in the input field. but it works only if the type of input field …
Remove id attribute from an element using jquery
Jquery | Remove id attribute from an element The removeAttr() function from jquery is used to removes one or more attributes from the selected elements. $("div").removeAttr("id"); Here seen an example with complete code …
Jquery Auto Focus On Next Input Field
Jquery | Auto Focus On Next Input Field The jquery code for autofocus on the next text input field. $(".input-key").keyup(function() { if ($(this).val().length == $(this).attr("maxlength")) { $(this).next('.input-key').focus(); } }); Let's go through the above jquery …
Web Scraping with PHP
PHP | Web Scraping Web scraping is used to get specific data from another website when there is no API available for it. There are many techniques for web scraping. You can read more about this …