Skip to content

Instantly share code, notes, and snippets.

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

Geraldine GeraldineE

🏠
Working from home
  • Medellin, Antioquia, Colombia
View GitHub Profile
@GeraldineE
GeraldineE / fields.py
Created July 17, 2019 21:53 — forked from danni/fields.py
Multi Choice Django Array Field
from django import forms
from django.contrib.postgres.fields import ArrayField
class ChoiceArrayField(ArrayField):
"""
A field that allows us to store an array of choices.
Uses Django 1.9's postgres ArrayField
and a MultipleChoiceField for its formfield.
@GeraldineE
GeraldineE / example.py
Created July 17, 2019 17:18 — forked from bradmontgomery/example.py
Example of setting a choices value for django ArrayField
# Here's your list of choices that would be displayed in a drop-down
# element on the web. It needs to be a tuple, and we define this
# as a variable just for readability/convenience.
#
# This example has 3 choices, each of which consists of two parts:
# 1. the thing that get strored in your database
# 2. the thing that you see in a dropdown list
LABEL_CHOICES = (
('this gets stored in your database', 'This item is what you see in the drop-down'),
('django', 'Django'),

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@GeraldineE
GeraldineE / queryset-examples.py
Created February 13, 2019 02:25 — forked from devMlGUE/queryset-examples.py
Ejemplo de consultas (Queryset) en Django 2017
from django.db import models
# para todos los ejemplos de este gist, vamos a utilizar el modelo "Human"
class Human(models.Model):
'''Modelo de ejemplo que representa
un humano y sus atributos.
'''
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
birth_date = models.DateField()
@GeraldineE
GeraldineE / tutorial_install_pip_virtualenv_django.txt
Created February 3, 2019 05:38 — forked from naginni/tutorial_install_pip_virtualenv_django.txt
Como instalar pip viartualenv y django para iniciar un proyecto
Es necesario usar un viartualenv para poder manejar varios proyectos con diferentes versiones de paquetes como por ejemplo usar python7
en un proyecto de django o tener otro proyecto de django con python3
1 - Es necesario instalar pip
https://pip.pypa.io/en/stable/installing/
2 - Se instala en virtualenv. Para crear un proyecto solo es necesario ejecutar el comando virtualenv [paht name] si se quiere usar
una versión de python en especial solo se necesita usar el comando virtualenv -p /usr/bin/python2.7 [path name]
después de esto se crea el proyecto y solo hace falta activarlo source [path name]/bin/activate
http://virtualenv.readthedocs.org/en/latest/installation.html
@GeraldineE
GeraldineE / Python-Christmas-tree.py
Created December 16, 2018 07:01 — forked from franktoffel/Python-Christmas-tree.py
Draw a minimalist Christmas tree with Python and their awesome libraries
# coding: utf-8
"""
Draw a minimalist Christmas tree with Python and their awesome libraries.
Code inspired by a StackEchange post and the Christmas spirit.
http://codegolf.stackexchange.com/questions/15860/make-a-scalable-christmas-tree/16358#16358
Author: Franz Navarro - CAChemE.org
License: MIT
Dependencies: Python, NumPy, matplotlib
"""
@GeraldineE
GeraldineE / Sync gh-pages + master branches
Created September 22, 2018 08:33 — forked from mandiwise/Sync gh-pages + master branches
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes