Permalink
Browse files

next

  • Loading branch information...
1 parent 7fea1ad commit 32abd763ab642a3ed2b2f75f4c91a710e4a27ce9 Andrii Pryz committed Feb 15, 2014
View
@@ -1,16 +1,19 @@
# run - Run local server
run:
@python3 manage.py runserver
+
# help - Display callable targets.
help:
@egrep "^# [a-z,\",=,_ ]+ - " Makefile
-# app="someapp" - Create app name "someapp"
-app:
- python3 manage.py startapp $(app)
+test:
+ @python3 manage.py test apps.pages.tests
+ @echo "App 'pages' have tested!"
+
# sqlall - Run sqlall command
sqlall:
@python3 manage.py sqlall $(app)
+
# stop - Stop local server
stop:
@killall python3
@@ -33,11 +36,7 @@ makemessages:
# compilemessages - Compile locale
compilemessages:
- @cd pages && django-admin.py compilemessages
-
-test:
- @python3 manage.py test apps.pages.tests
- @echo "App 'pages' have tested!"
+ @cd pages && django-admin.py compilemessages
# style - Check PEP8 and others
PEP8IGNORE=E22,E23,E24,E302,E401
View
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: MySmile
-Version: 1.0.0b
+Version: 0.3.0
Author: Andrii Pryz
Author-email: info@mysmile com ua
Home-page: http://mysmile.com.ua
View
@@ -3,9 +3,10 @@
urlpatterns = patterns('apps.api.views',
url(r'^content$', 'get_content'),
- url(r'^contact$', 'get_contact'),
- url(r'^languages$', 'get_languages'),
- #~ url(r'^api/content?slug=(?P<resource>[a-z,_]+)&v=1&lang=(?P<lang>[a-z]{2})&format=json$', 'get_content'),
+ #~ url(r'^contact$', 'get_contact'),
+ #~ url(r'^languages$', 'get_languages'),
+ #~ url(r'^content?v=1&lang=(?P<lang>[a-z]{2})&format=json$', 'get_content'),
+ #~ url(r'^content?slug=(?P<resource>[a-z,_]+)&v=1&lang=(?P<lang>[a-z]{2})&format=json$', 'get_content'),
)
View
@@ -2,30 +2,86 @@
from django.core import serializers
import json
from django.http import HttpResponse
+from django.utils.datastructures import MultiValueDictKeyError
-from apps.pages.models import Page
+from apps.pages.models import Page, Page_translation
from mysmile.user_settings import user_settings
from mysmile.settings import LANGUAGES
-def get_contact(request):
- response_data = {}
- response_data['msg'] = 200
- response_data['data'] = {'email':user_settings['EMAIL'],
+
+def get_content(request):
+ try:
+ lang = request.GET['lang']
+ except MultiValueDictKeyError:
+ lang = 'en'
+
+ try:
+ slug = request.GET['slug']
+ except MultiValueDictKeyError:
+ slug = ''
+
+ if slug == 'contact':
+ response_data = {}
+ response_data['msg'] = 200
+ response_data['data'] = {'email':user_settings['EMAIL'],
'phone':user_settings['PHONE'],
'skype':user_settings['SKYPE']
}
- return HttpResponse(json.dumps(response_data), mimetype="application/json")
+ return HttpResponse(json.dumps(response_data), mimetype="application/json")
+
+ elif slug == 'language':
+ response_data = {}
+ response_data['msg'] = 200
+ response_data['data'] = [item[0] for item in LANGUAGES]
+ return HttpResponse(json.dumps(response_data), mimetype="application/json")
+
+ elif slug=='':
+ response_data = {}
+ response_data['msg'] = 200
+ response_data['data'] = list(Page_translation.objects.filter(lang=lang, page__status=1).values_list('name', flat=True))
+ return HttpResponse(json.dumps(response_data), mimetype="application/json")
+
+ else:
+ response_data = {}
+ response_data['msg'] = 200
+ page_id = Page.objects.filter(slug=slug, status=1).values('id')
+ content = Page_translation.objects.filter(lang=lang, page__status=1, page_id=page_id).values('page__color', 'page__photo', 'menu', 'name', 'col_central', 'col_right', 'youtube', 'col_bottom_1', 'col_bottom_2', 'col_bottom_3', 'photo_alt', 'meta_title', 'meta_description', 'meta_keywords')
+
+ response_data['data'] = list(content)
+ #~ response_data = dict('data', content)
+ return HttpResponse(json.dumps(response_data), mimetype="application/json")
+
+
+
+
+
+#~ def get_languages(request):
+ #~ response_data = {}
+ #~ response_data['msg'] = 200
+ #~ response_data['data'] = [item[0] for item in LANGUAGES]
+ #~ return HttpResponse(json.dumps(response_data), mimetype="application/json")
+
-def get_content(request):
- response_data = {}
- response_data['msg'] = 200
- response_data['data'] = list(Page.objects.filter(status=1).values_list('slug', flat=True))
- return HttpResponse(json.dumps(response_data), mimetype="application/json")
-def get_languages(request):
- response_data = {}
- response_data['msg'] = 200
- response_data['data'] = [item[0] for item in LANGUAGES]
- return HttpResponse(json.dumps(response_data), mimetype="application/json")
+#~ def get_contact(request):
+ #~ response_data = {}
+ #~ response_data['msg'] = 200
+ #~ response_data['data'] = {'email':user_settings['EMAIL'],
+ #~ 'phone':user_settings['PHONE'],
+ #~ 'skype':user_settings['SKYPE']
+ #~ }
+ #~ return HttpResponse(json.dumps(response_data), mimetype="application/json")
+#~ def get_content(request, resource, lang):
+ #~ resource = request.GET['resource']
+ #~ lang = request.GET['lang']
+ #~
+ #~ print('AAA---->> ', resource, ' bbbb --- ', lang)
+ #~ response_data = {}
+ #~ response_data['msg'] = 200
+ #~ response_data['data'] = {'email':user_settings['EMAIL'],
+ #~ 'phone':user_settings['PHONE'],
+ #~ 'skype':user_settings['SKYPE']
+ #~ }
+ #~ return HttpResponse(json.dumps(response_data), mimetype="application/json")
@@ -0,0 +1,39 @@
+import datetime
+from django.test import TestCase
+from django.test.client import Client
+from apps.pages.models import Page, Page_translation
+
+
+class ViewTestCase(TestCase):
+ def setUp(self):
+ some_page = Page.objects.create(id=1,
+ slug='index',
+ color='#FDA132',
+ photo='images/photo.png',
+ sortorder=1,
+ status=1,
+ ptype=1,
+ updated_at=datetime.datetime.now(),
+ created_at=datetime.datetime.now())
+
+ Page_translation.objects.create(id=1,
+ page=some_page,
+ lang='en',
+ menu='Main',
+ col_central='lorem ipsum',
+ col_bottom_1='lorem ipsum',
+ col_bottom_2='lorem ipsum',
+ col_bottom_3='lorem ipsum',
+ meta_title='Welcome!',
+ meta_description='This is mane page!',
+ meta_keywords='Python3, Django',
+ photo_alt='',
+ updated_at=datetime.datetime.now(),
+ created_at=datetime.datetime.now())
+
+ self._client = Client()
+
+ def test_view(self):
+
+ response = self._client.get('/en/index.html')
+ self.assertEqual(response.status_code, 200)
View
@@ -1,15 +1,18 @@
2014-##-## Version 1.?.0
+ Contact page with contact form
+ Ability to upload price
-+ Social networks likes
++ Social networks "likes"
+ Possibility of autonomous translation of each unit of the page
+ Error page for a nonexistent translation
-2014-04-19 Version 1.0.1 annual celebratory release!
+2014-04-19 Version 1.0.0 annual celebratory release!
+ Email protection from spambot
++ Support versions Django from 1.4.x to 1.6.x
-2014-02-19 Version 1.0.0
+2014-03-?? Version 0.4.0
+ Add api
+
+2014-02-15 Version 0.3.0
+ Add tests
+ Use sphinx for docs
* Fix incorrect behavior of the dynamic menu
Binary file not shown.
@@ -53,7 +53,7 @@
<div class="section" id="structure-schema-and-design">
<span id="design"></span><h1>Structure schema and design<a class="headerlink" href="#structure-schema-and-design" title="Permalink to this headline">¶</a></h1>
-<img alt="../_images/image02.png" src="../_images/image02.png" />
+<img alt="../_images/image02.jpeg" src="../_images/image02.jpeg" />
</div>
@@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Next release &mdash; MySmile 1.0.0 documentation</title>
+ <title>Next releases &mdash; MySmile 1.0.0 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
@@ -51,8 +51,8 @@
<div class="bodywrapper">
<div class="body">
- <div class="section" id="next-release">
-<h1>Next release<a class="headerlink" href="#next-release" title="Permalink to this headline">¶</a></h1>
+ <div class="section" id="next-releases">
+<h1>Next releases<a class="headerlink" href="#next-releases" title="Permalink to this headline">¶</a></h1>
<p><strong>2014-##-## Version #.#.#</strong></p>
<ul class="simple">
<li>add: contact page with contact form</li>
@@ -64,6 +64,11 @@
<p><strong>2014-04-19 Version 1.0.1</strong> &#8212; annual celebratory release!</p>
<ul class="simple">
<li>add: email protection from spambot</li>
+<li>support versions Django from 1.4.x to 1.6.x</li>
+</ul>
+<p><strong>2014-03-## Version 0.4.0</strong></p>
+<ul class="simple">
+<li>add api</li>
</ul>
</div>
@@ -3,4 +3,4 @@
Structure schema and design
===========================
-.. image:: _static/images/image02.png
+.. image:: _static/images/image02.jpeg
@@ -1,5 +1,5 @@
-Next release
-============
+Next releases
+=============
**2014-##-## Version #.#.#**
@@ -13,4 +13,8 @@ Next release
**2014-04-19 Version 1.0.1** --- annual celebratory release!
* add: email protection from spambot
+* support versions Django from 1.4.x to 1.6.x
+**2014-03-## Version 0.4.0**
+
+* add api
Oops, something went wrong.
@@ -3,4 +3,4 @@
Structure schema and design
===========================
-.. image:: _static/images/image02.png
+.. image:: _static/images/image02.jpeg
@@ -1,5 +1,5 @@
-Next release
-============
+Next releases
+=============
**2014-##-## Version #.#.#**
@@ -13,4 +13,8 @@ Next release
**2014-04-19 Version 1.0.1** --- annual celebratory release!
* add: email protection from spambot
+* support versions Django from 1.4.x to 1.6.x
+**2014-03-## Version 0.4.0**
+
+* add api
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -4,7 +4,7 @@
"""
user_settings = {
# blank line indicates a development server 127.0.0.1:8000
- 'DOMAIN_NAME': '',#'http://mydomain.com/',#'http://demo.mysmile.com.ua/'
+ 'DOMAIN_NAME': '', # 'http://mydomain.com/',#'http://demo.mysmile.com.ua/'
'PHONE': '000 000 000 00 00', # http://en.wikipedia.org/wiki/Telephone_numbering_plan
'EMAIL': 'myemail@email.com',
'SKYPE': 'myskype',

0 comments on commit 32abd76

Please sign in to comment.