attaching an app to site via apphook fails. server crashes only (beginner question)

2015-03-06 Thread inoyon artlover KLANGRAUSCH
Hi there,

regarding the django-cms tutorial I put this file into the 'polls' app:

*cms_app.py*

rom cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool


class PollApp(CMSApp):
name = 'Poll App'
urls = 'polls.urls'

apphook_pool.register(PollApp)

I created a site and via the django-cms interface. Than edited the site
via advanced settings: adding the hooked app and defining a 'namespace'
as reqired.

result is:

ImportError at /de/ 

No module named 'p'

 Request Method: GET  Request URL: http://127.0.0.1:8000/de/  Django 
Version: 1.7.5  Exception Type: ImportError  Exception Value: 

No module named 'p'


What is going on here?

Many thanks for any hints!!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/176e3ca8-ca15-4341-b9d0-9da5f760c0ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Fwd: attaching an app to site via apphook fails. server crashes only (beginner question)

2015-03-06 Thread Erik Cederstrand


> Start på videresendt besked:
> 
> Dato: 6. mar. 2015 kl. 09.49.01 CET
> Fra: inoyon artlover KLANGRAUSCH 
> Til: django-users@googlegroups.com
> Emne: attaching an app to site via apphook fails. server crashes only 
> (beginner question)
> 
> I created a site and via the django-cms interface. Than edited the site
> via advanced settings: adding the hooked app and defining a 'namespace'
> as reqired.
> 
> result is:
> 
> ImportError at /de/
> 
> No module named 'p'
> Request Method:   GET
> Request URL:  http://127.0.0.1:8000/de/
> Django Version:   1.7.5
> Exception Type:   ImportError
> Exception Value:  
> No module named 'p'


Try starting runserver as "python manage.py runserver --traceback"

That should get you a traceback when you open the URL in your browser, so you 
can see where in your code the ImportError is happening

Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/C8E8FD55-0253-4FF5-93F6-D79BBA529FA4%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: attaching an app to site via apphook fails. server crashes only (beginner question)

2015-03-06 Thread inoyon artlover KLANGRAUSCH
Many thanks for the answer.

"python manage.py runserver --traceback"
dumps:

http://pastebin.com/yeC7zkpf

and python manage.py cms check gives no errors


Am Freitag, 6. März 2015 10:13:37 UTC+1 schrieb Erik Cederstrand:
>
>
>
> Start på videresendt besked:
>
> *Dato: *6. mar. 2015 kl. 09.49.01 CET
> *Fra: *inoyon artlover KLANGRAUSCH  >
> *Til: *django...@googlegroups.com 
> *Emne: **attaching an app to site via apphook fails. server crashes only 
> (beginner question)*
>
> I created a site and via the django-cms interface. Than edited the site
> via advanced settings: adding the hooked app and defining a 'namespace'
> as reqired.
>
> result is:
>
> ImportError at /de/ 
>
> No module named 'p'
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/de/  Django 
> Version: 1.7.5  Exception Type: ImportError  Exception Value: 
>
> No module named 'p'
>
>
> Try starting runserver as "python manage.py runserver --traceback"
>
> That should get you a traceback when you open the URL in your browser, so 
> you can see where in your code the ImportError is happening
>
> Erik
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00fee023-20d9-4a14-af61-2c0f58c3b41e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: TemplateSyntaxError with {% cycle "Hello, how are you?" "Fine!" %}

2015-03-06 Thread Alasdair Nicol

On 05/03/15 17:23, Carsten Fuchs wrote:

If you use single quotes and render the template, it outputs 'Hello',
not 'Hello, how are you?' as expected.


As expected? Why please? Docs say that with single or double quotes, the
values are treated as string literals.


Sorry, I wasn't clear. By 'as expected', I meant that you want the cycle 
tag to return "Hello, how are you". Switching to single quotes isn't a 
fix, because it only returns 'Hello'.


Cheers,
Alasdair


--
Alasdair Nicol
Developer, MEMSET

mail: alasd...@memset.com
 web: http://www.memset.com/

Memset Ltd., registration number 4504980.
Building 87, Dunsfold Park, Stovolds Hill, Cranleigh, Surrey, GU6 8TB, UK

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F97C30.5050303%40memset.com.
For more options, visit https://groups.google.com/d/optout.


what do you think about django FORM system?

2015-03-06 Thread younger.shen
Hello everyone:

i use django since last year, and now i can not stand the django form any
more, hard to use , especially custom error message , i use laravel for php
development , and validator of laravel is very easy to use and very clean
code , so i hack a small plugin .

https://github.com/youngershen/django-laravel-validator

i want your opinion my friends.  talk to me please , what is your opinion
about django form.


every key to every locked *DREAM* 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFp8GAKe7r7PWzBbFMsLk6PuR863-QU5%3D%2Bv%2BGQ4uA_yihFh3dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread aRkadeFR

Hello

It's pretty easy to use django forms after reading the docs.
And django form are well integrated with the whole django framework.
You have multiple layers of cleaning the form, from the widget to the 
model, and

I love that.

Could you provide us more in-deapth of your feeling using the django form?
What are the problem? Or what do you expect from it?

Thanks

On 03/06/2015 11:37 AM, younger.shen wrote:

Hello everyone:

i use django since last year, and now i can not stand the django form 
any more, hard to use , especially custom error message , i use 
laravel for php development , and validator of laravel is very easy to 
use and very clean code , so i hack a small plugin .


https://github.com/youngershen/django-laravel-validator

i want your opinion my friends.  talk to me please , what is your 
opinion about django form.



every key to every locked *DREAM* 
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFp8GAKe7r7PWzBbFMsLk6PuR863-QU5%3D%2Bv%2BGQ4uA_yihFh3dw%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F984E9.2070701%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread Tom Evans
On Fri, Mar 6, 2015 at 10:37 AM, younger.shen  wrote:
> Hello everyone:
>
> i use django since last year, and now i can not stand the django form any
> more, hard to use , especially custom error message , i use laravel for php
> development , and validator of laravel is very easy to use and very clean
> code , so i hack a small plugin .
>
> https://github.com/youngershen/django-laravel-validator
>
> i want your opinion my friends.  talk to me please , what is your opinion
> about django form.

I prefer django forms to that style. Each time the form is generated
it must determine what the options are for a field by parsing strings,
which is ugly.

If you don't invest time in to learning how django's forms work, you
will always prefer a form system you already understand. As an
example, this is your RegistValidator as a django form:

class RegistValidator(forms.Form):
email = forms.EmailField()
password = forms.PasswordField(min_length=8)
password_confirm = forms.PasswordField(min_length=8)
captcha_0 = forms.CharField()
captcha_1 = forms.CharField()

def clean(self):
data = super(RegistValidator, self).clean()
if data['password'] != data['password_confirm']:
self.add_error('password', u'密码不匹配')
try:
CaptchaStore.objects.get(
response=data['captcha_1'],
hashkey=data['captcha_0'],
expiration__gt=get_safe_now()).delete()
except CaptchaStore.DoesNotExist:
self.add_error('captcha_0', u'验证码错误')
self.add_error('captcha_1', u'验证码错误')

def clean_email(self):
if User.objects.filter(email=self.cleaned_data['email']).exists():
raise forms.ValidationError(u'该用户已存在')

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1Li4%3Dujpbsn8EJ-kKF_x%2BjkB4_LvzqTbw1Lkp%3D4r7A8wA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Gunicorn sock file is missing?

2015-03-06 Thread Kaloian
Hi Erik, and thanks for the help. 

Well it appears to be a permission issue after all, but I really cannot 
understand why. I tried to change the directory for the sock file from 
/webapps/my-app/run/gunicorn.sock to /sockets/gunicorn.sock and gunicorn 
started normally. I tried to give full permissions to /webapps/my-app/run/ 
but still no success. I never tried to create the sock file myself and the 
/webapps/my-app/run/ dir is empty all the time. I cannot understand what is 
stopping gunicorn from creating the sock file in this directory. 

Regards,
Kaloian 

On Thursday, February 26, 2015 at 10:47:41 AM UTC+2, Erik Cederstrand wrote:
>
>
> > Den 26/02/2015 kl. 07.56 skrev Kaloian  >: 
> > 
> > Hi Erik, 
> > 
> > No it doesn't start at all, running the gunicorn_start script gives: 
> > 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Can't connect to /path/to/my/gunicorn.sock 
> > 
> > This is why I thought that the missing sock file is failing it to start. 
> Do you think it could be something else? 
> > I have already tried to add the absolute path in gunicorn_start but 
> nothing changed. 
>
> A UNIX socket is like a TCP connection, except it's represented as a file. 
> gunicorn is supposed to create it on startup and destroy it on shutdown, 
> and it shouldn't be present when gunicorn is not running. 
>
> Maybe you tried to create /path/to/my/gunicorn.sock yourself, and the file 
> is now garbage? Try deleting it. Otherwise, another instance of gunicorn 
> may be running already. Try "ps aux | grep gunicorn" or "lsof -U | grep 
> gunicorn" if you're on Linux. Also, the user running gunicorn_start must 
> have access to create files in /path/to/my/ 
>
> Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59fe3b92-d9d7-4e03-b8f3-b0be1c355d78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Admin Page

2015-03-06 Thread ebuild
Check django1.8 compatibility with python2.7

