Skip to content

Instantly share code, notes, and snippets.

View renjithsraj's full-sized avatar
:shipit:

Renjith S Raj renjithsraj

:shipit:
View GitHub Profile
{% block message_info_homepage %}{% endblock %}
{% for object in object_list %}
<div class="post">
<h2><a href="{% url 'detail_post_page' slug=object.slug %}">{{ object.title }}</a></h2>
<p class="meta">
By: <a href="{% url 'author_posts_page' username=object.author.user.username %}" style="text-transform:uppercase">{{ object.author }}</a> &#9679;
at {{ object.created }} &#9679;
Posted under:
{% for tag in object.tags.all %}
def movies(request):
movie_all = MoviesList.objects.all()
page = request.GET.get('page', 1)
paginator = Paginator(movie_all, 10)
try:
movies = paginator.page(page)
except PageNotAnInteger:
movies = paginator.page(1)
except EmptyPage:
movies = paginator.page(paginator.num_pages)
def recipe_form(request):
if not request.user.is_superuser:
raise Http404
ImageFormSet = modelformset_factory(Recipe_images, form=Recipe_imageForm, extra=10)
if request.method == 'POST':
form = Recipe_form(request.POST or None, request.FILES or None)
formset = ImageFormSet(None, None, queryset=Recipe_images.objects.none())
if form.is_valid() and formset.is_valid():
instance = form.save(commit=False)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">
<title>Recipe Form</title>
{{ form.media }}
</head>
<body>
{% if messages %}
#home.html
<!--Timeline header area start -->
<form action="." method="post" name="category_form">
{% csrf_token %}
<div class="post-list-header">
<span class="post-list-title">Latest stories</span>
<select class="frm-input" name="category_name" id="category_name">
<option value="dummy">select category</option>
@renjithsraj
renjithsraj / config file
Created June 2, 2018 10:31
How to install wifi adapter in HP
~/Downloads:~$ git clone -b extended --single-branch https://github.com/lwfinger/rtlwifi_new.git
~/Downloads :~$ cd rtlwifi_new
~/Downloads/rtlwifi_new :~$ make
~/Downloads/rtlwifi_new :~$ sudo make install
~/renjith:~$ sudo reboot
import time
class Account:
def __init__(self):
self.style = {'1':"sporty", '2':"gimmick", '3':"casual", '4':"kpop", '5':"simple"}
self.price = {'1':5, '2':10, '3':15, '4':20, '5':25}
def stock(self):
stock = {'sporty':5,'gimmick':5,'casual':5,'kpop':5,'simple':5}
for digit in enter_quantity:
for styles in enter_item:
$(document).ready(function(){
$("#your-dropdown-id").change(function(){
var drid = $(this).val();
$.ajax({
url: 'getUsers.php',
type: 'post',
data: {value:drid},
dataType: 'json',
success:function(response){
// add the json response into html values
@renjithsraj
renjithsraj / gist:de508b5c88e5ad14445f3ec2d12a9a27
Created July 28, 2017 05:00
Createing Virtualenv with PIP3
Create Virtualenv with Python3
==============================
1. mkvirtualenv --python=/usr/local/bin/python3 multichat
2. workon multichat
3. pip3 install ipython
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.contrib.auth.models import AbstractUser
from django.db import models
GENDER = (('F','Female'),('M','Male'))
# Create your models here.
class Proffession(models.Model):