Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: qzio/timesheet_py
base: 83935757a4
...
head fork: qzio/timesheet_py
compare: fa6f4f927c
  • 4 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
5 common/url_helpers.py
View
@@ -19,9 +19,9 @@ def method_splitter(request, *args, **kwargs):
request_method = request.method
+ # fake other methods, since browsers cant do proper http
if (request.method == 'POST' and request.POST.has_key('_method')):
request_method = request.POST['_method'].upper()
- print "request_method: %s" % request_method
if (request_method == 'GET' and get_view is not None):
return get_view(request, *args, **kwargs)
@@ -32,8 +32,9 @@ def method_splitter(request, *args, **kwargs):
elif (request_method == 'PUT' and put_view is not None):
return put_view(request, *args, **kwargs)
elif (request_method == 'DELETE' and delete_view is not None):
- print "try to do %s" % delete_view
return delete_view(request, *args, **kwargs)
+ elif (request_method == 'OPTIONS' and options_view is not None):
+ return options_view(request, *args, **kwargs)
else:
return HttpResponse("method not allowed", status=405)
6 create_tables.py
View
@@ -2,9 +2,13 @@
connection = sqlite3.connect("db.sqlite3")
+"""
+Note: If you plan to use mySQL or other,
+remember to add auto_increment to the id fields of tracked_times and projects.
+"""
tables = [
"CREATE TABLE projects "
- "(id integer primary key, user_id integer, name varchar(255), price integer, started_at integer, current_time integer)",
+ "(id integer primary key, user_id integer, name varchar(255), price integer, started_at integer, `current_time` integer)",
" CREATE TABLE tracked_times "
"(id integer primary key, project_id integer, started_at integer, stopped_at integer, diff integer)",
4 templates/home.html
View
@@ -8,11 +8,11 @@
<td class="hidden-phone">[{{ project.price }}]</td>
<td>
{% if project_started == project.id %}
- <form action="{% url projects_stop project.id %}" method="post">{% csrf_token %}
+ <form action="{% url 'projects_stop' project.id %}" method="post">{% csrf_token %}
<input class="btn" value="Stop" type="submit"/>
</form>
{% elif project_started == None %}
- <form action="{% url projects_start project.id %}" method="post">{% csrf_token %}
+ <form action="{% url 'projects_start' project.id %}" method="post">{% csrf_token %}
<input class="btn" value="Start" type="submit"/>
</form>
{% else %}
2  templates/registration/login.html
View
@@ -7,7 +7,7 @@
{% endif %}
<form method="post"
- action="{% url django.contrib.auth.views.login %}"
+ action="{% url 'django.contrib.auth.views.login' %}"
class="form-horizontal">{% csrf_token %}
<div class="control-group">
{{ form.username.label_tag }}
4 timesheet/project.py
View
@@ -37,8 +37,8 @@ def started(self):
def create_project(self, data):
- return dbexec("insert into projects (user_id, name, price, started_at) "
- "values (%s, %s, %s, 0)",
+ return dbexec("insert into projects (user_id, name, price, started_at, `current_time`) "
+ "values (%s, %s, %s, 0, 0)",
(self.user_id, data["name"], data["price"]))
def start_tracking(self, project_id):

No commit comments for this range

Something went wrong with that request. Please try again.