On Friday, February 20, 2015 at 7:40:03 AM UTC+1, Tim Co wrote:
>
> Hello,
>
> We are trying to run a local development server for our django python app. 
> We are able to connect to our localhost index and get the "It Worked!" 
> Dango page. However when we try to connect to 127.0.0.1/admin/ we are 
> getting an error that the server dropped the connection. Here is the log 
> for the django project:
>
> Exception happened during processing of request from ('130.191.204.231', 
> 62070)
> Traceback (most recent call last):
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/SocketServer.py", line 593, in process_request_thread
> self.finish_request(request, client_address)
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/SocketServer.py", line 334, in finish_request
> self.RequestHandlerClass(request, client_address, self)
>   File "/Library/Python/2.7/site-packages/Django-1.8.
> dev20141212211410-py2.7.egg/django/core/servers/basehttp.py", line 101, 
> in __init__
> super(WSGIRequestHandler, self).__init__(*args, **kwargs)
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/SocketServer.py", line 649, in __init__
> self.handle()
>   File "/Library/Python/2.7/site-packages/Django-1.8.
> dev20141212211410-py2.7.egg/django/core/servers/basehttp.py", line 173, 
> in handle
> handler.run(self.server.get_app())
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/wsgiref/handlers.py", line 92, in run
> self.close()
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/wsgiref/simple_server.py", line 33, in close
> self.status.split(' ',1)[0], self.bytes_sent
> AttributeError: 'NoneType' object has no attribute 'split'
>
> 
> ///
> Our urls.py file
>
> urls.py
>
> from django.conf.urls import include, url
> from django.contrib import admin
>
> admin.autodiscover()
>
> urlpatterns = [
> # Examples:
> # url(r'^$', 'mysite.views.home', name='home'),
> # url(r'^blog/', include('blog.urls')),
> url(r'^admin/', include(admin.site.urls)),
> ]
>
>
> 
> ///
> settings.py
>
>
> # Application definition
>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'trainstar',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> 'django.middleware.security.SecurityMiddleware',
> )
>
> TEMPLATE_CONTEXT_PROCESSORS = (
> "django.contrib.auth.context_processors.auth",
> "django.core.context_processors.debug",
> "django.core.context_processors.i18n",
> "django.core.context_processors.media",
> "django.core.context_processors.static",
> "django.core.context_processors.tz",
> 'django.contrib.messages.context_processors.messages'
> )
>
>
> ROOT_URLCONF = 'mysite.urls'
>
> WSGI_APPLICATION = 'mysite.wsgi.application'
>
>
> Please advise. I've exhausted Google/stackoverflow for possible fixes to 
> of no avail. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/26be1781-b1ff-4758-ae66-5185edbcefc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Where to post documentation suggestions?

2015-03-06 Thread Sakari Ellonen
https://docs.djangoproject.com/en/dev/internals/contributing/ Here it says 
that you can report bugs in the ticket tracker, but no mention about docs 
and tickets. There is a page for improving documentation, but it leads to a 
guide about how to use Sphinx etc., which feels scary for someone who is 
not sure at all that his suggestion will actually be considered an 
improvement.

On Thursday, March 5, 2015 at 3:16:29 PM UTC+2, Tim Graham wrote:
>
> Same ticket tracker: https://code.djangoproject.com/newticket
>
> Is there some place where you saw bug reports and feature requests 
> mentioned that we should add "documentation updates" so we could have 
> prevented your confusion?
>
> On Thursday, March 5, 2015 at 7:33:02 AM UTC-5, Sakari Ellonen wrote:
>>
>> It took me some time to realize that the names of unittest test methods 
>> must start with "test_". It says so in the python unittest documentation, 
>> but I think mentioning it in the Django documentation could save someone 
>> else a non-negligible amount of time. Just a brief mention here would be 
>> sufficient: 
>> https://docs.djangoproject.com/en/1.6/topics/testing/overview/#running-tests
>>  
>>
>> However, looking at the documentation, I found a bigger problem. It is 
>> not clear to me where to even post suggestions for documentation 
>> improvement. Bug reports and feature requests are covered, but I think 
>> contributing to documentation is where the widest group of people could 
>> participate.
>>
>> -Sakari
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0796d559-d1d0-4041-a739-4c0eed540431%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread felix

El 06/03/15 05:37, younger.shen escribió:

Hello everyone:

i use django since last year, and now i can not stand the django form 
any more, hard to use , especially custom error message , i use 
laravel for php development , and validator of laravel is very easy to 
use and very clean code , so i hack a small plugin .


https://github.com/youngershen/django-laravel-validator

i want your opinion my friends.  talk to me please , what is your 
opinion about django form.


I, definitevely, like django forms. They are easy to use and validation 
is similar to model validation. It just takes a thing: reading the doc.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9AFF8.7030100%40epepm.cupet.cu.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread john
I can tell you what I found to be hard to understand (and I don't think 
I do understand at the moment) that is how to set the HTML, the types, 
ID, and any of the special attributes of the object.  I understand that 
I can sub-class but it's also my understanding that I shouldn't have 
too.  For example I want to use the new HTML 5 type=month.  I'd also 
like to use size but so far I haven't determined how.  I did get the 
validation working.


Johnf

On 03/06/2015 02:43 AM, aRkadeFR wrote:

Hello

It's pretty easy to use django forms after reading the docs.
And django form are well integrated with the whole django framework.
You have multiple layers of cleaning the form, from the widget to the 
model, and

I love that.

Could you provide us more in-deapth of your feeling using the django form?
What are the problem? Or what do you expect from it?

Thanks

On 03/06/2015 11:37 AM, younger.shen wrote:

Hello everyone:

i use django since last year, and now i can not stand the django form 
any more, hard to use , especially custom error message , i use 
laravel for php development , and validator of laravel is very easy 
to use and very clean code , so i hack a small plugin .


https://github.com/youngershen/django-laravel-validator

i want your opinion my friends.  talk to me please , what is your 
opinion about django form.



every key to every locked *DREAM* 
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, 
send an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFp8GAKe7r7PWzBbFMsLk6PuR863-QU5%3D%2Bv%2BGQ4uA_yihFh3dw%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F984E9.2070701%40arkade.info 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9BBCD.3070408%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: Future for Django, Jobs, Confused :/

2015-03-06 Thread Ismael Ezequiel
thak

Em quarta-feira, 4 de março de 2015 16:15:32 UTC-3, Ismael Ezequiel 
escreveu:
>
> Estou confuso que escolha "framework" para o desenvolvimento web, eu adoro 
> Python. como é o futuro para Django, eu passar um tempo estudando muito 
> Django. Eu vejo mais empregos para Ruby on Rails que Django: /
>
> Desculpe o meu Inglês.
>
> Obrigado.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/32e0d74e-7aa8-43fa-a024-79aa86a32ccc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Gunicorn sock file is missing?

2015-03-06 Thread aRkadeFR


On 03/06/2015 01:30 PM, Kaloian wrote:

Hi Erik, and thanks for the help.

Well it appears to be a permission issue after all, but I really 
cannot understand why. I tried to change the directory for the sock 
file from /webapps/my-app/run/gunicorn.sock to /sockets/gunicorn.sock 
and gunicorn started normally. I tried to give full permissions to 
/webapps/my-app/run/ but still no success. I never tried to create the 
sock file myself and the /webapps/my-app/run/ dir is empty all the 
time. I cannot understand what is stopping gunicorn from creating the 
sock file in this directory.


Did you try to sudo to the user running gunicorn and creating the socket?
Some hints:
- The user can't access the directory cause he is not allowed to index 
one of his parent

- The user isn't in one of the new group cause he is logged in
- ... ?

Most of the time sudo to the user is useful for me



Regards,
Kaloian

On Thursday, February 26, 2015 at 10:47:41 AM UTC+2, Erik Cederstrand 
wrote:



> Den 26/02/2015 kl. 07.56 skrev Kaloian >:
>
> Hi Erik,
>
> No it doesn't start at all, running the gunicorn_start script
gives:
>
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Can't connect to /path/to/my/gunicorn.sock
>
> This is why I thought that the missing sock file is failing it
to start. Do you think it could be something else?
> I have already tried to add the absolute path in gunicorn_start
but nothing changed.

A UNIX socket is like a TCP connection, except it's represented as
a file. gunicorn is supposed to create it on startup and destroy
it on shutdown, and it shouldn't be present when gunicorn is not
running.

Maybe you tried to create /path/to/my/gunicorn.sock yourself, and
the file is now garbage? Try deleting it. Otherwise, another
instance of gunicorn may be running already. Try "ps aux | grep
gunicorn" or "lsof -U | grep gunicorn" if you're on Linux. Also,
the user running gunicorn_start must have access to create files
in /path/to/my/

Erik

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59fe3b92-d9d7-4e03-b8f3-b0be1c355d78%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9C13C.7000101%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread aRkadeFR

So you're problem is not about forms but widgets.

The widget are the object that render a field form. You can subclass
it to render it in anyway you want.

What do you don't like in subclassing a widget/model ?

On 03/06/2015 03:38 PM, john wrote:
I can tell you what I found to be hard to understand (and I don't 
think I do understand at the moment) that is how to set the HTML, the 
types, ID, and any of the special attributes of the object.  I 
understand that I can sub-class but it's also my understanding that I 
shouldn't have too.  For example I want to use the new HTML 5 
type=month.  I'd also like to use size but so far I haven't determined 
how.  I did get the validation working.


Johnf

On 03/06/2015 02:43 AM, aRkadeFR wrote:

Hello

It's pretty easy to use django forms after reading the docs.
And django form are well integrated with the whole django framework.
You have multiple layers of cleaning the form, from the widget to the 
model, and

I love that.

Could you provide us more in-deapth of your feeling using the django 
form?

What are the problem? Or what do you expect from it?

Thanks

On 03/06/2015 11:37 AM, younger.shen wrote:

Hello everyone:

i use django since last year, and now i can not stand the django 
form any more, hard to use , especially custom error message , i use 
laravel for php development , and validator of laravel is very easy 
to use and very clean code , so i hack a small plugin .


https://github.com/youngershen/django-laravel-validator

i want your opinion my friends.  talk to me please , what is your 
opinion about django form.



every key to every locked *DREAM* 
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, 
send an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFp8GAKe7r7PWzBbFMsLk6PuR863-QU5%3D%2Bv%2BGQ4uA_yihFh3dw%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, 
send an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F984E9.2070701%40arkade.info 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9BBCD.3070408%40jfcomputer.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9C1D7.6020007%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread felix

El 06/03/15 09:38, john escribió:
I can tell you what I found to be hard to understand (and I don't 
think I do understand at the moment) that is how to set the HTML, the 
types, ID, and any of the special attributes of the object.  I 
understand that I can sub-class but it's also my understanding that I 
shouldn't have too.  For example I want to use the new HTML 5 
type=month.  I'd also like to use size but so far I haven't determined 
how.  I did get the validation working.




