Commits

ken cochrane committed 3794c4a

initial code checkin

Comments (0)

Files changed (45)

+syntax: glob
+*.pyc
+dist
+MANIFEST
+_build
+_static
+.DS_Store
+People who have worked on django-fitlog
+---------------------------------------
+Ken Cochrane - initial code
+Requirements
+------------
+* Django 1.1 or newer
+* Django sessions need to be enabled
+* Django south 0.7 or newer for migrations
+* django pagination
+
+--------
+Settings
+--------
+
+App
+===
+Add fitlog to INSTALLED_APPS
+
+Sync Tables
+===========
+Run ./manage.py syncdb to load up the tables in your database.
+run ./manage.py migrate to run the south migrations
+Copyright (c) 2011, Ken Cochrane
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of the author nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+========================
+Django FitLog
+========================
+
+This is a fairly simple Fitness logging app that lets you track what you did at the gym. Very basic functionality at this point.
+
+For installation instructions, see the file "INSTALL" in this directory;
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-visitor.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-visitor.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/django-visitor"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django-visitor"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	make -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
+# -*- coding: utf-8 -*-
+#
+# django-visitor documentation build configuration file, created by
+# sphinx-quickstart on Tue Jul 26 07:25:04 2011.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('..'))
+
+import settings
+from django.core.management import setup_environ
+setup_environ(settings)
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'django-fitlog'
+copyright = u'2011, Ken Cochrane and contributors'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.1.1'
+# The full version, including alpha/beta/rc tags.
+release = '0.1.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'django-fitlogdoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'django-fitlog.tex', u'django-fitlog Documentation',
+   u'Ken Cochrane and contributors', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'django-fitlog', u'django-fitlog Documentation',
+     [u'Ken Cochrane and contributors'], 1)
+]
+.. django-fitlog documentation master file, created by
+   sphinx-quickstart on Tue Aug 12 07:25:04 2011.
+
+Welcome to django-fitlog's documentation!
+=========================================
+
+Requirements
+------------
+
+Django 1.1 or newer
+
+Django South 0.7 or newer
+
+Django Pagination
+
+Code Repo
+---------
+
+ * https://bitbucket.org/kencochrane/django-fitlog
+
+Installation
+------------
+
+Use pip to fetch the code::
+
+    pip install django-fitlog
+    
+Make sure that that sessions are activated:: 
+    
+Add `fitlog` to your INSTALLED_APPS::
+
+    INSTALLED_APPS = (
+        ...
+        'fitlog',
+    )
+
+
+Now load up the tables in your database::
+
+    python manage.py syncdb
+    
+Now run migrations::
+
+    python manage.py migrate
+
+        
+References
+----------
+        
+.. toctree::
+    :maxdepth: 2
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  text       to make text files
+	echo.  man        to make manual pages
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\django-visitor.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\django-visitor.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "text" (
+	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+	echo.
+	echo.Build finished. The text files are in %BUILDDIR%/text.
+	goto end
+)
+
+if "%1" == "man" (
+	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+	echo.
+	echo.Build finished. The manual pages are in %BUILDDIR%/man.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end

fitlog/__init__.py

Empty file added.
+from django.contrib import admin
+from fitlog.models import *
+
+class FitLogAdmin(admin.ModelAdmin):
+    list_display = ['member','log_date','comments']
+
+admin.site.register(FitLog,FitLogAdmin)
+admin.site.register(FitnessType)
+admin.site.register(MuscleGroup)
+admin.site.register(ExerciseType)

fitlog/choices.py

+GENDER_CHOICES = (
+         ('M', 'Male'),
+         ('F', 'Female'),
+)
+
+WEIGHT_CHOICES = (
+           ('0', '0 lbs'),
+           ('5', '5 lbs'),
+           ('10', '10 lbs'),
+           ('15', '15 lbs'),
+           ('20', '20 lbs'),
+           ('25', '25 lbs'),
+           ('30', '30 lbs'),
+           ('35', '35 lbs'),
+           ('40', '40 lbs'),
+           ('45', '45 lbs'),
+           ('50', '50 lbs'),
+           ('55', '55 lbs'),
+           ('60', '60 lbs'),
+           ('65', '65 lbs'),
+           ('70', '70 lbs'),
+           ('75', '75 lbs'),
+           ('80', '85 lbs'),
+           ('90', '90 lbs'),
+           ('95', '95 lbs'),
+           ('100', '100 lbs'),
+           ('105', '105 lbs'),
+           ('110', '110 lbs'),
+           ('115', '115 lbs'),
+           ('120', '120 lbs'),
+           ('125', '125 lbs'),
+           ('130', '130 lbs'),
+           ('135', '135 lbs'),
+           ('140', '140 lbs'),
+           ('145', '145 lbs'),
+           ('150', '150 lbs'),
+           ('155', '155 lbs'),
+           ('160', '160 lbs'),
+           ('165', '165 lbs'),
+           ('170', '170 lbs'),
+           ('175', '175 lbs'),
+           ('180', '185 lbs'),
+           ('190', '190 lbs'),
+           ('195', '195 lbs'),
+           ('200', '200 lbs'),
+           ('205', '205 lbs'),
+           ('210', '210 lbs'),
+           ('215', '215 lbs'),
+           ('220', '220 lbs'),
+           ('225', '225 lbs'),
+           ('230', '230 lbs'),
+           ('235', '235 lbs'),
+           ('240', '240 lbs'),
+           ('245', '245 lbs'),
+           ('250', '250 lbs'),
+           ('255', '255 lbs'),
+           ('260', '260 lbs'),
+           ('265', '265 lbs'),
+           ('270', '270 lbs'),
+           ('275', '275 lbs'),
+           ('280', '285 lbs'),
+           ('290', '290 lbs'),
+           ('295', '295 lbs'),
+           ('300', '300 lbs'),
+           ('305', '305 lbs'),
+           ('310', '310 lbs'),
+           ('315', '315 lbs'),
+           ('320', '320 lbs'),
+           ('325', '325 lbs'),
+           ('330', '330 lbs'),
+           ('335', '335 lbs'),
+           ('340', '340 lbs'),
+           ('345', '345 lbs'),
+           ('350', '350 lbs'),
+           ('355', '355 lbs'),
+           ('360', '360 lbs'),
+           ('365', '365 lbs'),
+           ('370', '370 lbs'),
+           ('375', '375 lbs'),
+           ('380', '385 lbs'),
+           ('390', '390 lbs'),
+           ('395', '395 lbs'),
+           ('400', '400 lbs'),
+           ('405', '405 lbs'),
+           ('410', '410 lbs'),
+           ('415', '415 lbs'),
+           ('420', '420 lbs'),
+           ('425', '425 lbs'),
+           ('430', '430 lbs'),
+           ('435', '435 lbs'),
+           ('440', '440 lbs'),
+           ('445', '445 lbs'),
+           ('450', '450 lbs'),
+           ('455', '455 lbs'),
+           ('460', '460 lbs'),
+           ('465', '465 lbs'),
+           ('470', '470 lbs'),
+           ('475', '475 lbs'),
+           ('480', '485 lbs'),
+           ('490', '490 lbs'),
+           ('495', '495 lbs'),
+           ('500', '500 lbs'),
+           ('505', '505 lbs'),
+           ('510', '510 lbs'),
+           ('515', '515 lbs'),
+           ('520', '520 lbs'),
+           ('525', '525 lbs'),
+           ('530', '530 lbs'),
+           ('535', '535 lbs'),
+           ('540', '540 lbs'),
+           ('545', '545 lbs'),
+           ('550', '550 lbs'),
+           ('555', '555 lbs'),
+           ('560', '560 lbs'),
+           ('565', '565 lbs'),
+           ('570', '570 lbs'),
+           ('575', '575 lbs'),
+           ('580', '585 lbs'),
+           ('590', '590 lbs'),
+           ('595', '595 lbs'),
+           ('600', '600 lbs'),
+           ('605', '605 lbs'),
+           ('610', '610 lbs'),
+           ('615', '615 lbs'),
+           ('620', '620 lbs'),
+           ('625', '625 lbs'),
+           ('630', '630 lbs'),
+           ('635', '635 lbs'),
+           ('640', '640 lbs'),
+           ('645', '645 lbs'),
+           ('650', '650 lbs'),
+           ('655', '655 lbs'),
+           ('660', '660 lbs'),
+           ('665', '665 lbs'),
+           ('670', '670 lbs'),
+           ('675', '675 lbs'),
+           ('680', '685 lbs'),
+           ('690', '690 lbs'),
+           ('695', '695 lbs'),
+           ('700', '700 lbs'),
+           ('705', '705 lbs'),
+           ('710', '710 lbs'),
+           ('715', '715 lbs'),
+           ('720', '720 lbs'),
+           ('725', '725 lbs'),
+           ('730', '730 lbs'),
+           ('735', '735 lbs'),
+           ('740', '740 lbs'),
+           ('745', '745 lbs'),
+           ('750', '750 lbs'),
+           ('755', '755 lbs'),
+           ('760', '760 lbs'),
+           ('765', '765 lbs'),
+           ('770', '770 lbs'),
+           ('775', '775 lbs'),
+           ('780', '785 lbs'),
+           ('790', '790 lbs'),
+           ('795', '795 lbs'),
+           ('800', '800 lbs'), 
+)
+
+REP_CHOICES = (
+           ('0','0'),
+           ('1','1'),
+           ('2','2'),
+           ('3','3'),
+           ('4','4'), 
+           ('5','5'),
+           ('6','6'), 
+           ('7','7'),
+           ('8','8'),
+           ('9','9'),
+           ('10','10'),
+           ('11','11'),
+           ('12','12'),
+           ('13','13'),
+           ('14','14'),
+           ('15','15'),
+           ('16','16'),
+           ('17','17'),
+           ('18','18'),
+           ('19','19'),
+           ('20','20'),
+           ('21','21'),
+           ('22','22'),
+           ('23','23'),
+           ('24','24'),
+           ('25','25'),
+           ('26','26'),
+           ('27','27'),
+           ('28','28'),
+           ('29','29'),
+           ('30','30'),
+           ('31','31'),
+           ('32','32'),
+           ('33','33'),
+           ('34','34'),
+           ('35','35'),
+           ('36','36'),
+           ('37','37'),
+           ('38','38'),
+           ('39','39'),
+           ('40','40'),
+           ('41','41'),
+           ('42','42'),
+           ('43','43'),
+           ('44','44'),
+           ('45','45'),
+           ('46','46'),
+           ('47','47'),
+           ('48','48'),
+           ('49','49'),
+           ('50','50'),
+           ('51','51'),
+           ('52','52'),
+           ('53','53'),
+           ('54','54'),
+           ('55','55'),
+           ('56','56'),
+           ('57','57'),
+           ('58','58'),
+           ('59','59'),
+           ('60','60'),
+           ('61','61'),
+           ('62','62'),
+           ('63','63'),
+           ('64','64'),
+           ('65','65'),
+           ('66','66'),
+           ('67','67'),
+           ('68','68'),
+           ('69','69'),
+           ('70','70'),
+           ('71','71'),
+           ('72','72'),
+           ('73','73'),
+           ('74','74'),
+           ('75','75'),
+           ('76','76'),
+           ('77','77'),
+           ('78','78'),
+           ('79','79'),
+           ('80','80'),
+           ('81','81'),
+           ('82','82'),
+           ('83','83'),
+           ('84','84'),
+           ('85','85'),
+           ('86','86'),
+           ('87','87'),
+           ('88','88'),
+           ('89','89'),
+           ('90','90'),
+           ('91','91'),
+           ('92','92'),
+           ('93','93'),
+           ('94','94'),
+           ('95','95'),
+           ('96','96'),
+           ('97','97'),
+           ('98','98'),
+           ('99','99'),
+           ('100','100'),
+)

fitlog/fixtures/initial_data.json

+[   
+  {
+    "pk": 1, 
+    "model": "fitlog.fitnesstype", 
+    "fields": {
+      "name": "Cardio"
+    }
+  }, 
+  {
+    "pk": 2, 
+    "model": "fitlog.fitnesstype", 
+    "fields": {
+      "name": "Weight Training"
+    }
+  }, 
+  {
+    "pk": 1, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Abdominals"
+    }
+  }, 
+  {
+    "pk": 2, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Biceps"
+    }
+  }, 
+  {
+    "pk": 3, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Calves"
+    }
+  }, 
+  {
+    "pk": 4, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Chest"
+    }
+  }, 
+  {
+    "pk": 5, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Hamstrings"
+    }
+  }, 
+  {
+    "pk": 6, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Lower Back"
+    }
+  }, 
+  {
+    "pk": 7, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Quadriceps"
+    }
+  }, 
+  {
+    "pk": 8, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Shoulders"
+    }
+  }, 
+  {
+    "pk": 9, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Triceps"
+    }
+  }, 
+  {
+    "pk": 10, 
+    "model": "fitlog.musclegroup", 
+    "fields": {
+      "name": "Upper Back"
+    }
+  }, 
+  {
+    "pk": 1, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 1, 
+      "name": "Crunches"
+    }
+  }, 
+  {
+    "pk": 2, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 1, 
+      "name": "Leg Raises"
+    }
+  }, 
+  {
+    "pk": 3, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 1, 
+      "name": "Sit Ups"
+    }
+  }, 
+  {
+    "pk": 4, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 1, 
+      "name": "Barbell Curls"
+    }
+  }, 
+  {
+    "pk": 5, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 2, 
+      "name": "Cable Biceps Curl"
+    }
+  }, 
+  {
+    "pk": 6, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 2, 
+      "name": "Cable Curls"
+    }
+  }, 
+  {
+    "pk": 7, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 2, 
+      "name": "Dumbell Curls"
+    }
+  }, 
+  {
+    "pk": 8, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 3, 
+      "name": "Seated Calf Raise"
+    }
+  }, 
+  {
+    "pk": 9, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 3, 
+      "name": "Standing Calf Raise"
+    }
+  }, 
+  {
+    "pk": 10, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 4, 
+      "name": "Bench Press"
+    }
+  }, 
+  {
+    "pk": 11, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 4, 
+      "name": "Cable Crossover"
+    }
+  }, 
+  {
+    "pk": 12, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 4, 
+      "name": "Dumbell Press"
+    }
+  }, 
+  {
+    "pk": 13, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 4, 
+      "name": "Flys"
+    }
+  }, 
+  {
+    "pk": 14, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 4, 
+      "name": "Incline Bench Press"
+    }
+  }, 
+  {
+    "pk": 15, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 4, 
+      "name": "Pushups"
+    }
+  }, 
+  {
+    "pk": 16, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 5, 
+      "name": "Leg Curl"
+    }
+  }, 
+  {
+    "pk": 17, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 6, 
+      "name": "Back Extension"
+    }
+  }, 
+  {
+    "pk": 18, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 6, 
+      "name": "Dead Lift"
+    }
+  }, 
+  {
+    "pk": 19, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 6, 
+      "name": "Good Morning"
+    }
+  }, 
+  {
+    "pk": 20, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 7, 
+      "name": "Leg Extension"
+    }
+  }, 
+  {
+    "pk": 21, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 7, 
+      "name": "Leg Press"
+    }
+  }, 
+  {
+    "pk": 22, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 7, 
+      "name": "Lunge"
+    }
+  }, 
+  {
+    "pk": 23, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 7, 
+      "name": "Squat"
+    }
+  }, 
+  {
+    "pk": 24, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 8, 
+      "name": "Bent Over Rear Deltoid Raises"
+    }
+  }, 
+  {
+    "pk": 25, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 8, 
+      "name": "Cable Lateral Raises"
+    }
+  }, 
+  {
+    "pk": 26, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 8, 
+      "name": "Cuban Press Rotation"
+    }
+  }, 
+  {
+    "pk": 27, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 8, 
+      "name": "Dumbell Raises"
+    }
+  }, 
+  {
+    "pk": 28, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 8, 
+      "name": "Press Behind Neck"
+    }
+  }, 
+  {
+    "pk": 29, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 8, 
+      "name": "Rear Deltoid Flys"
+    }
+  }, 
+  {
+    "pk": 30, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 8, 
+      "name": "Shoulder Press"
+    }
+  }, 
+  {
+    "pk": 31, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 8, 
+      "name": "Shrugs"
+    }
+  }, 
+  {
+    "pk": 32, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 8, 
+      "name": "Wide-Grip Upright Rows"
+    }
+  }, 
+  {
+    "pk": 33, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 9, 
+      "name": "Triceps Extension"
+    }
+  }, 
+  {
+    "pk": 34, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 9, 
+      "name": "Triceps Pushdowns"
+    }
+  }, 
+  {
+    "pk": 35, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 10, 
+      "name": "Bent Over Rows"
+    }
+  }, 
+  {
+    "pk": 36, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 10, 
+      "name": "Lat Pull Downs"
+    }
+  }, 
+  {
+    "pk": 37, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 10, 
+      "name": "Pull Ups"
+    }
+  }, 
+  {
+    "pk": 38, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 10, 
+      "name": "Seated Rows"
+    }
+  }, 
+  {
+    "pk": 39, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 2, 
+      "muscle_group": 10, 
+      "name": "Straight Arm Pulldowns"
+    }
+  }, 
+  {
+    "pk": 40, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Bike"
+    }
+  }, 
+  {
+    "pk": 41, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Elliptical Trainer"
+    }
+  }, 
+  {
+    "pk": 42, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Free-Climber"
+    }
+  }, 
+  {
+    "pk": 43, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Rowing Machine"
+    }
+  }, 
+  {
+    "pk": 44, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Run"
+    }
+  }, 
+  {
+    "pk": 45, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Stair Climber"
+    }
+  }, 
+  {
+    "pk": 46, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Stationary Bike"
+    }
+  }, 
+  {
+    "pk": 47, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Treadmill"
+    }
+  }, 
+  {
+    "pk": 48, 
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Walk"
+    }
+  },
+	{
+    "pk": 49,
+    "model": "fitlog.exercisetype", 
+    "fields": {
+      "fitness_type": 1, 
+      "muscle_group": null, 
+      "name": "Other"
+    }
+  }
+]
+from django.contrib.auth.forms import UserCreationForm, UserChangeForm, SetPasswordForm
+from django.contrib.auth.models import User
+from django.contrib.sites.models import Site
+from django.utils.translation import ugettext_lazy as _
+from django.utils import dateformat
+from django import forms
+from django.forms.formsets import BaseFormSet
+from django.contrib.admin.widgets import AdminSplitDateTime, AdminDateWidget
+from django.forms import Textarea,TextInput
+from django.core.mail import send_mail
+from django.conf import settings
+from django.template.loader import render_to_string
+
+import time, datetime
+from datetime import timedelta
+
+from fitlog.models import *
+
+class FitLogForm(forms.ModelForm):
+    log_date = forms.DateField(initial=datetime.date.today,help_text="YYYY-MM-DD")
+    total_time = forms.TimeField(help_text="HH:MM:SS",error_messages={'invalid': 'Please enter Time in this format HH:MM:SS (example: 01:25:30 would be 1 hour 25 min and 30 seconds)'} )
+    comments = forms.CharField(widget=forms.Textarea,required=False)
+    class Meta:
+        model = FitLog
+        exclude = ('member','create_date','last_update')
+        
+    def save(self, member):
+        fit_log= super(FitLogForm, self).save(commit=False)
+        fit_log.member = member       
+        fit_log.save() 
+        return fit_log
+    
+class CardioLogForm(forms.ModelForm):
+    exercise_type = forms.ModelChoiceField(queryset=ExerciseType.cardio_objects.all(),empty_label=" -- Select One --")
+    distance = forms.DecimalField(help_text="Miles (ie 1.0, 3.1,etc)")
+    total_time = forms.TimeField(help_text="HH:MM:SS",error_messages={'invalid': 'Please enter Time in correct format "1:30:00" would be 1 hour, 30 minutes and no seconds'})
+    comments = forms.CharField(widget=forms.Textarea,required=False)
+    
+    class Meta:
+        model = CardioFitLogDetail
+        fields = ('exercise_type','total_time','distance','comments')
+        
+    def save(self, fit_log):
+        cardio_log= super(CardioLogForm, self).save(commit=False)
+        cardio_log.fit_log = fit_log       
+        cardio_log.save() 
+        return cardio_log 
+    
+class WeightLogForm(forms.ModelForm):
+    exercise_type = forms.ModelChoiceField(queryset=ExerciseType.weight_objects.all(),empty_label=" -- Select One --")
+    comments = forms.CharField(widget=forms.Textarea,required=False)
+    class Meta:
+        model = WeightFitLogDetail
+        exclude = ('fit_log',)
+        
+    def save(self, fit_log):
+        weight_log= super(WeightLogForm, self).save(commit=False)
+        weight_log.fit_log = fit_log       
+        weight_log.save() 
+        return weight_log
+    
+class WeightLogSetForm(forms.ModelForm):
+    class Meta:
+        model = WeightLogSet
+        exclude = ('weight_log_detail','sequence')
+        
+    def save(self, weight_log,sequence=None):
+        weight_log_set= super(WeightLogSetForm, self).save(commit=False)
+        weight_log_set.weight_log_detail = weight_log
+        if sequence:
+            weight_log_set.sequence = sequence      
+        weight_log_set.save() 
+        return weight_log_set
+    
+    
+class WeightLogSetFormSet(BaseFormSet):
+
+    def save(self, weight_log):
+        count = 1 
+        for form in self.forms:
+            if (('weight' in form.cleaned_data) and ('reps' in form.cleaned_data)):
+                form.save(weight_log,count)
+                count = count + 1    
+                
+class BodyWeightForm(forms.ModelForm):
+    weight_date = forms.DateField(initial=datetime.date.today,help_text="YYYY-MM-DD") 
+    class Meta:
+        model = BodyWeightLog
+        exclude = ('member')
+        
+    def save(self,member):
+        weight_log = super(BodyWeightForm, self).save(commit=False)
+        weight_log.member = member
+        weight_log.save()
+        return weight_log

