Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
from linklooker.linklooker import Links, Link
import argparse
import csv
def output_results(results, output_file):
if not results:
exit("Couldn't find any results!")
# Write out header
#!/usr/bin/env python
from linklooker.linklooker import Links, Link
import argparse
import csv
def output_results(results, output_file):
if not results:
exit("Couldn't find any results!")
# Write out header
from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import render_to_response, get_object_or_404
from django.views.decorators.csrf import csrf_exempt
from django.forms.models import inlineformset_factory
from django.db.models import Min
from django.utils import simplejson
from annoying.decorators import render_to
from paypal import interface
from models import Category, Organiser, Event, Buyer, Guest
@render_to('book.html')
def book(request):
if request.POST:
event = Event.objects.get(pk=request.POST['event_id'])
#ticket_rows = []
guest_formsets = []
for ticket in event.ticket_set.all():
qty = int( request.POST['qty-%s' % ticket.id] )
formset = inlineformset_factory(
<div id="book">
<h2 class="title">{{ organiser_name }} {{ event_name }}</h2>
<form id="booking-form" method="post" action="">
{% for ticket_row in ticket_rows %}
<h3>{{ ticket_row.ticket }} {{ forloop.revcounter }}</h3>
{% for formset in ticket_row.formset %}
{{ formset.errors }}
{% for field in formset %}
{{ forloop.counter }}
{{ field }}
@EdwardIII
EdwardIII / d.py
Last active December 12, 2015 05:28
#!/usr/bin/env python
from linklooker.linklooker import Links, Link
import argparse
import csv
def output_results(results, output_file):
if not results:
exit("Couldn't find any results!")
#TODO: use for -v mode
server {
listen 9095 default;
client_max_body_size 4G;
server_name 109.88.33.22;
keepalive_timeout 50;
# path for static files
root /home/edward/Projects/MyProject/public;
def get_images(self):
"""
Convenience method, gets all images except primary image
Returns empty string if none can be found
"""
print "DBG2: In get_images"
image_collection = self.eventimage_set().filter(primary=False)
print "DBG3: %s" % image_collection
if image_collection:
return image_collection
class EventImage(models.Model):
event = models.ForeignKey(Event)
image = models.ImageField(upload_to=self.event.id)
<?php
if ($_POST) {
header("HTTP/1.0 200 OK");
global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $database,
$mosConfig_mailfrom, $mosConfig_fromname;
/*** access Joomla's configuration file ***/
$my_path = dirname(__FILE__);