Maybe a look at Rendering fields manually in the Forms section of the 
doc might be helpful.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9C3E2.7050007%40epepm.cupet.cu.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread john
OK for example how can I set the size of "widget"?  What I really want 
is some doc that provides an example - I've searched with no results.  I 
ended up with using a real HTML on the template along with the rest of 
the django objects.

Johnf

On 03/06/2015 07:03 AM, aRkadeFR wrote:

So you're problem is not about forms but widgets.

The widget are the object that render a field form. You can subclass
it to render it in anyway you want.

What do you don't like in subclassing a widget/model ?

On 03/06/2015 03:38 PM, john wrote:
I can tell you what I found to be hard to understand (and I don't 
think I do understand at the moment) that is how to set the HTML, the 
types, ID, and any of the special attributes of the object.  I 
understand that I can sub-class but it's also my understanding that I 
shouldn't have too.  For example I want to use the new HTML 5 
type=month.  I'd also like to use size but so far I haven't 
determined how.  I did get the validation working.


Johnf

On 03/06/2015 02:43 AM, aRkadeFR wrote:

Hello

It's pretty easy to use django forms after reading the docs.
And django form are well integrated with the whole django framework.
You have multiple layers of cleaning the form, from the widget to 
the model, and

I love that.

Could you provide us more in-deapth of your feeling using the django 
form?

What are the problem? Or what do you expect from it?

Thanks

On 03/06/2015 11:37 AM, younger.shen wrote:

Hello everyone:

i use django since last year, and now i can not stand the django 
form any more, hard to use , especially custom error message , i 
use laravel for php development , and validator of laravel is very 
easy to use and very clean code , so i hack a small plugin .


https://github.com/youngershen/django-laravel-validator

i want your opinion my friends.  talk to me please , what is your 
opinion about django form.



every key to every locked *DREAM* 
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, 
send an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFp8GAKe7r7PWzBbFMsLk6PuR863-QU5%3D%2Bv%2BGQ4uA_yihFh3dw%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, 
send an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F984E9.2070701%40arkade.info 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, 
send an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9BBCD.3070408%40jfcomputer.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9C1D7.6020007%40arkade.info 
.

For more optio

Re: what do you think about django FORM system?

2015-03-06 Thread john
OK I realize you are saying I should read the doc's.  So I will provide 
exactly what I'm saying from the doc's.


Django handles three distinct parts of the work involved in forms:

 * preparing and restructuring data ready for rendering
 * creating HTML forms for the data
 * receiving and processing submitted forms and data from the client

It is/possible/to write code that does all of this manually, but Django 
can take care of it all for you.


I read the above and I say why do I need to subclass anything. CharField 
is provided and that's all I really need because it's just a few chars 
the user is going to enter.  But I need to provide an ID, a SIZE, a few 
things - where is that info and where are the examples?  Maybe I missed 
them?  I've been know to mis-read stuff.


Johnf



On 03/06/2015 07:12 AM, felix wrote:

El 06/03/15 09:38, john escribió:
I can tell you what I found to be hard to understand (and I don't 
think I do understand at the moment) that is how to set the HTML, the 
types, ID, and any of the special attributes of the object.  I 
understand that I can sub-class but it's also my understanding that I 
shouldn't have too.  For example I want to use the new HTML 5 
type=month.  I'd also like to use size but so far I haven't 
determined how.  I did get the validation working.




Maybe a look at Rendering fields manually in the Forms section of the 
doc might be helpful.

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9C3E2.7050007%40epepm.cupet.cu 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9C5A2.3070600%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread felix

El 06/03/15 10:20, john escribió:
OK I realize you are saying I should read the doc's.  So I will 
provide exactly what I'm saying from the doc's.


Django handles three distinct parts of the work involved in forms:

  * preparing and restructuring data ready for rendering
  * creating HTML forms for the data
  * receiving and processing submitted forms and data from the client

It is/possible/to write code that does all of this manually, but 
Django can take care of it all for you.


I read the above and I say why do I need to subclass anything. 
CharField is provided and that's all I really need because it's just a 
few chars the user is going to enter.  But I need to provide an ID, a 
SIZE, a few things - where is that info and where are the examples?  
Maybe I missed them?  I've been know to mis-read stuff.



something like this you mean?

class  CommentForm(forms.Form):
name  =  forms.CharField(widget=forms.TextInput(attrs={'class':  
'special'}))
url  =  forms.URLField()
comment  =  forms.CharField(widget=forms.TextInput(attrs={'size':  '40'}))

Cheers,
Felix.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9CFA3.2010708%40epepm.cupet.cu.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread john
I saws that to in the Doc's - it did not work for me with bootstrap.  I 
did not find the cause - if there wasn't some sort of bug.  I'm using 
Django 1.7.5 so I'll guess and say it had something to do with the 
interaction of the two.  I have moved on to crispy-forms and all seems 
to work.  But like I said at the start - in answer to the question 
"Could you provide us more in-deapth of your feeling using the django 
form?"  I found the information provided from the doc's to be confusing 
and did not explain why I had to subclass.  More examples are needed 
(and all in one doc - not link after link after link).  Maybe what I'm 
asking for is for the tutorial to better explain the use and ways to mod 
the form code to get things done.


Johnf
On 03/06/2015 08:02 AM, felix wrote:

El 06/03/15 10:20, john escribió:
OK I realize you are saying I should read the doc's.  So I will 
provide exactly what I'm saying from the doc's.


Django handles three distinct parts of the work involved in forms:

  * preparing and restructuring data ready for rendering
  * creating HTML forms for the data
  * receiving and processing submitted forms and data from the client

It is/possible/to write code that does all of this manually, but 
Django can take care of it all for you.


I read the above and I say why do I need to subclass anything. 
CharField is provided and that's all I really need because it's just 
a few chars the user is going to enter.  But I need to provide an ID, 
a SIZE, a few things - where is that info and where are the 
examples?  Maybe I missed them?  I've been know to mis-read stuff.



something like this you mean?

class  CommentForm(forms.Form):
 name  =  forms.CharField(widget=forms.TextInput(attrs={'class':  
'special'}))
 url  =  forms.URLField()
 comment  =  forms.CharField(widget=forms.TextInput(attrs={'size':  '40'}))

Cheers,
Felix.

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9CFA3.2010708%40epepm.cupet.cu 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9D442.4040905%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to save user to foreignKey field for new records in modelFormset case?

2015-03-06 Thread Collin Anderson
Hi,

The form doesn't have access to the current user. I'd attach it using the 
view.

Thanks,
Collin

On Wednesday, February 25, 2015 at 3:53:40 AM UTC-5, Mike wrote:
>
> Hi,
> I have created modelFormset using SchoolHistory model and SchoolForm form.
>
> "SchoolFormSet = modelformset_factory(SchoolHistory, form=SchoolForm)"
>
> I get other content from Form, but should save current user to 
> SchoolHistory model too.
>   
> user=models.ForeignKey(User)
> school_name = models.CharField(max_length = 100)
> rating_average = models.PositiveIntegerField()
>
> I am overriding is_valid or save in order to save user field. 
> My question is how to find current user in model or form level as there is 
> no request parameter available ( request.user).
> request was available in Formset level but I cannot save user to each 
> record there, or could I?
>
> -Thanks
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6a149437-2dd6-4d5c-bcce-a304b9fcbcbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python / Django slow ? Deciding my next technological stack

2015-03-06 Thread Ilya Kazakevich
In modern world any heavy loaded site should have HORIZONTAL SCALING. That 
means it should support scale by adding new servers to cluster.
With horizontal scaling you should not care about how python is slow on 
each node, until you have traffic like Facebook or Guthub have. I believe 
99% websites work well on Python/Django and you have more chances to face 
database bottlenecks, than Django/Python bottlenecks. You know Instagram, 
right? They use Django AFAIK. 

CLR (.NET) should probably be faster in some cases (specially with JIT) and 
it has better multithreading support and better profiling tools, but even 
with it you will need to create cluster architecture for heavy sites.

So, choosing between C#/.NET and Python/Django is not about performance, I 
believe. It is about language, platforms, static/no static typing and so on.




On Wednesday, February 25, 2015 at 2:30:30 AM UTC+3, Benj wrote:
>
> Hi,
> i'm going to invest lots of time and energy in various web projects 
> (mostly community web sites), and want to pick up a language / framework 
> and invest heavily on it.
> I've spent a lot of time evaluating the various options, and narrowed my 
> choice to 2 stacks: C sharp asp.net  MVC or Python / Django.
>
> I'm more attracted to Python / Django combo, because of the Python 
> language, and high level framework Django. I really want to use these.
> My only concern is speed. I read that Python can't run concurrent tasks, 
> is this true ? So a multi-processor with hyperthreads won't benefit the 
> stack and even slow it down ?
> I have no clue how this translates in reality, but should I expect 
> noticable performance difference on a same server, shall I use Python / 
> Django than if I had C Sharp Asp.net ?
> I don't want to invest lots of time and efforts only to discover in the 
> end that the site is slow. 
> You that have real world experiences with running sites, what are your 
> conclusions ?
>
>
> I expect sites to be medium traffic: could be handled by a good dedicated 
> server or average cloud ressources.
>
> Benj
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b610b638-2b97-4af5-a211-313c654f56c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Future for Django, Jobs, Confused :/

2015-03-06 Thread Ilya Kazakevich
You never know what would be popular in next several years. In late 90th 
Perl was the main web development language. In 2000th it was PHP. Now it is 
Ruby and Python. If you love Python, use Django but study Ruby/RoR in 
background. Ruby is not rocket science and you should not have any serious 
troubles with it if you are advanced Python programmer. Do not lock 
yourself with ONE language unless you have your own startup that uses this 
language.


On Wednesday, March 4, 2015 at 10:15:32 PM UTC+3, Ismael Ezequiel wrote:
>
> I'm confused what "framework" choice for web development, I love Python. 
> as is the future for Django, I spend a lot time studying Django. I see more 
> jobs for Ruby on Rails than Django :/
>
> Sorry my english.
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cb35b856-45e7-48e0-a2a2-a452fb04d2ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Sharing templates across multiple projects

