author | Todd Larsen <tlarsen@google.com> |
Fri, 03 Oct 2008 23:01:49 +0000 | |
changeset 270 | 7dd6d8347b56 |
parent 249 | 325fb70c61a9 |
child 271 | 01e90bb21b7e |
permissions | -rw-r--r-- |
79
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
2 |
# |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
4 |
# |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
8 |
# |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
10 |
# |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
16 |
|
88
9a8180f0941a
Some additional __doc__ comments (with some ideas for future plans) and removal
Todd Larsen <tlarsen@google.com>
parents:
81
diff
changeset
|
17 |
"""Site-wide Melange home page views. |
9a8180f0941a
Some additional __doc__ comments (with some ideas for future plans) and removal
Todd Larsen <tlarsen@google.com>
parents:
81
diff
changeset
|
18 |
|
9a8180f0941a
Some additional __doc__ comments (with some ideas for future plans) and removal
Todd Larsen <tlarsen@google.com>
parents:
81
diff
changeset
|
19 |
public: how the general public sees the site home page of a Melange |
9a8180f0941a
Some additional __doc__ comments (with some ideas for future plans) and removal
Todd Larsen <tlarsen@google.com>
parents:
81
diff
changeset
|
20 |
site |
9a8180f0941a
Some additional __doc__ comments (with some ideas for future plans) and removal
Todd Larsen <tlarsen@google.com>
parents:
81
diff
changeset
|
21 |
|
164
afdf502c6cc4
Documentation updates and one typo fix.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
142
diff
changeset
|
22 |
edit: site settings view for logged-in Developers |
79
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
23 |
""" |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
24 |
|
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
25 |
__authors__ = [ |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
26 |
'"Pawel Solyga" <pawel.solyga@gmail.com>', |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
27 |
] |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
28 |
|
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
29 |
|
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
30 |
from google.appengine.api import users |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
31 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
32 |
from django import http |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
33 |
from django import shortcuts |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
34 |
from django import newforms as forms |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
35 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
36 |
from soc.logic import out_of_band |
249
325fb70c61a9
Replace common module with validate module. Move validation function from feed module to validate module and remove feed.py. Correct any usage of validation functions from common and feed modules into validate module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
225
diff
changeset
|
37 |
from soc.logic import validate |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
38 |
from soc.logic.site import id_user |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
39 |
from soc.views import simple |
270
7dd6d8347b56
Move helpers/template_helpers.py to helper/templates.py.
Todd Larsen <tlarsen@google.com>
parents:
249
diff
changeset
|
40 |
from soc.views import helper |
7dd6d8347b56
Move helpers/template_helpers.py to helper/templates.py.
Todd Larsen <tlarsen@google.com>
parents:
249
diff
changeset
|
41 |
import soc.views.helper.templates |
225
2590d6b83568
Add functions to soc/logic/document.py for dealing with partial_paths combined
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
42 |
from soc.views.helpers import custom_widgets |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
43 |
from soc.views.helpers import forms_helpers |
81
b03b1ec17727
Moved soc/site/home.html to soc/site/home/public.html and updated default template for public() in home.py
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
79
diff
changeset
|
44 |
from soc.views.helpers import response_helpers |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
45 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
46 |
import soc.models.site_settings |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
47 |
import soc.models.document |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
48 |
import soc.logic.document |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
49 |
import soc.logic.site.settings |
79
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
50 |
|
88
9a8180f0941a
Some additional __doc__ comments (with some ideas for future plans) and removal
Todd Larsen <tlarsen@google.com>
parents:
81
diff
changeset
|
51 |
|
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
52 |
class DocumentForm(forms_helpers.DbModelForm): |
142
d88c7dbea0e8
Forgot to change widgets to custom_widgets import in home.py after changing the name of soc/views/helpers/widgets.py file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
141
diff
changeset
|
53 |
content = forms.fields.CharField(widget=custom_widgets.TinyMCE()) |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
54 |
#link_name = forms.CharField(widget=forms.TextInput( |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
55 |
# attrs={'readonly':'true'})) |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
56 |
class Meta: |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
57 |
"""Inner Meta class that defines some behavior for the form. |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
58 |
""" |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
59 |
#: db.Model subclass for which the form will gather information |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
60 |
model = soc.models.document.Document |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
61 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
62 |
#: list of model fields which will *not* be gathered by the form |
225
2590d6b83568
Add functions to soc/logic/document.py for dealing with partial_paths combined
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
63 |
exclude = ['partial_path', 'link_name', |
2590d6b83568
Add functions to soc/logic/document.py for dealing with partial_paths combined
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
64 |
'user', 'modified', 'created', 'inheritance_line'] |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
65 |
|
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
66 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
67 |
class SiteSettingsForm(forms_helpers.DbModelForm): |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
68 |
"""Django form displayed when creating or editing Site Settings. |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
69 |
""" |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
70 |
class Meta: |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
71 |
"""Inner Meta class that defines some behavior for the form. |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
72 |
""" |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
73 |
#: db.Model subclass for which the form will gather information |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
74 |
model = soc.models.site_settings.SiteSettings |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
75 |
|
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
76 |
#: list of model fields which will *not* be gathered by the form |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
77 |
exclude = ['inheritance_line', 'home'] |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
78 |
|
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
79 |
def clean_feed_url(self): |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
80 |
feed_url = self.cleaned_data.get('feed_url') |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
81 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
82 |
if feed_url == '': |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
83 |
# feed url not supplied (which is OK), so do not try to validate it |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
84 |
return None |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
85 |
|
249
325fb70c61a9
Replace common module with validate module. Move validation function from feed module to validate module and remove feed.py. Correct any usage of validation functions from common and feed modules into validate module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
225
diff
changeset
|
86 |
if not validate.isFeedURLValid(feed_url): |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
87 |
raise forms.ValidationError('This URL is not a valid ATOM or RSS feed.') |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
88 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
89 |
return feed_url |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
90 |
|
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
91 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
92 |
DEF_SITE_SETTINGS_PATH = 'site' |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
93 |
DEF_SITE_HOME_DOC_LINK_NAME = 'home' |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
94 |
|
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
95 |
DEF_SITE_HOME_PUBLIC_TMPL = 'soc/site/home/public.html' |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
96 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
97 |
def public(request, template=DEF_SITE_HOME_PUBLIC_TMPL): |
88
9a8180f0941a
Some additional __doc__ comments (with some ideas for future plans) and removal
Todd Larsen <tlarsen@google.com>
parents:
81
diff
changeset
|
98 |
"""How the "general public" sees the Melange site home page. |
79
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
99 |
|
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
100 |
Args: |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
101 |
request: the standard django request object. |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
102 |
template: the template path to use for rendering the template. |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
103 |
|
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
104 |
Returns: |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
105 |
A subclass of django.http.HttpResponse with generated template. |
58001ec7720c
Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
106 |
""" |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
107 |
# create default template context for use with any templates |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
108 |
context = response_helpers.getUniversalContext(request) |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
109 |
|
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
110 |
site_settings = soc.logic.site.settings.getSiteSettings(DEF_SITE_SETTINGS_PATH) |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
111 |
|
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
112 |
if site_settings: |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
113 |
context.update({'site_settings': site_settings}) |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
114 |
site_doc = site_settings.home |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
115 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
116 |
if site_doc: |
270
7dd6d8347b56
Move helpers/template_helpers.py to helper/templates.py.
Todd Larsen <tlarsen@google.com>
parents:
249
diff
changeset
|
117 |
site_doc.content = helper.templates.unescape(site_doc.content) |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
118 |
context.update({'site_document': site_doc}) |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
119 |
|
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
120 |
return response_helpers.respond(request, template, context) |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
121 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
122 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
123 |
DEF_SITE_HOME_EDIT_TMPL = 'soc/site/home/edit.html' |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
124 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
125 |
def edit(request, template=DEF_SITE_HOME_EDIT_TMPL): |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
126 |
"""View for Developer to edit content of Melange site home page. |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
127 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
128 |
Args: |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
129 |
request: the standard django request object. |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
130 |
template: the template path to use for rendering the template. |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
131 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
132 |
Returns: |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
133 |
A subclass of django.http.HttpResponse with generated template. |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
134 |
""" |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
135 |
# create default template context for use with any templates |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
136 |
context = response_helpers.getUniversalContext(request) |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
137 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
138 |
logged_in_id = users.get_current_user() |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
139 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
140 |
alt_response = simple.getAltResponseIfNotDeveloper(request, context, |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
141 |
id=logged_in_id) |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
142 |
if alt_response: |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
143 |
# not a developer |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
144 |
return alt_response |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
145 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
146 |
alt_response = simple.getAltResponseIfNotLoggedIn(request, context, |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
147 |
id=logged_in_id) |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
148 |
if alt_response: |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
149 |
# not logged in |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
150 |
return alt_response |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
151 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
152 |
alt_response = simple.getAltResponseIfNotUser(request, context, |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
153 |
id = logged_in_id) |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
154 |
if alt_response: |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
155 |
# no existing User entity for logged in Google Account. User entity is |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
156 |
# required for creating Documents |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
157 |
return alt_response |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
158 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
159 |
settings_form = None |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
160 |
document_form = None |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
161 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
162 |
if request.method == 'POST': |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
163 |
document_form = DocumentForm(request.POST) |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
164 |
settings_form = SiteSettingsForm(request.POST) |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
165 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
166 |
if document_form.is_valid() and settings_form.is_valid(): |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
167 |
title = document_form.cleaned_data.get('title') |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
168 |
link_name = DEF_SITE_HOME_DOC_LINK_NAME |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
169 |
short_name = document_form.cleaned_data.get('short_name') |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
170 |
abstract = document_form.cleaned_data.get('abstract') |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
171 |
content = document_form.cleaned_data.get('content') |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
172 |
|
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
173 |
site_doc = soc.logic.document.updateOrCreateDocument( |
225
2590d6b83568
Add functions to soc/logic/document.py for dealing with partial_paths combined
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
174 |
partial_path=DEF_SITE_SETTINGS_PATH, link_name=link_name, |
2590d6b83568
Add functions to soc/logic/document.py for dealing with partial_paths combined
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
175 |
title=title, short_name=short_name, abstract=abstract, |
2590d6b83568
Add functions to soc/logic/document.py for dealing with partial_paths combined
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
176 |
content=content, user=id_user.getUserFromId(logged_in_id)) |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
177 |
|
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
178 |
feed_url = settings_form.cleaned_data.get('feed_url') |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
179 |
|
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
180 |
site_settings = soc.logic.site.settings.updateOrCreateSiteSettings( |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
181 |
DEF_SITE_SETTINGS_PATH, home=site_doc, feed_url=feed_url) |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
182 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
183 |
context.update({'submit_message': 'Site Settings saved.'}) |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
184 |
else: # request.method == 'GET' |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
185 |
# try to fetch SiteSettings entity by unique key_name |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
186 |
site_settings = soc.logic.site.settings.getSiteSettings( |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
187 |
DEF_SITE_SETTINGS_PATH) |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
188 |
|
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
189 |
if site_settings: |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
190 |
# populate form with the existing SiteSettings entity |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
191 |
settings_form = SiteSettingsForm(instance=site_settings) |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
192 |
site_doc = site_settings.home |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
193 |
else: |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
194 |
# no SiteSettings entity exists for this key_name, so show a blank form |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
195 |
settings_form = SiteSettingsForm() |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
196 |
site_doc = None |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
197 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
198 |
if site_doc: |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
199 |
# populate form with the existing Document entity |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
164
diff
changeset
|
200 |
document_form = DocumentForm(instance=site_doc) |
141
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
201 |
else: |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
202 |
# no Document entity exists for this key_name, so show a blank form |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
203 |
document_form = DocumentForm() |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
204 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
205 |
context.update({'document_form': document_form, |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
206 |
'settings_form': settings_form }) |
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
207 |
|
e120c24b89e2
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
88
diff
changeset
|
208 |
return response_helpers.respond(request, template, context) |