Permalink
Browse files

Upgrade for 1.4 and add home view shell

  • Loading branch information...
1 parent fb9bddb commit e84508747a5cd2c100ca52360d5867aff6b86889 @icohen committed Mar 14, 2012
File renamed without changes.
File renamed without changes.
View
@@ -1,5 +1,5 @@
from django.contrib import admin
-from geno import models
+from djeno.geno import models
class OneToOneInline(admin.StackedInline):
template = 'geno/admin/onetoonestacked.html'
@@ -17,33 +17,25 @@ class DeathInline(OneToOneInline):
class MarriageInline(Inline):
model = models.Marriage.spouses.through
- # verbose names below are a hack otherwise these show up as Spouses instead of Marriages in the PersonAdmin
+ # verbose names below are a hack otherwise these show up as MarriageRelations instead of Marriages in the PersonAdmin
verbose_name_plural = 'Marriages'
verbose_name = 'Marriage'
extra = 0
-class SpouseInline(Inline):
- model = models.Spouse
+class MarriageRelationInline(Inline):
+ model = models.MarriageRelation
extra = 2
class PersonAdmin(admin.ModelAdmin):
inlines = [BirthInline, DeathInline, MarriageInline]
-class MotherAdmin(PersonAdmin):
- model = models.Mother
-
-class FatherAdmin(PersonAdmin):
- model = models.Father
-
class MarriageAdmin(admin.ModelAdmin):
model = models.Marriage
- inlines = [SpouseInline]
+ inlines = [MarriageRelationInline]
admin.site.register(models.Person, PersonAdmin)
admin.site.register(models.Marriage, MarriageAdmin)
-admin.site.register(models.Mother, MotherAdmin)
-admin.site.register(models.Father, FatherAdmin)
View
@@ -1,25 +1,17 @@
from django.db import models
class Person(models.Model):
- name = models.CharField(max_length=64)
- mother = models.ForeignKey('Mother', related_name='children', blank=True, null=True)
- father = models.ForeignKey('Father', related_name='children', blank=True, null=True)
+ name = models.CharField(max_length=64)
+ parents = models.ManyToManyField('self',
+ related_name='children',
+ blank=True, null=True)
def __unicode__(self):
return self.name
class Meta:
verbose_name_plural='People'
-class Mother(Person):
- class Meta:
- proxy = True
-
-class Father(Person):
- class Meta:
- proxy = True
-
-
class Event(models.Model):
date = models.DateField()
@@ -38,12 +30,12 @@ class Death(Event):
def __unicode__(self):
return 'Death of {0}'.format(self.deceased.name)
-class Spouse(models.Model):
+class MarriageRelation(models.Model):
person = models.ForeignKey(Person)
marriage = models.ForeignKey('Marriage')
class Marriage(Event):
- spouses = models.ManyToManyField(Person, through=Spouse)
+ spouses = models.ManyToManyField(Person, through=MarriageRelation)
end_date = models.DateField(blank=True, null=True)
@property
@@ -0,0 +1,14 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>{% block head_title %}{% endblock %}</title>
+ {% block head_css %}{% endblock %}
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ {% block head_js %}{% endblock %}
+</head>
+<body>
+ {% block body %}
+ {% endblock %}
+</body>
+</html>
@@ -0,0 +1,8 @@
+{% extends "geno/base.html" %}
+{% block title %}Djeno!{% endblock %}
+{% block head_js %}
+<script type="text/javascript" src="{{ STATIC_URL }}/main.js"></script>
+{% endblock %}
+{% block body %}
+<h1>Welcome home!</h1>
+{% endblock %}
View
@@ -1 +1,6 @@
-# Create your views here.
+from django.shortcuts import get_object_or_404, render_to_response
+from django.template import RequestContext
+
+def home(request):
+ return render_to_response('geno/home.html', {},
+ context_instance=RequestContext(request))
View
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-from django.core.management import execute_manager
-import imp
-try:
- imp.find_module('settings') # Assumed to be in the same directory.
-except ImportError:
- import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
- sys.exit(1)
-
-import settings
-
-if __name__ == "__main__":
- execute_manager(settings)
View
@@ -65,16 +65,9 @@
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
-# URL prefix for admin static files -- CSS, JavaScript and images.
-# Make sure to use a trailing slash.
-# Examples: "http://foo.com/static/admin/", "/static/admin/".
-ADMIN_MEDIA_PREFIX = '/static/admin/'
-
# Additional locations of static files
STATICFILES_DIRS = (
- # Put strings here, like "/home/html/static" or "C:/www/django/static".
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
+ os.path.join(PROJECT_ROOT, 'static'),
)
# List of finder classes that know how to find static files in
@@ -105,11 +98,11 @@
ROOT_URLCONF = 'djeno.urls'
-TEMPLATE_DIRS = (
- # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
-)
+# Python dotted path to the WSGI application used by Django's runserver.
+WSGI_APPLICATION = 'djeno.wsgi.application'
+
+
+TEMPLATE_DIRS = ()
FIXTURE_DIRS = (
os.path.join(PROJECT_ROOT, 'fixtures'),
@@ -123,12 +116,10 @@
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
- # Uncomment the next line to enable the admin:
'django.contrib.admin',
- # Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
'django_extensions',
- 'geno'
+ 'djeno.geno',
)
# A sample logging configuration. The only tangible logging
@@ -0,0 +1,2 @@
+$(function(){
+});
View
@@ -1,17 +1,13 @@
from django.conf.urls.defaults import patterns, include, url
-
-# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
-urlpatterns = patterns('',
- # Examples:
- # url(r'^$', 'djeno.views.home', name='home'),
- # url(r'^djeno/', include('djeno.foo.urls')),
+from djeno.geno import views
- # Uncomment the admin/doc line below to enable admin documentation:
- url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
- # Uncomment the next line to enable the admin:
+
+urlpatterns = patterns('',
+ url(r'^$', views.home, name='home'),
+ url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
)
View
@@ -0,0 +1,28 @@
+"""
+WSGI config for dtest project.
+
+This module contains the WSGI application used by Django's development server
+and any production WSGI deployments. It should expose a module-level variable
+named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
+this application via the ``WSGI_APPLICATION`` setting.
+
+Usually you will have the standard Django WSGI application here, but it also
+might make sense to replace the whole Django WSGI application with a custom one
+that later delegates to the Django one. For example, you could introduce WSGI
+middleware here, or combine a Django application with an application of another
+framework.
+
+"""
+import os
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djeno.settings")
+
+# This application object is used by any WSGI server configured to use this
+# file. This includes Django's development server, if the WSGI_APPLICATION
+# setting points here.
+from django.core.wsgi import get_wsgi_application
+application = get_wsgi_application()
+
+# Apply WSGI middleware here.
+# from helloworld.wsgi import HelloWorldApplication
+# application = HelloWorldApplication(application)
View
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+import os, sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djeno.settings")
+
+ from django.core.management import execute_from_command_line
+
+ execute_from_command_line(sys.argv)

0 comments on commit e845087

Please sign in to comment.