2015-03-06 Thread JHeasly
Hello —

I'm looking for any blogposts/best practices for deploying a common set of 
templates across multiple Django projects.

My initial impulse is to just make a master Github repo of the template and 
pull it into each of the projects. Are there better approaches?

TIA,
John

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59566fdb-8e41-42c9-a121-f0c303b41412%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to deal with not translated strings in html

2015-03-06 Thread Ilya Kazakevich
What is the point of NOT translating "month" to English? 
There are several solutions:

1) Create custom templates / custom tags and include them based on 
language. For example you may have "foo.nl.html" and "foo.en.html" and 
include "foo..html". But I believe using different HTMLs for 
different language is bad practice.
2) Use different styles for different languages. In your nl.css you may set 
"display:none" to "month" span. Different skins (skin is css + images) for 
different languages are ok, it is much better then different HTML.


On Wednesday, March 4, 2015 at 5:53:38 PM UTC+3, Jaap van Wingerde wrote:
>
> Op 2015-03-03T17:41:21 UTC schreef Jaap van Wingerde 
> > in the message  not 
> translated strings in html>, 
> mid:201503031...@jaap.custard.shrl.nl  the following text. 
>
> > ../locale/en/LC_MESSAGES/django.po: 
> > 
> > ... 
> > #: template.html:4 
> > msgid "jaar" 
> > msgstr "year" 
> > 
> > #: templates.html:4 
> > msgid "maand" 
> > msgstr "" 
> > ... 
> > 
> > ../templates/template.html: 
> > 
> > {% load i18n %} > lang="{{ LANGUAGE_CODE }}"> 
> > ... 
> > {% trans "jaar" %}{% trans "maand" %} 
> > ... 
> > 
> > resulting html: 
> > 
> >  > lang="en"> 
> > ... 
> > yearmaand 
> > ... 
> > 
> > better html: 
> > 
> >  > lang="en"> 
> > ... 
> > yearmaand 
> > ... 
> > 
> > How can i get the better html? 
>
> A solution with handwork: 
>   
> #: templates.html:4 
> msgid "maand" 
> msgstr "maand" 
>
> Can this be done automagical? 
>
>
>
> -- 
>
> Jaap van Wingerde 
> e-mail: 12345...@vanwingerde.nl  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/90c090e2-c302-4a4e-b3de-f36577a72e01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fixing a poorly written Django website (no unit tests)

2015-03-06 Thread Ilya Kazakevich
You may start from highest level testing: 
1) create "usage scenarios" for your website. Like "customer opens page 
'foo', and should see 'bar'". You use such scenarios for manual testing, 
right?
2) code such scenarios against Django project. You may use BDD testing 
tools (like lettuce or behave), or do it in pure python. You may call 
Django views and templates directly (using django unittesting support or 
lettuce/harvest), or do it through the browser using Selenium. One scenario 
-- one method. Yes, there is a lot of boilerplate code, but you only need 
to write it once. BDD tools are used to simplify this process by writing 
scenarios on DSL called Gherkin, which is easier. 

This is some kind of "acceptance testing", the one that helps you to be 
sure website works like customer expects it to work. Every project should 
have one, I believe.

After it, you may find that some units of your system are complex and error 
prone. What is unit? Unit is module, function or even package with _clear 
interface_. You then create unit tests against this module. Only units with 
complex logic need to be tested. No need to test simple view that just 
returns render(): this view is tested as part of high level testing. But if 
you have function "calc_user_amount" and complex business logic stands 
behind it, you may create unit test for it.

There are 3 mistakes people do about testing:
1) Testing each function, even private function, even 1 line function. It 
takes a lot of time, and such tests are fragile. You throw'em away after 
simple refactoring.
2) Testing "in the middle of abstraction": I mean testing functions with 
out of clear interface, like private functions. If you need to read 
function code before writing test (pydoc is not enough), you should not 
test this function. Try a higher level of abstraction.
3) Skipping high level testing: even if all your code is covered with 
low-level unit-tests, you still need high level testing like the one with 
Selenium to make sure everything works correctly, and when you refactor 
your code you use such testing to make sure you did not break anything.

So, you start with high level, and then cover _some_ units with unit test, 
if you believe they may contain error.





On Wednesday, March 4, 2015 at 3:03:14 PM UTC+3, Some Developer wrote:
>
> Hi, 
>
> I've been working on a Django website for about 2 months on and off and 
> am nearing the end of development work where I can start thinking about 
> making it look pretty and the after that deploy to production. 
>
> I've been doing lots of manual testing and I'm sure that the website 
> works correctly but due to the need to get the website in production 
> ASAP and my lack of unit testing experience with Django (I'm still not 
> entirely sure what the point of unit testing a 2 or 3 line Django view 
> is when you can clearly see if it is correct or not) I've neglected 
> automated testing. 
>
> While I'm still going to go ahead and launch the site in production as 
> soon as it is deployed I want to go back and add in all the unit tests 
> that are missing. How would you tackle this problem? 
>
> Most of the code is pretty simple but there are ecommerce elements that 
> I have tested extensively by running my code through the Python 
> debugger. These must always work. 
>
> I'm a bit ashamed that it has got this far but I'm mainly a C developer 
> and unit testing isn't pushed quite so hard there (even though it should 
> be). 
>
> Any help appreciated. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/62a7cff3-bb01-42a2-9c7d-d28780033dd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fixing a poorly written Django website (no unit tests)

2015-03-06 Thread Carl Meyer
On 03/06/2015 11:23 AM, Ilya Kazakevich wrote:
> You may start from highest level testing: 
> 1) create "usage scenarios" for your website. Like "customer opens page
> 'foo', and should see 'bar'". You use such scenarios for manual testing,
> right?
> 2) code such scenarios against Django project. You may use BDD testing
> tools (like lettuce or behave), or do it in pure python. You may call
> Django views and templates directly (using django unittesting support or
> lettuce/harvest), or do it through the browser using Selenium. One
> scenario -- one method. Yes, there is a lot of boilerplate code, but you
> only need to write it once. BDD tools are used to simplify this process
> by writing scenarios on DSL called Gherkin, which is easier. 
> 
> This is some kind of "acceptance testing", the one that helps you to be
> sure website works like customer expects it to work. Every project
> should have one, I believe.
> 
> After it, you may find that some units of your system are complex and
> error prone. What is unit? Unit is module, function or even package with
> _clear interface_. You then create unit tests against this module. Only
> units with complex logic need to be tested. No need to test simple view
> that just returns render(): this view is tested as part of high level
> testing. But if you have function "calc_user_amount" and complex
> business logic stands behind it, you may create unit test for it.
> 
> There are 3 mistakes people do about testing:
> 1) Testing each function, even private function, even 1 line function.
> It takes a lot of time, and such tests are fragile. You throw'em away
> after simple refactoring.
> 2) Testing "in the middle of abstraction": I mean testing functions with
> out of clear interface, like private functions. If you need to read
> function code before writing test (pydoc is not enough), you should not
> test this function. Try a higher level of abstraction.
> 3) Skipping high level testing: even if all your code is covered with
> low-level unit-tests, you still need high level testing like the one
> with Selenium to make sure everything works correctly, and when you
> refactor your code you use such testing to make sure you did not break
> anything.
> 
> So, you start with high level, and then cover _some_ units with unit
> test, if you believe they may contain error.

This is really excellent advice.

Carl

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9FA6E.8050001%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Sharing templates across multiple projects

2015-03-06 Thread Simon Charette
Hi John,

I suggest you put the templates you want to share in a location accessible 
by your multiple projects and add this directory to your TEMPLATE_DIRS 
 
setting.

Make sure you have 'django.template.loaders.filesystem.Loader' in your 
TEMPLATE_LOADERS 
 
setting.

You could also make a third-party Django application only containing a 
"templates" directory and install it in all you projects and use the 
'django.template.loaders.app_directories.Loader' loader.

Simon

Le jeudi 5 mars 2015 21:24:04 UTC-5, JHeasly a écrit :
>
> Hello —
>
> I'm looking for any blogposts/best practices for deploying a common set of 
> templates across multiple Django projects.
>
> My initial impulse is to just make a master Github repo of the template 
> and pull it into each of the projects. Are there better approaches?
>
> TIA,
> John
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e9e2eead-b79b-42d2-9e9b-e2507aa942bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sharing templates across multiple projects

2015-03-06 Thread Ilya Kazakevich
I like Simon's ideas about shared location and separate app (Django 
encourages us to use apps to share anything), but you also may share them 
on VCS level. SVN supports "external" checkout, in git you may add one 
repository to another. 

\project1\templates\shared_temps
\project2\templates\shared_temps

"shared_temps" in both cases is just a repository (folder with .git 
subfolder). So, you commit in one folder, push, and pull in all other 
projects.


On Friday, March 6, 2015 at 5:24:04 AM UTC+3, JHeasly wrote:
>
> Hello —
>
> I'm looking for any blogposts/best practices for deploying a common set of 
> templates across multiple Django projects.
>
> My initial impulse is to just make a master Github repo of the template 
> and pull it into each of the projects. Are there better approaches?
>
> TIA,
> John
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9884c3d6-9bc6-4b87-95ef-b4fbbd28f793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Future for Django, Jobs, Confused :/

2015-03-06 Thread Alan Ávalos Hernández
Also, it's important to always understand the core concepts of what you're 
doing. Programming languages and frameworks are tools to get the job done. 
Those come and go. But if you really have a good grasp of the theory behind 
those, only certain details are going to have a relevant role in your decision 
to use certain tools.

People in companies are more interested to see that you understand what you're 
doing and know all these concepts. Unless the position requires you to be a 
language/framework expert.

Give it a try, learn whatever suits you best. And then, try to do another 
development with another language and framework. If you know the core concepts, 
you'll see that this is easier than learn everything from the beginning.

