Skip to content

Instantly share code, notes, and snippets.

View carnadaxxx's full-sized avatar

Wilson Coronado Barrantes carnadaxxx

  • Chiclayo Lambayeque Perú
View GitHub Profile
@cansadadeserfeliz
cansadadeserfeliz / views.py
Last active March 24, 2020 00:55
Django (extreme case): How to raise form invalid inside form_valid method of a FormView (CreateView/UpdateView) and add an error message to not field errors
from django.forms.util import ErrorList
from django import forms
class ContractUpdateView(UpdateView):
model = Contract
template_name = 'contract/contract_form.html'
form_class = ContractForm
def form_valid(self, form):
if self.request.POST.get('finish'):
@alvareztech
alvareztech / Ventana.java
Created February 15, 2014 18:01
Java: Ejemplo de la creación de una Ventana con Swing.
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
/**
* Clase Ventana
@steveosoule
steveosoule / php-bootstrap-alert-helper-function.php
Created August 28, 2013 15:07
PHP Bootstrap Alert Helper Function
<?
// @type: string - [success, info, warning, danger]
// @message: string - content of alert
// @dismisable: boolean
// returns alert HTML
function html_alert($type, $message, $dismisable){
$alert = '';
$alert_class = 'alert';
if ( $type ) $alert_class += ' alert-'.$type;