fitlog/managers.py

+from django.db import models
+
+class FitLogManager(models.Manager):
+    def by_member(self,member):
+        return self.select_related().filter(member=member).order_by('-create_date')
+    
+    def latest(self):
+        return self.select_related().all().order_by('-create_date')[:10]
+    
+    def number_of_logs(self):
+        return self.count()
+
+class CardioManager(models.Manager):
+    def get_query_set(self):
+        return super(CardioManager,self).get_query_set().filter(fitness_type__name__iexact="Cardio")
+
+class WeightManager(models.Manager):
+    def get_query_set(self):
+        return super(WeightManager,self).get_query_set().select_related().filter(fitness_type__name__iexact="Weight Training")
+
+class BodyWeightLogManager(models.Manager):
+    def by_member(self,member):
+        return self.select_related().filter(member=member).order_by('-weight_date')

fitlog/migrations/0001_initial.py

+
+from south.db import db
+from django.db import models
+from fitlog.models import *
+
+class Migration:
+    
+    def forwards(self, orm):
+        
+        # Adding model 'MuscleGroup'
+        db.create_table('fitlog_musclegroup', (
+            ('id', models.AutoField(primary_key=True)),
+            ('name', models.CharField(max_length=100)),
+        ))
+        db.send_create_signal('fitlog', ['MuscleGroup'])
+        
+        # Adding model 'WeightLogSet'
+        db.create_table('fitlog_weightlogset', (
+            ('weight_log_detail', models.ForeignKey(orm.WeightFitLogDetail)),
+            ('reps', models.SmallIntegerField()),
+            ('id', models.AutoField(primary_key=True)),
+            ('weight', models.SmallIntegerField()),
+            ('sequence', models.SmallIntegerField()),
+        ))
+        db.send_create_signal('fitlog', ['WeightLogSet'])
+        
+        # Adding model 'FitLog'
+        db.create_table('fitlog_fitlog', (
+            ('total_time', models.IntegerField()),
+            ('create_date', models.DateTimeField(auto_now_add=True)),
+            ('title', models.CharField(max_length=255)),
+            ('log_date', models.DateField()),
+            ('comments', models.TextField(max_length=5000, blank=True)),
+            ('last_update', models.DateTimeField(auto_now=True)),
+            ('member', models.ForeignKey(orm['auth.User'])),
+            ('id', models.AutoField(primary_key=True)),
+        ))
+        db.send_create_signal('fitlog', ['FitLog'])
+        
+        # Adding model 'CardioFitLogDetail'
+        db.create_table('fitlog_cardiofitlogdetail', (
+            ('total_time', models.IntegerField()),
+            ('distance', models.DecimalField(max_digits=5, decimal_places=1)),
+            ('exercise_type', models.ForeignKey(orm.ExerciseType)),
+            ('comments', models.CharField(max_length=500, blank=True)),
+            ('fit_log', models.ForeignKey(orm.FitLog)),
+            ('id', models.AutoField(primary_key=True)),
+        ))
+        db.send_create_signal('fitlog', ['CardioFitLogDetail'])
+        
+        # Adding model 'UserProfile'
+        db.create_table('fitlog_userprofile', (
+            ('gender', models.CharField(max_length=1)),
+            ('id', models.AutoField(primary_key=True)),
+            ('user', models.ForeignKey(orm['auth.User'], unique=True)),
+        ))
+        db.send_create_signal('fitlog', ['UserProfile'])
+        
+        # Adding model 'WeightFitLogDetail'
+        db.create_table('fitlog_weightfitlogdetail', (
+            ('exercise_type', models.ForeignKey(orm.ExerciseType)),
+            ('fit_log', models.ForeignKey(orm.FitLog)),
+            ('id', models.AutoField(primary_key=True)),
+            ('comments', models.CharField(max_length=500, blank=True)),
+        ))
+        db.send_create_signal('fitlog', ['WeightFitLogDetail'])
+        
+        # Adding model 'FitnessType'
+        db.create_table('fitlog_fitnesstype', (
+            ('id', models.AutoField(primary_key=True)),
+            ('name', models.CharField(max_length=50)),
+        ))
+        db.send_create_signal('fitlog', ['FitnessType'])
+        
+        # Adding model 'ExerciseType'
+        db.create_table('fitlog_exercisetype', (
+            ('fitness_type', models.ForeignKey(orm.FitnessType)),
+            ('id', models.AutoField(primary_key=True)),
+            ('name', models.CharField(max_length=50)),
+            ('muscle_group', models.ForeignKey(orm.MuscleGroup, null=True, blank=True)),
+        ))
+        db.send_create_signal('fitlog', ['ExerciseType'])
+        
+        # Adding model 'Team'
+        db.create_table('fitlog_team', (
+            ('description', models.TextField(max_length=255, blank=True)),
+            ('id', models.AutoField(primary_key=True)),
+            ('name', models.CharField(max_length=50)),
+        ))
+        db.send_create_signal('fitlog', ['Team'])
+        
+    
+    
+    def backwards(self, orm):
+        
+        # Deleting model 'MuscleGroup'
+        db.delete_table('fitlog_musclegroup')
+        
+        # Deleting model 'WeightLogSet'
+        db.delete_table('fitlog_weightlogset')
+        
+        # Deleting model 'FitLog'
+        db.delete_table('fitlog_fitlog')
+        
+        # Deleting model 'CardioFitLogDetail'
+        db.delete_table('fitlog_cardiofitlogdetail')
+        
+        # Deleting model 'UserProfile'
+        db.delete_table('fitlog_userprofile')
+        
+        # Deleting model 'WeightFitLogDetail'
+        db.delete_table('fitlog_weightfitlogdetail')
+        
+        # Deleting model 'FitnessType'
+        db.delete_table('fitlog_fitnesstype')
+        
+        # Deleting model 'ExerciseType'
+        db.delete_table('fitlog_exercisetype')
+        
+        # Deleting model 'Team'
+        db.delete_table('fitlog_team')
+        
+    
+    
+    models = {
+        'fitlog.musclegroup': {
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '100'})
+        },
+        'fitlog.weightlogset': {
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'reps': ('models.SmallIntegerField', [], {}),
+            'sequence': ('models.SmallIntegerField', [], {}),
+            'weight': ('models.SmallIntegerField', [], {}),
+            'weight_log_detail': ('models.ForeignKey', ['WeightFitLogDetail'], {})
+        },
+        'fitlog.fitlog': {
+            'comments': ('models.TextField', [], {'max_length': '5000', 'blank': 'True'}),
+            'create_date': ('models.DateTimeField', [], {'auto_now_add': 'True'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'last_update': ('models.DateTimeField', [], {'auto_now': 'True'}),
+            'log_date': ('models.DateField', [], {}),
+            'member': ('models.ForeignKey', ['User'], {}),
+            'title': ('models.CharField', [], {'max_length': '255'}),
+            'total_time': ('models.IntegerField', [], {})
+        },
+        'fitlog.cardiofitlogdetail': {
+            'comments': ('models.CharField', [], {'max_length': '500', 'blank': 'True'}),
+            'distance': ('models.DecimalField', [], {'max_digits': '5', 'decimal_places': '1'}),
+            'exercise_type': ('models.ForeignKey', ['ExerciseType'], {}),
+            'fit_log': ('models.ForeignKey', ['FitLog'], {}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'total_time': ('models.IntegerField', [], {})
+        },
+        'auth.user': {
+            '_stub': True,
+            'id': ('models.AutoField', [], {'primary_key': 'True'})
+        },
+        'fitlog.userprofile': {
+            'gender': ('models.CharField', [], {'max_length': '1'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'user': ('models.ForeignKey', ['User'], {'unique': 'True'})
+        },
+        'fitlog.weightfitlogdetail': {
+            'comments': ('models.CharField', [], {'max_length': '500', 'blank': 'True'}),
+            'exercise_type': ('models.ForeignKey', ['ExerciseType'], {}),
+            'fit_log': ('models.ForeignKey', ['FitLog'], {}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'})
+        },
+        'fitlog.fitnesstype': {
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '50'})
+        },
+        'fitlog.exercisetype': {
+            'fitness_type': ('models.ForeignKey', ['FitnessType'], {}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'muscle_group': ('models.ForeignKey', ['MuscleGroup'], {'null': 'True', 'blank': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '50'})
+        },
+        'fitlog.team': {
+            'description': ('models.TextField', [], {'max_length': '255', 'blank': 'True'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '50'})
+        }
+    }
+    
+    complete_apps = ['fitlog']

fitlog/migrations/0002_timechange.py

+
+from south.db import db
+from django.db import models
+from fitlog.models import *
+
+class Migration:
+    
+    def forwards(self, orm):
+        
+        # rename columns
+        db.rename_column('fitlog_fitlog','total_time','total_time_orig')
+        db.rename_column('fitlog_cardiofitlogdetail','total_time','total_time_orig')
+        
+        # Changing field 'FitLog.total_time'
+        db.add_column('fitlog_fitlog', 'total_time', models.TimeField())
+        
+        # Changing field 'CardioFitLogDetail.total_time'
+        db.add_column('fitlog_cardiofitlogdetail', 'total_time', models.TimeField())
+        
+    
+    
+    def backwards(self, orm):
+        
+        # delete the new columns
+        db.delete_column('fitlog_fitlog', 'total_time')
+        db.delete_column('fitlog_cardiofitlogdetail', 'total_time')
+        
+        # rename the originals back to what they were
+        db.rename_column('fitlog_fitlog','total_time_orig','total_time')
+        db.rename_column('fitlog_cardiofitlogdetail','total_time_orig','total_time')
+    
+    
+    models = {
+        'fitlog.musclegroup': {
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '100'})
+        },
+        'fitlog.weightlogset': {
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'reps': ('models.SmallIntegerField', [], {}),
+            'sequence': ('models.SmallIntegerField', [], {}),
+            'weight': ('models.SmallIntegerField', [], {}),
+            'weight_log_detail': ('models.ForeignKey', ['WeightFitLogDetail'], {})
+        },
+        'fitlog.fitlog': {
+            'comments': ('models.TextField', [], {'max_length': '5000', 'blank': 'True'}),
+            'create_date': ('models.DateTimeField', [], {'auto_now_add': 'True'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'last_update': ('models.DateTimeField', [], {'auto_now': 'True'}),
+            'log_date': ('models.DateField', [], {}),
+            'member': ('models.ForeignKey', ['User'], {}),
+            'title': ('models.CharField', [], {'max_length': '255'}),
+            'total_time': ('models.TimeField', [], {})
+        },
+        'fitlog.cardiofitlogdetail': {
+            'comments': ('models.CharField', [], {'max_length': '500', 'blank': 'True'}),
+            'distance': ('models.DecimalField', [], {'max_digits': '5', 'decimal_places': '1'}),
+            'exercise_type': ('models.ForeignKey', ['ExerciseType'], {}),
+            'fit_log': ('models.ForeignKey', ['FitLog'], {}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'total_time': ('models.TimeField', [], {})
+        },
+        'auth.user': {
+            '_stub': True,
+            'id': ('models.AutoField', [], {'primary_key': 'True'})
+        },
+        'fitlog.userprofile': {
+            'gender': ('models.CharField', [], {'max_length': '1'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'user': ('models.ForeignKey', ['User'], {'unique': 'True'})
+        },
+        'fitlog.weightfitlogdetail': {
+            'comments': ('models.CharField', [], {'max_length': '500', 'blank': 'True'}),
+            'exercise_type': ('models.ForeignKey', ['ExerciseType'], {}),
+            'fit_log': ('models.ForeignKey', ['FitLog'], {}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'})
+        },
+        'fitlog.fitnesstype': {
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '50'})
+        },
+        'fitlog.exercisetype': {
+            'fitness_type': ('models.ForeignKey', ['FitnessType'], {}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'muscle_group': ('models.ForeignKey', ['MuscleGroup'], {'null': 'True', 'blank': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '50'})
+        },
+        'fitlog.team': {
+            'description': ('models.TextField', [], {'max_length': '255', 'blank': 'True'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '50'})
+        }
+    }
+    
+    complete_apps = ['fitlog']

fitlog/migrations/0003_bodyweight.py

+
+from south.db import db
+from django.db import models
+from fitlog.models import *
+
+class Migration:
+    
+    def forwards(self, orm):
+        
+        # Adding model 'BodyWeightLog'
+        db.create_table('fitlog_bodyweightlog', (
+            ('member', models.ForeignKey(orm['auth.User'])),
+            ('weight_date', models.DateField()),
+            ('id', models.AutoField(primary_key=True)),
+            ('weight', models.DecimalField(max_digits=5, decimal_places=1)),
+            ('comments', models.TextField(max_length=5000, blank=True)),
+        ))
+        db.send_create_signal('fitlog', ['BodyWeightLog'])
+        
+    
+    
+    def backwards(self, orm):
+        
+        # Deleting model 'BodyWeightLog'
+        db.delete_table('fitlog_bodyweightlog')
+        
+    
+    
+    models = {
+        'fitlog.musclegroup': {
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '100'})
+        },
+        'fitlog.weightlogset': {
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'reps': ('models.SmallIntegerField', [], {}),
+            'sequence': ('models.SmallIntegerField', [], {}),
+            'weight': ('models.SmallIntegerField', [], {}),
+            'weight_log_detail': ('models.ForeignKey', ['WeightFitLogDetail'], {})
+        },
+        'fitlog.fitlog': {
+            'comments': ('models.TextField', [], {'max_length': '5000', 'blank': 'True'}),
+            'create_date': ('models.DateTimeField', [], {'auto_now_add': 'True'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'last_update': ('models.DateTimeField', [], {'auto_now': 'True'}),
+            'log_date': ('models.DateField', [], {}),
+            'member': ('models.ForeignKey', ['User'], {}),
+            'title': ('models.CharField', [], {'max_length': '255'}),
+            'total_time': ('models.TimeField', [], {})
+        },
+        'fitlog.cardiofitlogdetail': {
+            'comments': ('models.CharField', [], {'max_length': '500', 'blank': 'True'}),
+            'distance': ('models.DecimalField', [], {'max_digits': '5', 'decimal_places': '1'}),
+            'exercise_type': ('models.ForeignKey', ['ExerciseType'], {}),
+            'fit_log': ('models.ForeignKey', ['FitLog'], {}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'total_time': ('models.TimeField', [], {})
+        },
+        'fitlog.bodyweightlog': {
+            'comments': ('models.TextField', [], {'max_length': '5000', 'blank': 'True'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'member': ('models.ForeignKey', ['User'], {}),
+            'weight': ('models.DecimalField', [], {'max_digits': '5', 'decimal_places': '1'}),
+            'weight_date': ('models.DateField', [], {})
+        },
+        'auth.user': {
+            '_stub': True,
+            'id': ('models.AutoField', [], {'primary_key': 'True'})
+        },
+        'fitlog.team': {
+            'description': ('models.TextField', [], {'max_length': '255', 'blank': 'True'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '50'})
+        },
+        'fitlog.weightfitlogdetail': {
+            'comments': ('models.CharField', [], {'max_length': '500', 'blank': 'True'}),
+            'exercise_type': ('models.ForeignKey', ['ExerciseType'], {}),
+            'fit_log': ('models.ForeignKey', ['FitLog'], {}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'})
+        },
+        'fitlog.fitnesstype': {
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '50'})
+        },
+        'fitlog.exercisetype': {
+            'fitness_type': ('models.ForeignKey', ['FitnessType'], {}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'muscle_group': ('models.ForeignKey', ['MuscleGroup'], {'null': 'True', 'blank': 'True'}),
+            'name': ('models.CharField', [], {'max_length': '50'})
+        },
+        'fitlog.userprofile': {
+            'gender': ('models.CharField', [], {'max_length': '1'}),
+            'id': ('models.AutoField', [], {'primary_key': 'True'}),
+            'user': ('models.ForeignKey', ['User'], {'unique': 'True'})
+        }
+    }
+    
+    complete_apps = ['fitlog']

fitlog/migrations/__init__.py

Empty file added.
+from django.db import models
+from django.contrib.auth.models import User
+from fitlog.utils import addDateTimes
+
+from fitlog.choices import WEIGHT_CHOICES, REP_CHOICES, GENDER_CHOICES
+
+from fitlog.managers import FitLogManager, CardioManager, WeightManager \
+    BodyWeightLogManager
+
+class UserProfile(models.Model):
+     
+  # This is the only required field
+  user = models.ForeignKey(User, unique=True)
+  gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
+  
+  def __unicode__(self):
+      return u'%s' % self.user.username
+
+class Team(models.Model):
+    name = models.CharField(max_length=50)
+    description = models.TextField(max_length=255,blank=True)
+    
+class FitLog(models.Model):
+    member = models.ForeignKey(User)
+    create_date = models.DateTimeField(auto_now_add=True)
+    last_update = models.DateTimeField(auto_now=True)
+    log_date = models.DateField()
+    total_time = models.TimeField()
+    title = models.CharField(max_length=255)
+    comments = models.TextField(max_length=5000,blank=True)
+    
+    objects = FitLogManager()
+    
+    def __init__(self, *args, **kwargs):
+        super(FitLog,self).__init__(*args,**kwargs)
+        self.__total_exercises = None
+        self.__total_sets = None
+        self.__total_reps = None
+        self.__training_volume = None
+        self.__cardio_min = None
+        self.__cardio_distance = None
+        self.__calculated = False        
+    
+    def __calculate_totals(self):
+        if not self.__calculated:
+            if self.weightfitlogdetail_set:
+                self.__total_exercises = self.weightfitlogdetail_set.count()
+            else:
+                self.__total_exercises = 0
+
+
+
+            if self.weightfitlogdetail_set:
+                wl = self.weightfitlogdetail_set.all()
+                for w in wl:
+                    wdl = w.weightlogset_set.all()
+                    for wd in wdl:
+                        if not self.__total_sets:
+                            self.__total_sets = 0
+                        if not self.__total_reps:
+                            self.__total_reps = 0
+                        if not self.__training_volume:
+                            self.__training_volume = 0
+                                    
+                        self.__total_sets = self.__total_sets + 1                            
+                        self.__total_reps = self.__total_reps + wd.reps
+                        if wd.reps and wd.weight:
+                            self.__training_volume = self.__training_volume + (wd.reps * wd.weight )                        
+    
+            if self.cardiofitlogdetail_set:
+                cl = self.cardiofitlogdetail_set.all()
+                for c in cl:
+                        if not self.__cardio_min:
+                            self.__cardio_min = 0
+                        if not self.__cardio_distance:
+                            self.__cardio_distance = 0
+                                                                
+                        self.__cardio_min = addDateTimes(self.__cardio_min,c.total_time)
+                        self.__cardio_distance = self.__cardio_distance + c.distance
+                
+            self.__calculated = True
+            
+    
+    @property
+    def total_exercises(self):