> On Mar 6, 2015, at 9:58 AM, Ilya Kazakevich  wrote:
> 
> You never know what would be popular in next several years. In late 90th Perl 
> was the main web development language. In 2000th it was PHP. Now it is Ruby 
> and Python. If you love Python, use Django but study Ruby/RoR in background. 
> Ruby is not rocket science and you should not have any serious troubles with 
> it if you are advanced Python programmer. Do not lock yourself with ONE 
> language unless you have your own startup that uses this language.
> 
> 
>> On Wednesday, March 4, 2015 at 10:15:32 PM UTC+3, Ismael Ezequiel wrote:
>> I'm confused what "framework" choice for web development, I love Python. as 
>> is the future for Django, I spend a lot time studying Django. I see more 
>> jobs for Ruby on Rails than Django :/
>> 
>> Sorry my english.
>> 
>> Thanks.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/cb35b856-45e7-48e0-a2a2-a452fb04d2ae%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/476B1251-07F3-4BAD-A9EC-E9AF7E65C3E9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread felix

El 06/03/15 11:22, john escribió:
I saws that to in the Doc's - it did not work for me with bootstrap.  
I did not find the cause - if there wasn't some sort of bug.  I'm 
using Django 1.7.5 so I'll guess and say it had something to do with 
the interaction of the two.  I have moved on to crispy-forms and all 
seems to work.  But like I said at the start - in answer to the 
question "Could you provide us more in-deapth of your feeling using 
the django form?"  I found the information provided from the doc's to 
be confusing and did not explain why I had to subclass.  More examples 
are needed (and all in one doc - not link after link after link).  
Maybe what I'm asking for is for the tutorial to better explain the 
use and ways to mod the form code to get things done.


I guess you only need to subclass a widget if you want to change 
appearance and behavior of all instances.
I'm using Django 1.9 and Bootstrap v3.3.1 and I've just tried the 
example using a CharField in a form like this and worked!


class SearchElementForm(forms.Form):
q = forms.CharField(label='Search', max_length=30, 
widget=forms.TextInput(attrs={'size': '40'}))


I wasn't using the size attribute at all but when I tried, it was 
displayed with a different size every time I changed the size.



Felix

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54FA0E05.9010406%40epepm.cupet.cu.
For more options, visit https://groups.google.com/d/optout.


Existing database - new project

2015-03-06 Thread Robert Daniels
I understand it is possible to use an existing database on a new Django 
project. 

As I see it, I have 2 choices.

1 - Use the existing database and deal with it in that fashion.

or

2 - Create a new project to store the same type of data as if there were no 
existing database, Then write a separate export-import script to move the 
data from the existing db to the new structure. 

Wondering if anyone has gone through the "good" and "bad" of each of these. 
I have about 100,000 records in the database, but moving the data across 
should not be that difficult as its a pretty flat model

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/42ee3e9e-3d64-453f-9d6a-53846bec95e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [1.8] MultiHost with template dir per Host

2015-03-06 Thread Collin Anderson
Hi,

You might need to modify the template engine directly.

Collin

On Sunday, March 1, 2015 at 6:31:57 PM UTC-5, Neyoui wrote:
>
> Hi,
>
> I had create a middleware, that is able to change the template directory 
> per host on the fly.
> But it stopped working since I upgraed to Django 1.8 and I tried to fix it.
>
> My problem is:
> If I visit domain1.tld, all works fine. Django loads the templates from 
> the right directory. (/path/domain1.tld/templates/)
> But if I visit now domain2.tld, Django tried to load the template from the 
> domain1.tld directory /path/domain1.tld/templates/ and not from 
> /path/domain2.tld/templates/.
> The debug messages shows me, that the middleware overrides the template 
> path successfully.
>
> Maybe someone can help me to fix it.
>
> Details:
> Django version: 1.8b1
> Python: 3.4
>
> If you need some other information, just ask for it.
>
> - settings.py
>
> MIDDLEWARE_CLASSES = (
> 'core.middleware.MultiHostMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.locale.LocaleMiddleware',
> 'django.middleware.common.CommonMiddleware',
> ...
> )
>
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [],
> 'OPTIONS': {
> 'context_processors': [
> 'django.contrib.auth.context_processors.auth',
> 'django.template.context_processors.debug',
> 'django.template.context_processors.i18n',
> 'django.template.context_processors.media',
> 'django.template.context_processors.static',
> 'django.template.context_processors.tz',
> 'django.contrib.messages.context_processors.messages',
> ],
> 'loaders': [
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> ],
> 'debug': True
> },
> },
> ]
>
>
> ROOT_URLCONF = 'core.urls'
>
> HOST_MIDDLEWARE_TEMPLATE_DIRS = {
>"domain1.tld": BASE_DIR + "/domain1.tld/templates/",
>"domain2.tld": BASE_DIR + "/domain2.tld/templates/",
> }
>
> HOST_MIDDLEWARE_URLCONF_MAP = {
>"domain1.tld": "domain1.urls",
>"domain2.tld": "domain2.urls",
> }
>
>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'core',
> 'domain1',
> 'domain2',
> )
>
>
> - middleware.py
>
> from django.conf import settings
> from django.utils.cache import patch_vary_headers
>
>
> class MultiHostMiddleware:
>
> def get_settings(self, request):
>
> host = request.META["HTTP_HOST"]
> host_port = host.split(':')
>
> if len(host_port) == 2:
> host = host_port[0]
>
> if host in settings.HOST_MIDDLEWARE_URLCONF_MAP:
>
> urlconf = settings.HOST_MIDDLEWARE_URLCONF_MAP[host]
> template_dirs = settings.HOST_MIDDLEWARE_TEMPLATE_DIRS[host],
>
> else:
> urlconf = settings.ROOT_URLCONF
> template_dirs = None
>
> return urlconf, tuple(template_dirs)
>
> def process_request(self, request):
>
> urlconf, template_dirs = self.get_settings(request)
>
> request.urlconf = urlconf
> settings.TEMPLATES[0]['DIRS'] = template_dirs
>
> def process_response(self, request, response):
>
> if getattr(request, "urlconf", None):
> patch_vary_headers(response, ('Host',))
>
> return response
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7bdc0770-2606-42c1-b581-1293cae44344%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django Search page

2015-03-06 Thread Collin Anderson
Hi,

You'll need to use javascript for that.

Collin

On Monday, March 2, 2015 at 2:27:35 AM UTC-5, Sabeen Sha wrote:
>
>  which is the best way to implement the following::
> i will be having a text box and a Add button
>
> Along with a table below it containing headers class 
> AssesmentBuildingDetails(models.Model): 
>
>
>  numbuildingid1 = models.CharField(max_length=14,unique=True) 
>
> numbuildingid2 = models.CharField(max_length=7,primary_key=True) 
>
> previous_year = models.CharField(max_length=4, blank=True) 
>
> previous_year_wardname = models.CharField(max_length=100,blank=True, 
> null=True) 
>
> previous_doorno1 = models.CharField(max_length=4,blank=True, null=True) 
>
> previous_doorno2 = models.CharField(max_length=10,blank=True, null=True) 
>
> current_year = models.CharField(max_length=4, blank=True) 
>
> current_year_wardname = models.CharField(max_length=100,blank=True, 
> null=True) 
>
> current_doorno1 = models.CharField(max_length=10,blank=True, null=True) 
>
> current_doorno2 = models.CharField(max_length=10,blank=True, null=True) 
>
> buildingusage = models.CharField(max_length=500,blank=True, null=True) 
>
> ownernameaddressmal = models.CharField(max_length=500,blank=True, 
> null=True) 
>
> ownernameaddresseng = models.CharField(max_length=500,blank=True, 
> null=True) 
>
> plintaarea = models.DecimalField(max_digits=7, 
> decimal_places=2,blank=True, null=True) 
>
> class Meta: 
>
> db_table = 'assesment_building_details' 
>
>
>  
> my logic is to take the numbuildingid2 as input from the text box and when 
> i press enter either on the text field or click the add button it should 
> search through the database
> and add the details to the table without refreshing the whole page. and 
> the clear the textfield and focus on it.
>  It will give proper error msg if the numbuildingid2 is not found
>
> please help how and which is the best way to implement this... 
>
> thanks
>
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/61e4f0ff-bfd2-45a9-a94d-c80bc0ac5009%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django OperationalError

2015-03-06 Thread Collin Anderson
Hi,

The problem is that django_session doesn't exist in your database. Either 
it was never created or it was created and then later deleted.

Does running manage.py migrate re-create it?

Collin

