Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 't9_command' into t10_signal
Conflicts: testsobol/mainapp/tests.py
- Loading branch information
Showing
15 changed files
with
164 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
Django==1.3 | ||
pil | ||
wsgiref==0.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test: | ||
python manage.py test mainapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from django.conf import settings | ||
|
||
|
||
def settings_context_processor(request): | ||
return {'settings':settings} | ||
return {'settings': settings} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,35 @@ | ||
structs = ( | ||
('name','surname','birth','img'), | ||
('email','jabber','skype','other', 'bio'), | ||
structs = ( | ||
('name', 'surname', 'birth', 'img'), | ||
('email', 'jabber', 'skype', 'other', 'bio'), | ||
) | ||
|
||
multiline = ('bio','other', 'img') | ||
multiline = ('bio', 'other', 'img') | ||
|
||
|
||
class Render(object): | ||
|
||
def get_struct(self, get, reverse): | ||
if reverse: | ||
local_structs = [struct[::-1] for struct in structs] | ||
else: | ||
local_structs = structs | ||
return [[dict(get(item).items() + [('multiline',(item in multiline))]) for item in struct] for struct in local_structs] | ||
return [[dict(get(item).items() + [('multiline', (item in multiline))]) | ||
for item in struct] | ||
for struct in local_structs] | ||
|
||
|
||
class DataRender(Render): | ||
|
||
def __init__(self, model): | ||
self.model = model | ||
|
||
def render(self): | ||
field_types = dict([(field.name, field.verbose_name) \ | ||
for field in self.model._meta.fields]) | ||
|
||
get = lambda item: {'value':\ | ||
unicode(getattr(self.model, item)) if item != 'img'\ | ||
else '<img src="%s" />' % getattr(self.model, item).url, | ||
'label': field_types[item]} | ||
|
||
return self.get_struct(get, False) |
Oops, something went wrong.