Skip to content

Instantly share code, notes, and snippets.

View rg3915's full-sized avatar
🏠
Working from home

Regis Santos rg3915

🏠
Working from home
View GitHub Profile
@rg3915
rg3915 / names_mr_robot.csv
Last active March 16, 2018 15:09
Names in CSV
first_name last_name
Elliot Alderson
Edward Alderson
Angela Moss
Darlene Alderson
Tyrell Wellick
Joanna Wellick
Phillip Price
Whiterose
Ollie Parker
@rg3915
rg3915 / README.md
Last active September 22, 2023 16:28
Pagination similar at Django Admin - view pagination - method pagination and mantain pagination e mantem paginacao
@rg3915
rg3915 / api_github.html
Last active February 7, 2018 10:28
Api GitHub with Python and Ajax example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
</head>
<body>
@rg3915
rg3915 / template.js
Last active March 4, 2018 03:40
Auto complete simple Django and jQuery
// Autocomplete
$('#id_email').autocomplete({
source: "{% url 'autocomplete_user_email' %}",
});
@rg3915
rg3915 / is_complete.py
Last active March 12, 2018 23:59
Verificando se todos os campos do model estão preenchidos
# Verificando se todos os campos do model estão preenchidos
from django.contrib.auth.models import User
from django.forms import model_to_dict
mymodel = User.objects.last()
exclude_fields = ['id', 'last_login', 'date_joined']
def is_complete(mymodel, exclude_fields):
# Listando todos os campos
fields = model_to_dict(mymodel, fields=[field.name for field in mymodel._meta.fields])
@rg3915
rg3915 / print.js
Last active June 28, 2018 21:06
Print on HTML with JS e imprimindo gráfico ChartJS
<script>
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
@rg3915
rg3915 / forms.py
Last active July 4, 2021 00:19
Insert required with widget in input forms.py widget all fields form widget required_css_class required css required form date format datefield datetime-local
from django import forms
from .models import Expense, Person
class PersonForm(ModelForm):
cpf = forms.CharField(
label=_('CPF'),
widget=forms.TextInput(attrs={'required': 'True'})
)
@rg3915
rg3915 / required_fields.html
Created March 17, 2018 01:39
Form render with widget_tweaks and required fields
<!-- https://djangosnippets.org/snippets/474/ -->
{% load widget_tweaks %}
<style>
span.required:after {
content: "*";
color: red;
}
</style>
@rg3915
rg3915 / my_gist.html
Last active November 13, 2021 17:05
List all my gists with VueJS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="http://html5-training-in-hyderabad.blogspot.com.br/favicon.ico">
<title>My Gist</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- Font-awesome -->
@rg3915
rg3915 / pyse18.ipynb
Last active April 1, 2018 20:57
PySE18: Usando Pandas e subprocess para separar dados de um CSV
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.