On Monday, March 2, 2015 at 11:36:51 PM UTC-5, Petar Pilipovic wrote:
>
> Hello James, sorry for not uploading mine answer on this mater, I was busy 
> whit something else this day, ok now back to mine Operational Error I have 
> got.
> I tried to google some solution to this problem had no luck, and I did 
> what have you told me.
> I heave done some 
> python manage.py sqlflush
>
> and that has gave me this output: 
>
> (django17)04:20 ~/mineDjango$ python manage.py sqlflush BEGIN;DELETE FROM 
> "django_admin_log";DELETE FROM "auth_permission";DELETE FROM "auth_group";
> DELETE FROM "auth_group_permissions";DELETE FROM "django_session";DELETE 
> FROM "auth_user_groups";DELETE FROM "auth_user_user_permissions";DELETE 
> FROM "account_emailaddress";DELETE FROM "django_site";DELETE FROM 
> "profiles_profile";DELETE FROM "auth_user";DELETE FROM 
> "profiles_userstripe";DELETE FROM "account_emailconfirmation";DELETE FROM 
> "django_content_type";COMMIT;
>
> Then I have done 
> python manage.py syncdb python manage.py migrate
>
> Output of mine recreating tables are this:
> (django17)04:20 ~/mineDjango$ python manage.py syncdbOperations to 
> perform: Synchronize unmigrated apps: allauth, crispy_forms Apply all 
> migrations: account, sessions, admin, sites, profiles, contenttypes, 
> authSynchronizing 
> apps without migrations: Creating tables... Installing custom SQL... 
> Installing indexes...Running migrations: No migrations to 
> apply.(django17)04:20 
> ~/mineDjango$ python manage.py migrateOperations to perform: Synchronize 
> unmigrated apps: allauth, crispy_forms Apply all migrations: account, 
> sessions, admin, sites, profiles, contenttypes, authSynchronizing apps 
> without migrations: Creating tables... Installing custom SQL... 
> Installing indexes...Running migrations: No migrations to apply.
> Basically I have had no changes in mine attempt to drop and recreate 
> tables in mine application.
> The error is still there.
> Error:
> Environment:
>
>
>
>
> Request Method: GET
> Request URL: http://copser.pythonanywhere.com/
>
>
> Django Version: 1.7.2
> Python Version: 2.7.6
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'profiles',
>  'crispy_forms',
>  'django.contrib.sites',
>  'allauth',
>  'allauth.account',
>  'stripe')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
>
>
> Template error:
> In template /home/copser/static/templates/home.html, error at line 40
>no such table: django_session
>30 :  
>
>
>
>
>31 : {% block content %}
>
>
>
>
>32 :  
>
>
>
>
>33 : 
>
>
>
>
>34 :   
>
>
>
>
>35 : 
>
>
>
>
>36 : 
>
>
>
>
>37 :  {#   src="{% static 'img/07.jpg' %}"/>  #}
>
>
>
>
>38 :
>
>
>
>
>39 : 
>
>
>
>
>40 :  {% if request.user.is_authenticated %} 
>
>
>
>
>41 : Hello {{ request.user }}
>
>
>
>
>42 : {% else %}
>
>
>
>
>43 :   
>
>
>
>
>44 :  value="sczg1f8U4tWQRa8kgNJC1QsSBKAD9Lvw"> {% csrf_token %}
>
>
>
>
>45 :  for="id_login" class="control-label  requiredField">
>
>
>
>
>46 : Login class="asteriskField">* autofocus="autofocus" class="textinput textInput form-control" 
> id="id_login" name="login" placeholder="Username or e-mail" type="text"> 
>  for="id_password" class="control-label  requiredField">
>
>
>
>
>47 : Password class="asteriskField">* class="textinput textInput form-control" id="id_password" name="password" 
> placeholder="Password" type="password">  class="form-group"> for="id_remember" class=""> id="id_remember" name="remember" type="checkbox">
>
>
>
>
>48 : Remember Me
>
>
>
>
>49 : 
>
>
>
>
>50 : 
>
>
>
>
> Traceback:
> File 
> "/home/copser/.virtualenvs/django17/local/lib/python2.7/site-packages/django/core/handlers/base.py"
>  
> in get_response
>   111. response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
> File "/home/copser/mineDjango/profiles/views.py" in home
>   7. return render(request, template, context)
> File 
> "/home/copser/.virtualenvs/django17/local/lib/python2.7/site-packages/djang

Re: what do you think about django FORM system?

2015-03-06 Thread john


On 03/06/2015 12:28 PM, felix wrote:
I'm using Django 1.9 and Bootstrap v3.3.1 

I did know there was a Django 1.9

I tried several ways but whatever I was doing the form field size did 
not change for me.  But I started using crispy-forms and using their 
layout stuff allowed everything I needed.  That said, I could be the 
real issue as I'm not best python programmer and worse with html and 
javascript.


BTW my comment was about how the doc's did not really help me.  I think 
a person can say - that something I did in some of area was the cause of 
the issue and I wouldn't open my mouth.  Yet, when reviewing the doc's I 
got a very different impression of what was available for me to do with 
generic Django forms.



Johnf

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54FA3A9B.6080800%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: Existing database - new project

2015-03-06 Thread john
I'm not sure this is of help but I took was the easy way out.  In my 
models.py for each of my models.Model I added

Class Meta:
 managed = False

That worked for me - the existing database tables were not touched.

Johnf
On 03/06/2015 01:18 PM, Robert Daniels wrote:
I understand it is possible to use an existing database on a new 
Django project.


As I see it, I have 2 choices.

1 - Use the existing database and deal with it in that fashion.

or

2 - Create a new project to store the same type of data as if there 
were no existing database, Then write a separate export-import script 
to move the data from the existing db to the new structure.


Wondering if anyone has gone through the "good" and "bad" of each of 
these. I have about 100,000 records in the database, but moving the 
data across should not be that difficult as its a pretty flat model




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54FA3B50.1010707%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't make ManyToMany form fields hidden

2015-03-06 Thread Collin Anderson
https://code.djangoproject.com/ticket/24453

On Wednesday, March 4, 2015 at 12:40:40 AM UTC-5, Eric Abrahamsen wrote:
>
> Hi, 
>
> I'm making some heavily customized model formsets, to encourage my users 
> to input data. Mostly that involves cutting down the number of huge 
> drop-down menus they have to go surfing through. 
>
> So I have a model like this: 
>
> class Work(models.Model): 
>   authors = models.ManyToManyField(Author,blank=True,related_name="works") 
>
> I first present them with a pre-query form, to choose an Author, then 
> give them a Work modelformset with the "authors" field pre-filled with 
> that author. So the initial data sort of looks like: 
>
> init["authors"] = [pre_query.cleaned_data["authors"]] # must be a list 
>
> for i in range(0, number_of_additional_forms): 
>   initial.append(init) 
>
> formset = WorkFormSet(queryset=Work.objects.none(), initial=initial) 
>
> Nothing unusual there. Now I want to make the "authors" field hidden. 
> This is both to reassure my users, and to reduce the size of the page -- 
> these are really long dropdowns. 
>
> Adding the hidden widget to the "authors" field, however, gives me this 
> validation error: 
>
> (Hidden field authors) Enter a list of values. 
>
> The form input field looks like this: 
>
>  value="[37L]" /> 
>
> Looks like a list of values to me, but maybe it's not getting read that 
> way. 
>
> In the meantime it's not a disaster if the monster "authors" dropdown is 
> visible for each of my Work forms, but it would be really nice to 
> eventually get it hidden. 
>
> In the past I did this by manually *removing* fields from the forms, and 
> adding the values in during the POST/save process, but that always felt 
> bad to me. 
>
> Thanks! 
> Eric 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53c18174-9439-462d-8a8e-34783a065bcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fatal Error in initializing sys standard streams

2015-03-06 Thread Collin Anderson
Hi,

That doesn't look good :)

Maybe try reinstalling python.

Collin

On Wednesday, March 4, 2015 at 11:11:12 AM UTC-5, sriraag paawan wrote:
>
>
> Hello Guys,
>
> I am new to Django.. i am using Django 1.7.4 and Python 3.4
>
> I was about to complete Django tutorial part-5 about tests but a Fatal 
> Error caused me trouble.. I am attaching an image file which contains 
> detail view of my problem... Please anyone could figure it out and solve 
> it..
>
> Thank You in Advance
>
>
> 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eab4c651-8b4c-4840-a5b6-55593f8cd5bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.7 tutorial part 4, url

2015-03-06 Thread Collin Anderson
Hi,

That seems strange. The error says that there's no question with id=1. Are 
you sure there's a question with id=1?

The ending slash seems important to me. I don't know why it would work 
without it.

Collin

On Wednesday, March 4, 2015 at 2:15:32 PM UTC-5, Daniel Altschuler wrote:
>
> I ran into the following problem with the tutorial.
>
> When I'm at http://127.0.0.1:8000/polls/1/, I get the expected page:
>
> What's up? Not much
>  The sky
>
>
> However when I try to vote I get the error 
>
> Page not found (404)Request Method:POSTRequest URL:
> http://127.0.0.1:8000/polls/1/vote/
>
> No Question matches the given query.
>
> You're seeing this error because you have DEBUG = True in your Django 
> settings file. Change that to False, and Django will display a standard 
> 404 page.
>
> After some time I found that something is wrong with the urls. My 
> polls/urls.py file was:
>
> -
> from django.conf.urls import patterns, url
>
> from polls import views
>
> urlpatterns = patterns('',
> # ex: /polls/
> url(r'^$', views.index, name='index'),
> # ex: /polls/5/
> url(r'^(?P\d+)/$', views.detail, name='detail'),
>
> url(r'^(?P\S+)/$', views.search, name='search'),
> # ex: /polls/5/results/
> url(r'^(?P\d+)/results/$', views.results, name='results'),
> # ex: /polls/5/vote/
> url(r'^(?P\d+)/vote/$', views.vote, name='vote'),
> )
> --
>
> If I remove the "/" after "vote", then everything works. I had the same 
> error when attempting to view the results, so I also
> removed the "/" after results. My urls.py now looks like
>
> ...
> # ex: /polls/5/results
> url(r'^(?P\d+)/results$', views.results, name='results'),
> # ex: /polls/5/vote
> url(r'^(?P\d+)/vote$', views.vote, name='vote'),
>...
>
> Can someone explain me what is going on? thanks.
>
> Note that the file mysite/urls.py is:
>
> --
> from django.conf.urls import patterns, url
>
> from polls import views
>
> urlpatterns = patterns('',
> # ex: /polls/
> url(r'^$', views.index, name='index'),
> # ex: /polls/5/
> url(r'^(?P\d+)/$', views.detail, name='detail'),
>
> url(r'^(?P\S+)/$', views.search, name='search'),
> # ex: /polls/5/results
> url(r'^(?P\d+)/results$', views.results, name='results'),
> # ex: /polls/5/vote
> url(r'^(?P\d+)/vote$', views.vote, name='vote'),
> )
> 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/db705c9f-f8a1-46e6-add8-a637671a603e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fatal Error in initializing sys standard streams

2015-03-06 Thread Vijay Khemlani
Your first command (wget ...) failed because wget does not exist on Windows

I think weakrefset is available in pip, why not try to install it that way?

On Fri, Mar 6, 2015 at 9:36 PM, Collin Anderson 
wrote:

> Hi,
>
> That doesn't look good :)
>
> Maybe try reinstalling python.
>
> Collin
>
> On Wednesday, March 4, 2015 at 11:11:12 AM UTC-5, sriraag paawan wrote:
>>
>>
>> Hello Guys,
>>
>> I am new to Django.. i am using Django 1.7.4 and Python 3.4
>>
>> I was about to complete Django tutorial part-5 about tests but a Fatal
>> Error caused me trouble.. I am attaching an image file which contains
>> detail view of my problem... Please anyone could figure it out and solve
>> it..
>>
>> Thank You in Advance
>>
>>
>> 
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/eab4c651-8b4c-4840-a5b6-55593f8cd5bd%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei09p2VCwiJx9A1GT16Sc3-4t%3D%2BkHpB00Na1JnAHQ2Zbag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django(1.7) admin - separate user-profile section

2015-03-06 Thread Collin Anderson
Hi,

If you just add a custom __str__ (or __unicode__ on py2) it might do what 
you want.

def __str__(self):
return str(user)

Otherwise, in UserTokenAdmin, set list_display = ['user']

Collin

On Wednesday, March 4, 2015 at 2:15:32 PM UTC-5, Flemming Hansen wrote:
>
> Hi all,
>
> I need to make a `passwordless` token system, and want to have a "Home › 
> Passwordless › User tokens" in the Admin section. For the "User tokens" 
> `list_display` I need all the "Users". (I do _not_ want to display the 
> token information on the regular "User"-admin as just an extended 
> "profile".) 
>
> Any ideas on how to go about doing this?
>
> So far I have this skeleton in `passwordless/model.py`, but I probably 
> need some magic in `passwordless/admin.py` to list all the users with links 
> to a custom token-manager form with custom widgets (create-token button, 
> delete token button etc)...
>
> from django.db import models
> import jwt
>
> class UserTokens(models.Model):
> class Meta:
> verbose_name = "User tokens"
> verbose_name_plural = "User tokens"
>
> user = models.OneToOneField(User)
>
>
> class TokenBase(models.Model):
> class Meta:
> abstract = True
>
> token = models.CharField(max_length=1000)
> created_ts = models.DateTimeField('Date created')
> expires_ts = models.DateTimeField('Date expired')
>
> def __str__(self):
> return self.user.email
>
>
> class AuthenticateToken(TokenBase):
> manager = models.OneToOneField(UserTokens)
>
> def validate(self, token):
> pass
>
>
> class AuthorizeToken(TokenBase):   
> manager = models.ForeignKey(UserTokens)
> revoked_ts = models.DateTimeField('Date revoked')
>
> def validate(self, token):
> pass  
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/783e5939-eb30-4f5d-ab9c-29002a5523b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Populating Django app db with JSON data

2015-03-06 Thread Collin Anderson
Hi Sandeep,

A snapshot (or at least a diff from the previous one) is stored when you 
run makemigrations.

Collin

On Wednesday, March 4, 2015 at 2:15:41 PM UTC-5, Murthy Sandeep wrote:
>
> Hi 
>
> thanks for the info. 
>
> The docs also say that RunPython runs “custom Python code 
> in a historical context”.  What does that mean exactly?  It seems 
> related to the apps and schema_editor arguments passed to 
> the custom method that will be called by RunPython - is this something 
> like a snapshot of the app model that is stored when I do `python 
> manage.py migrate`? 
>
> Sandeep 
>
>
> > On 2 Mar 2015, at 19:37, aRkadeFR > 
> wrote: 
> > 
> > Hello, 
> > 
> > Indeed, the data migration is the best way. Check out 
> > the documentation here: 
> > 
> https://docs.djangoproject.com/en/1.7/ref/migration-operations/#django.db.migrations.operations.RunPython
>  
> > 
> > You write your function that will be called by the RunPython 
> > and will load your JSON. 
> > Migration are ordered, your first migration will create the 
> > tables and the second (your data migration) will load your 
> > JSON. 
> > 
> > To create an empty migration: 
> > ./manage.py makemigrations  --empty 
> > 
> > You can rename to a useful descriptive name the migration 
> > file. 
> > 
> > Have a good one 
> > 
> > 
> > On 03/02/2015 08:16 AM, Sandeep Murthy wrote: 
> >> Hi 
> >> 
> >> I've tried to get the answer to this question (which is a bit 
> open-ended) on stackoverflow without much success, which 
> >> is basically this: what is the recommended approach to populating a 
> pre-existing Django app database table (generated 
> >> from a model and which is currently empty) with JSON data? 
> >> 
> >> There seem to be several alternatives given in the Django documentation 
> (Django 1.7 manual) which include (1) fixtures, 
> >> (2) SQL scripts, (3) data migrations.  Of these I am a bit confused by 
> the advice in the manual which suggests that (1) 
> >> and (2) are only useful for loading initial data.  That's not what I 
> want to do.  The data that the app needs is going to be 
> >> persistent and permanent because the app is intended to be a web query 
> tool for a large dataset that is currently in the 
> >> form of several JSON files, each containing on average thousands of 
> JSON objects, each object representing an entry 
> >> corresponding to a table entry in a relational db.  The data is not 
> going to be re-loaded or change after entry, and there 
> >> is no user facility for changing the data. 
> >> 
> >> The table has been created using the makemigrations and migrate tools, 
> but is empty.  I just need to populate the 
> >> table with the JSON data.  It seems that I need to write a custom data 
> migration script that will insert the data into the 
> >> table via the interpreter, and then I need to run python manage.py 
> migrate.  Is this the case, and if so, are there 
> >> are examples that I could use? 
> >> 
> >> Thanks in advance for any suggestions. 
> >> 
> >> SM 
> >> -- 
> >> You received this message because you are subscribed to the Google 
> Groups "Django users" group. 
> >> To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com . 
> >> To post to this group, send email to django...@googlegroups.com 
> . 
> >> Visit this group at http://groups.google.com/group/django-users. 
> >> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/db5919c5-ace4-4556-b90e-aa47baa26552%40googlegroups.com.
>  
>
> >> For more options, visit https://groups.google.com/d/optout. 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/54F42164.6040505%40arkade.info.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d78e387b-9232-4a5a-b6d5-1306b5084913%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Rolling back to practice on old bugs

