Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod Deploy #8

Open
wants to merge 18 commits into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions ci.sh

This file was deleted.

14 changes: 0 additions & 14 deletions example/manage.py

This file was deleted.

Empty file.
14 changes: 0 additions & 14 deletions example/sample/features/foreign_key_choice_field.feature

This file was deleted.

13 changes: 0 additions & 13 deletions example/sample/features/foreign_key_choice_field_steps.py

This file was deleted.

7 changes: 0 additions & 7 deletions example/sample/features/formset_view.feature

This file was deleted.

9 changes: 0 additions & 9 deletions example/sample/features/formset_view_steps.py

This file was deleted.

14 changes: 0 additions & 14 deletions example/sample/features/queryset_choice_field.feature

This file was deleted.

22 changes: 0 additions & 22 deletions example/sample/features/queryset_choice_field_steps.py

This file was deleted.

60 changes: 0 additions & 60 deletions example/sample/features/terrain.py

This file was deleted.

2 changes: 2 additions & 0 deletions example/sample/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models


class Person(models.Model):
name = models.CharField(max_length=100)
eye_color = models.ForeignKey('EyeColor')
Expand All @@ -8,6 +9,7 @@ class Person(models.Model):
def __unicode__(self):
return self.name


class EyeColor(models.Model):
name = models.CharField(max_length=30)

Expand Down
15 changes: 12 additions & 3 deletions example/sample/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from django import forms
from django.core.urlresolvers import reverse
from django.views.generic.edit import CreateView
Expand All @@ -7,12 +6,15 @@

from sample import models


class PersonForm(forms.ModelForm):
eye_color = ForeignKeyChoiceField(models.EyeColor)

class Meta(object):
exclude = ()
model = models.Person


class PersonFormSet(forms.models.BaseModelFormSet):

def __init__(self, *args, **kwargs):
Expand All @@ -23,26 +25,33 @@ def __init__(self, *args, **kwargs):
for form in self.forms:
form.fields['eye_color'].choices = eye_colors


class FewQueries(FormSetView):
model = models.Person
form_class = forms.models.modelformset_factory(model, form=PersonForm, formset=PersonFormSet, extra=10)


class ManyQueries(FormSetView):
model = models.Person
form_class = forms.models.modelformset_factory(model, extra=10)
form_class = forms.models.modelformset_factory(model, extra=10, fields=('eye_color', ))


class SimpleFormsetView(FormSetView):
model = models.Person
form_class = forms.models.modelformset_factory(model)
form_class = forms.models.modelformset_factory(model, fields=('eye_color', ))


class QuerysetChoiceFieldForm(forms.ModelForm):
second_eye_color = QuerysetChoiceField(queryset=models.EyeColor.objects.all())

class Meta(object):
model = models.Person
exclude = ()


class QuerysetChoiceFieldView(CreateView):
form_class = QuerysetChoiceFieldForm
template_name = 'sample/form.html'

def get_success_url(self):
return reverse('querysetchoice')
13 changes: 4 additions & 9 deletions example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,24 @@

ROOT_URLCONF = 'urls'

TEMPLATE_DIRS = (
abspath(join(parent, 'templates')),
)
TEMPLATE_DIRS = (abspath(join(parent, 'templates')), )

MIDDLEWARE_CLASSES = (
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

INTERNAL_IPS = ('127.0.0.1',)
INTERNAL_IPS = ('127.0.0.1', )

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.staticfiles',

'debug_toolbar',
'lettuce.django',
'django.contrib.messages',
'django_nose',

'sample',
'forms_ext',
)
Expand Down
7 changes: 4 additions & 3 deletions example/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from django.conf.urls.defaults import patterns, include, url
from django.conf.urls import patterns, url

from sample import views

urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^few-queries$', views.FewQueries.as_view(), name="few_queries"),
url(r'^many-queries$', views.ManyQueries.as_view(), name="many_queries"),
url(r'^simple-formset-view$', views.SimpleFormsetView.as_view(), name="simple"),
url(r'^queryset-choice-view$', views.QuerysetChoiceFieldView.as_view(), name="querysetchoice"),
)
)
1 change: 0 additions & 1 deletion forms_ext/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
VERSION = '0.0.9'
Loading
Loading