Skip to content

Instantly share code, notes, and snippets.

View rudmanmrrod's full-sized avatar
🔥
On fire coding!

Rodrigo Boet rudmanmrrod

🔥
On fire coding!
View GitHub Profile
var results = [
{
"id": 3,
"soft_delete": false,
"name": "Bebidas frias",
"order": 1,
"menu": 1,
"sub_category": 2
},
{
@rudmanmrrod
rudmanmrrod / subcategory_simple.js
Created January 17, 2020 19:38
Agregar categoría sencilla
var results = [
{
"id": 3,
"soft_delete": false,
"name": "Bebidas frias",
"order": 1,
"menu": 1,
"sub_category": 2
},
{
@rudmanmrrod
rudmanmrrod / forms.py
Created October 21, 2019 16:03 — forked from cansadadeserfeliz/forms.py
Django: pass a variable from a form view to a form
class MyForm(forms.ModelForm):
requested_asset = None
def __init__(self, *args, **kwargs):
other_variable = kwargs.pop('other_variable')
super(MyForm, self).__init__(*args, **kwargs)
from rest_framework import viewsets, status
from rest_framework.response import Response
from .models import *
from .serializers import *
class CancionesForAlbumViewSet(viewsets.ModelViewSet):
"""!
Vistas para registrar las canciones de un album
@author Rodrigo Boet (rudmanmrrod at gmail.com)
@rudmanmrrod
rudmanmrrod / test_case_profile_rest.py
Created January 16, 2019 14:45
Prueba unitaria de modelo perfil en django
class ProfileRestTest(TestCase):
"""!
Clase para probar el perfil por servicios rest
"""
def setUp(self):
"""!
Método para configurar los valores iniciales de
la prueba unitaria
"""
@rudmanmrrod
rudmanmrrod / test_case_profile.py
Created January 16, 2019 14:31
Prueba de perfil normal en django
class ProfileTest(TestCase):
"""!
Clase para probar el perfil
"""
def setUp(self):
"""!
Método para configurar los valores iniciales de
la prueba unitaria
"""
{% extends "base.html" %}
{% load staticfiles %}
{% block 'content %}
<h1 class="text-center">Create User</h1><hr>
<form id="app" v-on:submit.prevent="onSubmit">
{% csrf_token %}
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-4">
<label>{{form.username.label}}</label>
@rudmanmrrod
rudmanmrrod / create.user.html
Last active November 19, 2018 21:27
For django + vuejs integration
<script>
var app = new Vue({
delimiters: ['[[', ']]'],
el: '#app',
data: {
csrfmiddlewaretoken: '',
username: '',
email: '',
password1: '',
password2: '',
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class RegisterForm(UserCreationForm):
class Meta:
model = User
fields = ['password1', 'password2',
'first_name', 'last_name', 'email', 'username']
@rudmanmrrod
rudmanmrrod / danger_sdk.py
Created June 3, 2018 16:05
Sdk para determinar la concurrencias de un listado de palabras en un listado de publicaciones
from nltk.corpus import stopwords
class DangerSdk():
"""!
Sdk para determinar si un usuario es peligroso
@date 03-06-2018
@version 1.0.0
"""