2015-03-06 Thread Collin Anderson
Hi,

I always type: PYTHONPATH=.. ./runtests.py

Collin

On Wednesday, March 4, 2015 at 4:30:54 PM UTC-5, Javis Sullivan wrote:
>
> I am following this tutorial here 
>  "Writing your 
> first Django patch" and while it directs me to rollback to this 
> 39f5bc7fc3a4bb43ed8a1358b17fe0521a1a63ac 
> 
>  commit, 
> when I do so I am not able to run the runtests.py script. I guess the 
> directory structure or something has changed along the way, I assume. As I 
> am getting the error below:
>
> Traceback (most recent call last):
>   File "runtests.py", line 327, in 
> options.failfast, args)
>   File "runtests.py", line 153, django_tests
> state = setup(verbosity, test_labels)
>   File "runtests.py", line 111, in setup
> from django.db.models.loading import get_apps, load_app
> ImportError: No module named 'django.db.models.loading'
>
>
>
> I poked around to see if I could find the loadings module but it is not 
> longer there. Should I just practice on a recent bug? Because runtests.py 
> does fine when the git head is located at the most recent commit. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1c17d272-ab2f-4f46-941d-d936a826ff33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: what do you think about django FORM system?

2015-03-06 Thread younger.shen
Hello everyone:


you may have your own opinions, i read the letters all above , the point of
why i think the form of django is hard to use  is that the form do 2 kinds
of things , first is to build html , secnod is to validate , i never build
html in backend it is not good practice , and i really only need to
validate input nothing else , form did not support easy validate method,
such as when i use django form to validate my form , then i got a error
message , i only want a plain text messge , but use the  as_text() method
then , i found a * in the string ,  i need to slice the string , i thought
what happend to django form , i cant understand the point what the author
thought.

every key to every locked *DREAM* 

2015-03-07 7:39 GMT+08:00 john :

>
> On 03/06/2015 12:28 PM, felix wrote:
>
>> I'm using Django 1.9 and Bootstrap v3.3.1
>>
> I did know there was a Django 1.9
>
> I tried several ways but whatever I was doing the form field size did not
> change for me.  But I started using crispy-forms and using their layout
> stuff allowed everything I needed.  That said, I could be the real issue as
> I'm not best python programmer and worse with html and javascript.
>
> BTW my comment was about how the doc's did not really help me.  I think a
> person can say - that something I did in some of area was the cause of the
> issue and I wouldn't open my mouth.  Yet, when reviewing the doc's I got a
> very different impression of what was available for me to do with generic
> Django forms.
>
>
> Johnf
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/54FA3A9B.6080800%40jfcomputer.com.
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFp8GA%2BUOAhwrYGv_2U%3DkL%2BL-v3MxA5V2D2gAphAXgXJQNpdvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: getting tuples from http request.GET

2015-03-06 Thread Collin Anderson
Hi,

Normally query arguments are separated by &. If you're able to send the 
data like this:

https://mydesktop.com/validator?hostname1=host1.example.com&location1=ca&ip1=2.2.2.2&hostname2=host2.example.com&location2=wa&ip2=3.3.3.3

Then you could do something like:

data = []
i = 0
while True:
i += 1
try:
data.append((request.GET['hostname%s' % i], request.GET['location%s' 
% i], request.GET['ip%s' % i]))
except KeyError:
break

Collin

On Wednesday, March 4, 2015 at 7:57:17 PM UTC-5, Sunil Sawant wrote:

> Hi Guys,
>
> Pretty new to Django, but used it blindly and works wonders. But here is a 
> situation I am blocked at now for a new project
>
> I request.GET the following URL
>
>
> https://mydesktop.com/validator?hostname1=host1.example.com,location1=ca,ip1=2.2.2.2,hostname2=host2.example.com,location2=wa,ip2=3.3.3.3
>
> Am using request.GET I want to get the output in a tuple or hash form as:
>
> [{host1.example.com:[ca,2.2.2.2]},{host2.example.com:[wa,3.3.3.3]}]
>
>
>
> Once I have this data I can process it further.
> Please help
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/438392a2-4d17-4e91-bfe9-27ae17e2a80a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how pass get parameter django bootstrap pagination

2015-03-06 Thread Collin Anderson
Hi,

If you have the request context processor installed, you can do this:

{% bootstrap_paginate object_list range=request.GET.range %}

Collin

On Thursday, March 5, 2015 at 4:35:33 AM UTC-5, SHINTO PETER wrote:
>
>  {% load bootstrap_pagination %}
>   {% bootstrap_paginate object_list range=10 %}
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c135d389-2bac-46b1-8816-287f35fa20cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Admin Page

