Skip to content

Instantly share code, notes, and snippets.

View AeroNotix's full-sized avatar
💭
🇺🇦

Aaron France AeroNotix

💭
🇺🇦
View GitHub Profile
from django.conf.urls import patterns, include, url
from django.contrib import admin
from timetracker import views
admin.autodiscover()
year = '(?P<year>\d{4})'
month = '(?P<month>\d{1,2})'
day = '(?P<day>\d{1,2})'
{% extends "base.html" %}
{% block header %}
<link href="{{ STATIC_URL }}calendar.css" type="text/css"
rel="stylesheet" />
{% endblock header %}
{% block content %}
<table cellpadding="10">
<tr>
function ajaxCall(form) {
var pre = "#" + form + "_";
var formData = {
"form_type" : form,
"entry_date" : $(pre + 'entrydate').val(),
"start_time" : $(pre + 'starttime').val(),
"end_time" : $(pre + 'endtime').val(),
"daytype" : $(pre + 'daytype').val(),
@json_response
def ajax_add_entry(request):
'''
Adds a calendar entry asynchronously
'''
# create objects to put our data into
json_data = dict()
@json_response
def ajax_add_entry(request):
'''
Adds a calendar entry asynchronously
'''
# create objects to put our data into
json_data = dict()
/*
all functions dealing with the calendar that aren't
automatically created server-side.
*/
function addTimePicker(element, state) {
/*
import urllib2
import subprocess
for x in range(1000):
try:
urllib2.urlopen("http://localhost:8080/")
subprocess.Popen(["python", r"C:\Documents and Settings\francea\Desktop\serverhammer.py"])
except Exception as e:
print str(e)
def get_total_balance(self):
"""
Calculates the total balance for the user
This is on the ORM's User model and is just called as
>>>User_Object.get_total_balance()
"""
$.ajax({
url: "/ajax/",
data: formData,
dataType: "json",
success: function (data) {
if (data.success === true) {
$("#calendar-entry").fadeToggle("slow", function() {
$("#calendar-entry").html(data.calendar);
});
def fade_callback():
$("#calendar-entry").html(data.calendar);
def ajax_success(data):
if data.success == True:
$("#calendar-entry").fadeToggle("slow", fade_callback)
$("#calendar-entry").fadeToggle("slow");
else:
alert(data.error);