2015-03-06 Thread Collin Anderson
Hi,

That's odd. Maybe try updating django? It looks like you're using 1.8 
pre-alpha from 3 months ago.

Collin

On Friday, February 20, 2015 at 1:40:03 AM UTC-5, Tim Co wrote:
>
> Hello,
>
> We are trying to run a local development server for our django python app. 
> We are able to connect to our localhost index and get the "It Worked!" 
> Dango page. However when we try to connect to 127.0.0.1/admin/ we are 
> getting an error that the server dropped the connection. Here is the log 
> for the django project:
>
> Exception happened during processing of request from ('130.191.204.231', 
> 62070)
> Traceback (most recent call last):
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/SocketServer.py", line 593, in process_request_thread
> self.finish_request(request, client_address)
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/SocketServer.py", line 334, in finish_request
> self.RequestHandlerClass(request, client_address, self)
>   File "/Library/Python/2.7/site-packages/Django-1.8.
> dev20141212211410-py2.7.egg/django/core/servers/basehttp.py", line 101, 
> in __init__
> super(WSGIRequestHandler, self).__init__(*args, **kwargs)
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/SocketServer.py", line 649, in __init__
> self.handle()
>   File "/Library/Python/2.7/site-packages/Django-1.8.
> dev20141212211410-py2.7.egg/django/core/servers/basehttp.py", line 173, 
> in handle
> handler.run(self.server.get_app())
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/wsgiref/handlers.py", line 92, in run
> self.close()
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/wsgiref/simple_server.py", line 33, in close
> self.status.split(' ',1)[0], self.bytes_sent
> AttributeError: 'NoneType' object has no attribute 'split'
>
> 
> ///
> Our urls.py file
>
> urls.py
>
> from django.conf.urls import include, url
> from django.contrib import admin
>
> admin.autodiscover()
>
> urlpatterns = [
> # Examples:
> # url(r'^$', 'mysite.views.home', name='home'),
> # url(r'^blog/', include('blog.urls')),
> url(r'^admin/', include(admin.site.urls)),
> ]
>
>
> 
> ///
> settings.py
>
>
> # Application definition
>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'trainstar',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> 'django.middleware.security.SecurityMiddleware',
> )
>
> TEMPLATE_CONTEXT_PROCESSORS = (
> "django.contrib.auth.context_processors.auth",
> "django.core.context_processors.debug",
> "django.core.context_processors.i18n",
> "django.core.context_processors.media",
> "django.core.context_processors.static",
> "django.core.context_processors.tz",
> 'django.contrib.messages.context_processors.messages'
> )
>
>
> ROOT_URLCONF = 'mysite.urls'
>
> WSGI_APPLICATION = 'mysite.wsgi.application'
>
>
> Please advise. I've exhausted Google/stackoverflow for possible fixes to 
> of no avail. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e15cb4e6-bf0a-453b-8262-d0a9a5b9312f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django OperationalError

2015-03-06 Thread Petar Pilipovic
Hello Collin,
No the problem is, i have tried to drop mine migrations whit python manage
sqlflush, then I have recreate the db whit
python manage.py migrate.
Here this is the all operation whit python manage sqlflush, syncdb, migrate
. I have notice that there was no migration to apply
at the end, and the error is still there.
Is there something else I can do, or how can I approach this differently.
Best
Petar

On Fri, Mar 6, 2015 at 11:21 PM, Collin Anderson 
wrote:

> Hi,
>
> The problem is that django_session doesn't exist in your database. Either
> it was never created or it was created and then later deleted.
>
> Does running manage.py migrate re-create it?
>
> Collin
>
> On Monday, March 2, 2015 at 11:36:51 PM UTC-5, Petar Pilipovic wrote:
>>
>> Hello James, sorry for not uploading mine answer on this mater, I was
>> busy whit something else this day, ok now back to mine Operational Error I
>> have got.
>> I tried to google some solution to this problem had no luck, and I did
>> what have you told me.
>> I heave done some
>> python manage.py sqlflush
>>
>> and that has gave me this output:
>>
>> (django17)04:20 ~/mineDjango$ python manage.py sqlflush BEGIN;DELETE FROM
>> "django_admin_log";DELETE FROM "auth_permission";DELETE FROM "auth_group"
>> ;DELETE FROM "auth_group_permissions";DELETE FROM "django_session";DELETE
>> FROM "auth_user_groups";DELETE FROM "auth_user_user_permissions";DELETE
>> FROM "account_emailaddress";DELETE FROM "django_site";DELETE FROM
>> "profiles_profile";DELETE FROM "auth_user";DELETE FROM
>> "profiles_userstripe";DELETE FROM "account_emailconfirmation";DELETE FROM
>> "django_content_type";COMMIT;
>>
>> Then I have done
>> python manage.py syncdb python manage.py migrate
>>
>> Output of mine recreating tables are this:
>> (django17)04:20 ~/mineDjango$ python manage.py syncdbOperations to
>> perform: Synchronize unmigrated apps: allauth, crispy_forms Apply all
>> migrations: account, sessions, admin, sites, profiles, contenttypes, 
>> authSynchronizing
>> apps without migrations: Creating tables... Installing custom SQL...
>> Installing indexes...Running migrations: No migrations to
>> apply.(django17)04:20 ~/mineDjango$ python manage.py migrateOperations
>> to perform: Synchronize unmigrated apps: allauth, crispy_forms Apply all
>> migrations: account, sessions, admin, sites, profiles, contenttypes, 
>> authSynchronizing
>> apps without migrations: Creating tables... Installing custom SQL...
>> Installing indexes...Running migrations: No migrations to apply.
>> Basically I have had no changes in mine attempt to drop and recreate
>> tables in mine application.
>> The error is still there.
>> Error:
>> Environment:
>>
>>
>>
>>
>> Request Method: GET
>> Request URL: http://copser.pythonanywhere.com/
>>
>>
>> Django Version: 1.7.2
>> Python Version: 2.7.6
>> Installed Applications:
>> ('django.contrib.admin',
>>  'django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'profiles',
>>  'crispy_forms',
>>  'django.contrib.sites',
>>  'allauth',
>>  'allauth.account',
>>  'stripe')
>> Installed Middleware:
>> ('django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.common.CommonMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware',
>>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>>
>>
>>
>>
>> Template error:
>> In template /home/copser/static/templates/home.html, error at line 40
>>no such table: django_session
>>30 :
>>
>>
>>
>>
>>31 : {% block content %}
>>
>>
>>
>>
>>32 :  
>>
>>
>>
>>
>>33 : 
>>
>>
>>
>>
>>34 :
>>
>>
>>
>>
>>35 : 
>>
>>
>>
>>
>>36 : 
>>
>>
>>
>>
>>37 :  {#  > src="{% static 'img/07.jpg' %}"/>  #}
>>
>>
>>
>>
>>38 :
>>
>>
>>
>>
>>39 : 
>>
>>
>>
>>
>>40 :  {% if request.user.is_authenticated %}
>>
>>
>>
>>
>>41 : Hello {{ request.user }}
>>
>>
>>
>>
>>42 : {% else %}
>>
>>
>>
>>
>>43 :   
>>
>>
>>
>>
>>44 : > value="sczg1f8U4tWQRa8kgNJC1QsSBKAD9Lvw"> {% csrf_token %}
>>
>>
>>
>>
>>45 : > for="id_login" class="control-label  requiredField">
>>
>>
>>
>>
>>46 : Login> class="asteriskField">*> class="controls ">> type="text"> > class="form-group">
>>
>>
>>
>>
>>47 : Password> class="asteriskField">*> class="controls ">> id="id_password" name="password" placeholder="Password" type="password">
>> > class="checkbox">> class="checkboxinput checkbox" id="id_remember" name="remember"
>> type="checkbox">
>>
>>
>>
>>
>>48 : Remember Me
>>
>>
>>
>>
>>49 :   

Re: Can't make ManyToMany form fields hidden

2015-03-06 Thread Eric Abrahamsen
Collin Anderson  writes:

> https://code.djangoproject.com/ticket/24453

For posterity: I should have been using a forms.MultipleHiddenInput
widget for the ManyToManyField, rather than a plain old
forms.HiddenInput.

> On Wednesday, March 4, 2015 at 12:40:40 AM UTC-5, Eric Abrahamsen
> wrote:
>
> Hi, 
>
> I'm making some heavily customized model formsets, to encourage my
> users 
> to input data. Mostly that involves cutting down the number of
> huge 
> drop-down menus they have to go surfing through. 
>
> So I have a model like this: 
>
> class Work(models.Model): 
> authors = models.ManyToManyField
> (Author,blank=True,related_name="works") 
>
> I first present them with a pre-query form, to choose an Author,
> then 
> give them a Work modelformset with the "authors" field pre-filled
> with 
> that author. So the initial data sort of looks like: 
>
> init["authors"] = [pre_query.cleaned_data["authors"]] # must be a
> list 
>
> for i in range(0, number_of_additional_forms): 
> initial.append(init) 
>
> formset = WorkFormSet(queryset=Work.objects.none(),
> initial=initial) 
>
> Nothing unusual there. Now I want to make the "authors" field
> hidden. 
> This is both to reassure my users, and to reduce the size of the
> page -- 
> these are really long dropdowns. 
>
> Adding the hidden widget to the "authors" field, however, gives me
> this 
> validation error: 
>
> (Hidden field authors) Enter a list of values. 
>
> The form input field looks like this: 
>
>  value="[37L]" /> 
>
> Looks like a list of values to me, but maybe it's not getting read
> that 
> way. 
>
> In the meantime it's not a disaster if the monster "authors"
> dropdown is 
> visible for each of my Work forms, but it would be really nice to 
> eventually get it hidden. 
>
> In the past I did this by manually *removing* fields from the
> forms, and 
> adding the values in during the POST/save process, but that always
> felt 
> bad to me. 
>
> Thanks! 
> Eric 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87bnk58js3.fsf%40gmail.com.
For more options, visit https://groups.google.com/d/optout.