Re: We are hiring!

2013-10-15 Thread Sithembewena Lloyd Dube
There's a typo in your company name on your website (in the copyright
message at bottom left) :-)


On Tue, Oct 15, 2013 at 8:11 AM, Team UK  wrote:

> Independent freelance Django developers. 2 years minimum experience
>  required in Django/python, CSS, HTML5, Bootstrap and JS backbone.
>
> Please email your CV.
>
> --
> 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/93d68be5-a3e4-4de7-93b5-162ded47b2da%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Regards,
Sithu Lloyd Dube

-- 
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/CAH-SnCBJ%2BZ4GHu-6U5cyLpFgrD-s5%3DwaO8t9kaKEGZCmooLzJA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: We are hiring!

2013-10-15 Thread Sithembewena Lloyd Dube
Are you only hiring UK developers?


On Tue, Oct 15, 2013 at 8:11 AM, Team UK  wrote:

> Independent freelance Django developers. 2 years minimum experience
>  required in Django/python, CSS, HTML5, Bootstrap and JS backbone.
>
> Please email your CV.
>
> --
> 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/93d68be5-a3e4-4de7-93b5-162ded47b2da%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Regards,
Sithu Lloyd Dube

-- 
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/CAH-SnCCfjafBRDeU1yXO512bxtCxnnTjbU_DPbD6fP1DqHCq4A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-15 Thread Darion Yaphet
the output  exception info as following :

~ ➤ python /usr/bin/django-admin.py startproject hello --traceback

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
line 222, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
line 255, in execute
output = self.handle(*args, **options)
  File
"/usr/lib/python2.7/site-packages/django/core/management/commands/startproject.py",
line 31, in handle
super(Command, self).handle('project', project_name, target, **options)
  File
"/usr/lib/python2.7/site-packages/django/core/management/templates.py",
line 123, in handle
settings.configure()
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 98,
in configure
self._configure_logging()
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 77,
in _configure_logging
logging_config_func(DEFAULT_LOGGING)
  File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py", line
555, in dictConfig
dictConfigClass(config).configure()
  File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py", line
323, in configure
del logging._handlerList[:]
AttributeError: 'module' object has no attribute '_handlerList'

and is  something missing or any package is missing


2013/10/15 Leonardo Giordani 

> Ok, can you please try to traceback the command and post the results?
>
> python django-admin.py startproject hello --traceback
>
>
>
>  Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/15 Darion Yaphet 
>
>>  ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv
>>
>>
>> 2013/10/14 Leonardo Giordani 
>>
>>> Please give me the information I asked you, otherwise I cannot figure
>>> out what kind of problem you have.
>>>
>>> Are you using a virtualenv? In that case, can you post the list of
>>> packages you installed? If not, can you give details about the OS you are
>>> working on?
>>>
>>> Leonardo Giordani
>>> Author of The Digital Cat 
>>> My profile on About.me  - My GitHub
>>> page  - My Coderwall 
>>> profile
>>>
>>>
>>> 2013/10/14 Darion Yaphet 
>>>
  Python  2.7.3 and Django is 1.5.3 ..


 2013/10/14 Leonardo Giordani 

> Hi, are you using a virtualenv? In that case, can you post the list of
> packages you installed? If not, can you give details about the OS you are
> working on, Django version, and so on?
>
> Regards,
>
> Leo
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/14 Darion Yaphet 
>
>> Hi all :
>>
>> when I use django-admin.py to init django project
>> django-admin.py  startproject hello
>>
>> Got a exception ..
>>  AttributeError: 'module' object has no attribute '_handlerList'
>>
>> what is it 
>>
>> --
>> 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/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> 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/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



 --




 long is the way and hard  that out of Hell leads up to light

  --
 You received this message because you are subscribed to the Google
 Groups "Django users" group

Re: New to Django cannot figure URLpatterns

2013-10-15 Thread Tom Evans
On Mon, Oct 14, 2013 at 11:58 PM, Mark Strickland
 wrote:
>
> I am new to using Django and I can get one urls to work, but I cannot get 
> another.  I am running Django 1.5
>
> This url works.
>
> url(r'^$', views.index, name='index'),
>
>
> But if I try to follow this one.
>
>  url(r'^(?P\D+)/$', views.detail, name='detail'),
>
>
> I get the following error.when I try http://127.0.0.1:8000/plugin/title where 
> title is a unique key in the database.
>
> Page not found (404)

Your regular expression is bogus. Presumably (given the error messages
I've chopped) that URL is in a urlconf that has a prefix of
"/plugin/", so ignore what Tom Lockhart said about that.

Your regexp is:

r'^(?P\D+)/$'

This says "From the beginning of the string, capture a grouping of 1
or more characters from the class '\D' as the parameter 'pluginTitle',
followed by a '/' character, followed by the end of the string.

The main problem is that there is no such character class '\D'. There
is '\d', it means the digits 0-9, but you are trying to match the word
'title'. Work out what are valid characters for your title and write
the regular expression accordingly.

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/CAFHbX1KAh%3DCyc_DApJ48R-Yvsx-grCrQY%2BYQ53Caxt4Krf%3DxmA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Defining new project as a service at nignx

2013-10-15 Thread Muhammed TÜFEKYAPAN
Hello everyone,

Yes I know that but now my problem is our new project doesn't seen on 
services list and so I can't start it.

I use gunicorn.

How can I made it?

On Monday, October 14, 2013 10:03:22 PM UTC+3, Javier Guerra wrote:
>
> On Mon, Oct 14, 2013 at 12:17 PM, Muhammed TÜFEKYAPAN 
> > wrote: 
> > I use digitalocean as a server. I upload my django project files on my 
> > server and start to setup. Made postgresql settings etc but I can't 
> define 
> > my new project as a new service on nginx. How can I define my new 
> projest as 
> > a service and make possible to start it as "service blabla start". 
> > 
> > When I type "service --statıs-all" I can't see my new project now. 
>
>
> i think you're mixing two things and missing a third. 
>
> 1: AFAIK, nginx doesn't have "services", just serves requests via some 
> methods, either static files, internal plugins or backend servers. 
>
> 2: on most linux distros, the 'service' command manages startup 
> scripts; with start/stop commands to run daemons. 
>
> 3: nginx doesn't run python applications, you have to run them in an 
> app server.  for Django, (and most python frameworks), the best option 
> is a wsgi server.  One that runs really well with nginx is uWSGI. 
> another option is to run gunicorn as an HTTP backend server behind 
> nginx. 
>
>
> so, which is your deployment strategy? 
> (https://docs.djangoproject.com/en/1.6/howto/deployment/) 
>
>
> -- 
> Javier 
>

-- 
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/ef9db670-7a3a-4b84-837a-c9e401840452%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-15 Thread Leonardo Giordani
As I suspected, there is a problem with the logging module, which is
probably shadowed, i.e. when Django performs "import logging" it imports a
different module.
Try the following: exactly where you execute the manage.py open an
interactive Python shell and do

>>> import logging
>>> print logging.__file__

This should hopefully show us what logging is working behind the scenes.
Try and post the results

Leo


Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/15 Darion Yaphet 

> the output  exception info as following :
>
> ~ ➤ python /usr/bin/django-admin.py startproject hello --traceback
>
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
> line 222, in run_from_argv
> self.execute(*args, **options.__dict__)
>File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
> line 255, in execute
> output = self.handle(*args, **options)
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/commands/startproject.py",
> line 31, in handle
> super(Command, self).handle('project', project_name, target, **options)
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/templates.py",
> line 123, in handle
> settings.configure()
>   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line
> 98, in configure
> self._configure_logging()
>   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line
> 77, in _configure_logging
> logging_config_func(DEFAULT_LOGGING)
>   File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py", line
> 555, in dictConfig
> dictConfigClass(config).configure()
>   File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py", line
> 323, in configure
> del logging._handlerList[:]
> AttributeError: 'module' object has no attribute '_handlerList'
>
> and is  something missing or any package is missing
>
>
> 2013/10/15 Leonardo Giordani 
>
>> Ok, can you please try to traceback the command and post the results?
>>
>> python django-admin.py startproject hello --traceback
>>
>>
>>
>>  Leonardo Giordani
>> Author of The Digital Cat 
>> My profile on About.me  - My GitHub
>> page  - My Coderwall 
>> profile
>>
>>
>> 2013/10/15 Darion Yaphet 
>>
>>>  ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv
>>>
>>>
>>> 2013/10/14 Leonardo Giordani 
>>>
 Please give me the information I asked you, otherwise I cannot figure
 out what kind of problem you have.

 Are you using a virtualenv? In that case, can you post the list of
 packages you installed? If not, can you give details about the OS you are
 working on?

 Leonardo Giordani
 Author of The Digital Cat 
 My profile on About.me  - My GitHub
 page  - My Coderwall 
 profile


 2013/10/14 Darion Yaphet 

>  Python  2.7.3 and Django is 1.5.3 ..
>
>
> 2013/10/14 Leonardo Giordani 
>
>> Hi, are you using a virtualenv? In that case, can you post the list
>> of packages you installed? If not, can you give details about the OS you
>> are working on, Django version, and so on?
>>
>> Regards,
>>
>> Leo
>>
>> Leonardo Giordani
>> Author of The Digital Cat 
>> My profile on About.me  - My GitHub
>> page  - My Coderwall 
>> profile
>>
>>
>> 2013/10/14 Darion Yaphet 
>>
>>> Hi all :
>>>
>>> when I use django-admin.py to init django project
>>> django-admin.py  startproject hello
>>>
>>> Got a exception ..
>>>  AttributeError: 'module' object has no attribute '_handlerList'
>>>
>>> what is it 
>>>
>>> --
>>> 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/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> You received this message because you are subs

Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-15 Thread Darion Yaphet
Great !!!
It's the point  and now successful

helloworld ➤ tree

.
|-- helloworld
|   |-- __init__.py
|   |-- __init__.pyc
|   |-- settings.py
|   |-- settings.pyc
|   |-- urls.py
|   `-- wsgi.py
`-- manage.py

1 directory, 7 files

thanks a lot


2013/10/15 Leonardo Giordani 

> As I suspected, there is a problem with the logging module, which is
> probably shadowed, i.e. when Django performs "import logging" it imports a
> different module.
> Try the following: exactly where you execute the manage.py open an
> interactive Python shell and do
>
> >>> import logging
> >>> print logging.__file__
>
> This should hopefully show us what logging is working behind the scenes.
> Try and post the results
>
> Leo
>
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/15 Darion Yaphet 
>
>>  the output  exception info as following :
>>
>> ~ ➤ python /usr/bin/django-admin.py startproject hello --traceback
>>
>> Traceback (most recent call last):
>>   File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
>> line 222, in run_from_argv
>> self.execute(*args, **options.__dict__)
>>File
>> "/usr/lib/python2.7/site-packages/django/core/management/base.py", line
>> 255, in execute
>> output = self.handle(*args, **options)
>>   File
>> "/usr/lib/python2.7/site-packages/django/core/management/commands/startproject.py",
>> line 31, in handle
>> super(Command, self).handle('project', project_name, target,
>> **options)
>>   File
>> "/usr/lib/python2.7/site-packages/django/core/management/templates.py",
>> line 123, in handle
>> settings.configure()
>>   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line
>> 98, in configure
>> self._configure_logging()
>>   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line
>> 77, in _configure_logging
>> logging_config_func(DEFAULT_LOGGING)
>>   File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py",
>> line 555, in dictConfig
>> dictConfigClass(config).configure()
>>   File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py",
>> line 323, in configure
>> del logging._handlerList[:]
>> AttributeError: 'module' object has no attribute '_handlerList'
>>
>> and is  something missing or any package is missing
>>
>>
>> 2013/10/15 Leonardo Giordani 
>>
>>>  Ok, can you please try to traceback the command and post the results?
>>>
>>> python django-admin.py startproject hello --traceback
>>>
>>>
>>>
>>>  Leonardo Giordani
>>> Author of The Digital Cat 
>>> My profile on About.me  - My GitHub
>>> page  - My Coderwall 
>>> profile
>>>
>>>
>>> 2013/10/15 Darion Yaphet 
>>>
  ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv


 2013/10/14 Leonardo Giordani 

> Please give me the information I asked you, otherwise I cannot figure
> out what kind of problem you have.
>
> Are you using a virtualenv? In that case, can you post the list of
> packages you installed? If not, can you give details about the OS you are
> working on?
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/14 Darion Yaphet 
>
>>  Python  2.7.3 and Django is 1.5.3 ..
>>
>>
>> 2013/10/14 Leonardo Giordani 
>>
>>> Hi, are you using a virtualenv? In that case, can you post the list
>>> of packages you installed? If not, can you give details about the OS you
>>> are working on, Django version, and so on?
>>>
>>> Regards,
>>>
>>> Leo
>>>
>>> Leonardo Giordani
>>> Author of The Digital Cat 
>>> My profile on About.me  - My GitHub
>>> page  - My Coderwall 
>>> profile
>>>
>>>
>>> 2013/10/14 Darion Yaphet 
>>>
 Hi all :

 when I use django-admin.py to init django project
 django-admin.py  startproject hello

 Got a exception ..
  AttributeError: 'module' object has no attribute '_handlerList'

 what is it 

 --
 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, 

Re: def altword_list(self, request, word_id):

2013-10-15 Thread Pepsodent Cola
Hi Leo,

get_query() function in class AltwordlistView which I refer to as
*Filter-5*didn't give me the ordered list result that I wanted.  So
somebody on
#django IRC helped me to fix that problem by giving me
*altword_list()*function which I refer to as
*Filter-8*.
You can basically ignore all the other Filter codes but I left it there in
case it might help you see what I'm trying to do.

My main focus right now is to connect the Filter-8 code to my template *
altword_list.html* but I don't know how to do it.

*urls.py*
http://dpaste.com/1417526/

*views*
http://dpaste.com/1417533/

*altword_list.html*
http://dpaste.com/1417534/





* urls.py

from django.conf.urls import patterns, urlfrom navi_polls import
views#___
urlpatterns = patterns('',
# ex: /polls/
url(r'^$', views.IndexView.as_view(), name='index'),
# ex: /polls/5/
url(r'^specifics/(?P\d+)/$', views.DetailView.as_view(), name='detail'),
# ex: /polls/5/results/
url(r'^(?P\d+)/results/$', views.ResultsView.as_view(), name='results'),
# ex: /polls/5/vote/
url(r'^(?P\d+)/vote/$', views.vote, name='vote'),

# ex: /polls/5/
url(r'^altword_list/(?P\d+)/$',
views.AltwordlistView.as_view(), name='altword_list'),)




* views.py

from django.http import HttpResponseRedirectfrom django.shortcuts
import render, get_object_or_404from django.core.urlresolvers import
reversefrom django.views import genericfrom django.utils import
timezone
from navi_polls.models import Word,
Altword#___
class IndexView(generic.ListView):
template_name = 'navi_polls/index.html'
context_object_name = 'latest_poll_list'

def get_queryset(self):# Filter 1
"""Return the last five published polls(not
including those set to be published in the future)."""
return Word.objects.filter(pub_date__lte=timezone.now()
).order_by('-pub_date')[:5]

#"""
#Return the last five published polls
#(including those set to be published in the future).
#"""
#return Word.objects.order_by('-pub_date')[:5]


def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)# Filter 2
filter_2 = Word.objects.filter(direct_transl_word='')# Filter 4
filter_4 = Altword.objects.filter(rosword__direct_transl_word='')

context.update({
"filter_2": filter_2,
"filter_4": filter_4
})
return 
context#___

#___
class AltwordlistView(generic.DetailView):
#model = Word
model = Altword
template_name = 'navi_polls/altword_list.html'
context_object_name = 'poll'

def get_queryset(self):
#"""
#Excludes any polls that aren't published yet.
#"""
#return Word.objects.filter(pub_date__lte=timezone.now())# Filter 5
#return Word.objects.filter(direct_transl_word='')
#return Word.objects.filter(direct_transl_word='').order_by('-votes')

return 
Word.objects.filter(direct_transl_word='').order_by('-altword_rosword__votes')

#return Altword.objects.filter(rosword__direct_transl_word='')
#return Altword.objects.filter(word__direct_transl_word='')


def get_context_data(self, **kwargs):
context = super(AltwordlistView,
self).get_context_data(**kwargs)# Filter 4b
filter_4b =
Altword.objects.filter(rosword__direct_transl_word='').order_by('-votes')#
Filter 7
filter_7 = Altword.objects.vote_order()# Filter 8b#
filter_8b = Altword.objects.filter(word__pk=word_id).order_by('-votes')


context.update({
"filter_4b": filter_4b,
"filter_7": filter_7
 #   "filter_8b": filter_8b
})
return context

# Filter 8
def altword_list(self, request, word_id):
#object_list =
AltWord.objects.filter(word__pk=word_id).order_by('-votes')
object_list =
Altword.objects.filter(word__pk=word_id).order_by('-votes')

return render(request, 'navi_polls/altword_list.html', {
'poll_list': object_list,
})



* altword_list.html

{{ poll.rosword }} - id:{{ poll.id }}

{% if poll_list %}

{% for row in poll_list %}
( id:{{ row.id }} ) - {{ row.rosword }}
{% endfor %}
{% else %}
No list is available.{% endif %}

Filter 8
Altword_idRoswordAlt ros
wordAlt transl
wordArticulateVotes

{% for choice in poll_list %}
{{ choice.id }}
{{ choice.rosword }}
{{ choice.alt_ros_word }}
{{ choice.alt_transl_word }}
{{ choice.articulate }}
{{ choice.votes }}{% endfor %}


Filter 5
Altword_idRoswordAlt ros
wordAlt transl
wordArticulateVotes
{% for choice in
poll.altword

django cron job - stops after reading some portion of huge file - why is this?

2013-10-15 Thread doniyor
I am reading file from url and parsing it and saving some information out 
of this file into db - using cron job. 

i am testing now in my local dev. 

the problem is: job is reading file and saving into db without any problem 
but after some time, since file is very huge approx. >8GB, job doesnot do 
anything and freezes, without giving any error, 

i am using django 1.4, python 2.7 and postgresql. is there any limit for 
writing into db? why is it freezing? 


-- 
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/b567f273-508b-4f14-9d40-197af8c8a079%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to build a social network

2013-10-15 Thread Kumar Anirudha
Hii,

I've been developing websites on html, php, javascript for quite some now.. 
I've been coding on python and made small Django apps too like a blog. I 
want to know how and what else is needed for a social networking site.

On Thursday, 21 April 2011 04:53:37 UTC+5:30, Rodrigo Ruiz wrote:
>
> Hi, I'm a new programmer and I want to make a social network like 
> facebook or orkut. 
>
> I only know the basics of C and a bit of Objective-C (OOP). I know 
> nothing about web programming. 
>
> My question is, where should I start learning how to make my social 
> network with python (django)? Any particular book? opencoursewares? 
> Tutorials? 
>
> I've searched google for that information but I found nothing, no 
> books on social network in amazon, no tutoriais teaching what I need, 
> only found an opencourseware about python from MIT but it doesn't 
> explain how to make a social network. 
>
> I only found something about pinax, didn't really understand what that 
> is and couldn't find any tutorias/books as well about social network 
> with pinax. 
>
> Thank you for your time, 
> Rodrigo

-- 
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/4237edee-54f7-4e15-8368-0f89e7fec167%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


New to Django

2013-10-15 Thread Mahantesh U
Hi All,

  I am new to Django framework. I worked on Flask framework using python. 
Please share the sites to learn Django easily.

Thanks
Mahantesh

-- 
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/78b41661-9ac0-4433-bb16-fd8ea7b8ccd2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New to Django

2013-10-15 Thread Sithembewena Lloyd Dube
Hi,

Do the tutorial on the official Django website - it will show you where
else to look when you are done :)


On Tue, Oct 15, 2013 at 7:55 AM, Mahantesh U wrote:

> Hi All,
>
>   I am new to Django framework. I worked on Flask framework using python.
> Please share the sites to learn Django easily.
>
> Thanks
> Mahantesh
>
> --
> 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/78b41661-9ac0-4433-bb16-fd8ea7b8ccd2%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Regards,
Sithu Lloyd Dube

-- 
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/CAH-SnCD9U4wfNO94KeJn6xkbiNKH3wmnc9zOp5S8Ry%2B0QddQHw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django data to Javascript

2013-10-15 Thread drakko
Hello!

I'm new to Django and Javascript and so I need some help with passing list 
from django template to Javascript.

The list is available in template (template.html) by using 

{% for shbf in should_have_found_list %}


but I have no idea how to access this list from Javascript.

The should_have_found_list is created in context.py file like:

should_have_found_list = ShouldHaveFound.objects.filter(enabled=1)


and passed to template in view.py as a part of dictionary:

return render_to_response(template_name, RequestContext(request, {
>
> 'form': form,
>
> 'fields': simplejson.dumps(form.field_mapping),
>
> }))
>
>
I would appreciate some guidance :)

Thank You,
Drakko

-- 
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/91594aa1-d770-43d8-82b9-e638669a8204%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Multiple django web applications

2013-10-15 Thread drakko
Hello

Thanks for insight guys
Yes I'm using mod_wsgi.

Drakko

piektdiena, 2013. gada 27. septembris 15:21:54 UTC+2, Ben Lopatin rakstīja:
>
> drakko, using virtualenv will certainly help in isolating your projects 
> and dependencies. You can host both on the same server, how you go about 
> doing this will depend in part on your setup. If you're using Apache with 
> mod_wsgi I think - if memory serves correctly - that you could just use 
> different vhosts. Using gunicorn just run each Django app on a different 
> port.
>
> Ben
>
> On Friday, September 27, 2013 4:54:44 AM UTC-4, drakko wrote:
>>
>> Hello django gurus!
>>
>> I wanted to kindly ask if there is a way how to keep two django web 
>> application on the same server?
>> I have heard that it might be possible by using virtualenv. But as I'm 
>> new to python and web development I wanted to find out if what kind of 
>> approaches there are to achieve this goal.
>>
>> Thank You!!
>>
>> drakko 
>>
>

-- 
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/e0a8ae9c-1557-4b85-b13e-1d1768e249b4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New to Django cannot figure URLpatterns

2013-10-15 Thread Bill Freeman
Actually, there is a character class \D; it matches any NON-digit.  As such
this should match title, as long as it contains non digits.

But looking at this line from the error message:

  8. ^plugin/ ^(?P\d+)/$ [name='detail']

It appears that you are actually using the little \d, contrary to the url
pattern that you quoted.  That would only match titles that were composed
entirely of digits.

Be sure which one is there.

You may actually want \w, or even [^/].

Bill


On Tue, Oct 15, 2013 at 4:38 AM, Tom Evans  wrote:

> On Mon, Oct 14, 2013 at 11:58 PM, Mark Strickland
>  wrote:
> >
> > I am new to using Django and I can get one urls to work, but I cannot
> get another.  I am running Django 1.5
> >
> > This url works.
> >
> > url(r'^$', views.index, name='index'),
> >
> >
> > But if I try to follow this one.
> >
> >  url(r'^(?P\D+)/$', views.detail, name='detail'),
> >
> >
> > I get the following error.when I try 
> > http://127.0.0.1:8000/plugin/titlewhere title is a unique key in the 
> > database.
> >
> > Page not found (404)
>
> Your regular expression is bogus. Presumably (given the error messages
> I've chopped) that URL is in a urlconf that has a prefix of
> "/plugin/", so ignore what Tom Lockhart said about that.
>
> Your regexp is:
>
> r'^(?P\D+)/$'
>
> This says "From the beginning of the string, capture a grouping of 1
> or more characters from the class '\D' as the parameter 'pluginTitle',
> followed by a '/' character, followed by the end of the string.
>
> The main problem is that there is no such character class '\D'. There
> is '\d', it means the digits 0-9, but you are trying to match the word
> 'title'. Work out what are valid characters for your title and write
> the regular expression accordingly.
>
> 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/CAFHbX1KAh%3DCyc_DApJ48R-Yvsx-grCrQY%2BYQ53Caxt4Krf%3DxmA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAB%2BAj0vfQ1qSB7vDTFaZY%3D6PtSOeTfEdp057fvTqULrVnDh_SA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django cron job - stops after reading some portion of huge file - why is this?

2013-10-15 Thread Bill Freeman
One possibility is that your code keeps all that is read (or something
derived from it) in memory, and you are running out.

E.g.; Is your database code trying to do all this in a single transaction?

Another possibility is that something in the file at that spot triggers a
but in your code that contains an infinite loop.

There are other possibilities.  But there's no diagnosing it with the
information you've given.

Can you, in python, read through the file, doing nothing with the data?
E.g.:

f = open('your/file/path/here')
n = 0
s = True
while s:
s = f.read(1024*1024)
n += len(s)
print n
print 'done'

That should work.  If not, does your O/S not correctly handle files that
big?

Bill


On Tue, Oct 15, 2013 at 6:55 AM, doniyor  wrote:

> I am reading file from url and parsing it and saving some information out
> of this file into db - using cron job.
>
> i am testing now in my local dev.
>
> the problem is: job is reading file and saving into db without any problem
> but after some time, since file is very huge approx. >8GB, job doesnot do
> anything and freezes, without giving any error,
>
> i am using django 1.4, python 2.7 and postgresql. is there any limit for
> writing into db? why is it freezing?
>
>
>  --
> 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/b567f273-508b-4f14-9d40-197af8c8a079%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAB%2BAj0u8Z8fRDJEhMmZkX8EnZaEz-%3Dwpw4Qk5FyFsSWeAQ70yg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: readonly_fields depending on request

2013-10-15 Thread Roberto López López

Hi Timothy, thanks for your advice.

I'm sorry, I've been quite busy lately on other stuff so I had to leave
this apart. You are right, maybe I am overcomplicating things. I have
simplified my code to:

def get_readonly_fields(self, request, obj=None):
if not request.user.groups.filter(name__exact='administration'):
return ('is_featured', )
return ()

That should make the "featured" checkbox read only for those users not
in the administration group. But it doesn't, when the flow reaches the
line /return ('is_featured', )/, the user can check/uncheck the box in
the admin interface. Do you see any flaw here? Thanks again!

Roberto






On 10/10/2013 04:52 PM, Timothy W. Cook wrote:
> On Thu, Oct 10, 2013 at 10:04 AM, Roberto López López
> mailto:roberto.lo...@uni.no>> wrote:
>
> This is, for example, my code overriding get_readonly_fields():
>
> def get_readonly_fields(self, request, obj=None):
> readonly = super(NewsAdmin,
> self).get_readonly_fields(request, obj)
> if request.user.groups.filter(name__exact='administration') or
> request.user.is_superuser:
> return readonly
> else:
> import itertools
> return itertools.chain(readonly, ('is_featured',))
>
>
>
> I do not understand your logic as it compares to your description of
> the problem. 
>
> For your described problem:
> If the user is_superuser then you shouldn't set read_only at all.
>
> If a user is in a specific set of users then set read_only= ['field1',
> 'field2',] as appropriate. 
>
> It is a pretty simple problem it looks like you are making it far too
> complex. 
>
>
>
>
>  
>
>
>
>  
>
>
> On 10/10/2013 02:45 PM, Roberto López López wrote:
> > Hi,
> >
> > In my project I make use of django-admin. I need to have different
> > readonly_fields depending on the user is connected, thus
> administrators
> > will be able to modify all fields, and other users less fields.
> Which
> > method do I have to override? I have already tried
> > ModelAdmin.get_readonly_fields() and ModelAdmin.get_form(). But
> no success.
> >
> > Any other suggestions?
> >
> > Thanks!
> >
> > Roberto
> >
> >
>
>
> --
>
> Roberto López López
> System Developer
> Parallab, Uni Computing
> +47 55584091
>
> --
> 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/5256A5E2.9020505%40uni.no.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> -- 
> MLHIM VIP Signup: http://goo.gl/22B0U
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> -- 
> 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/CA%2B%3DOU3U69QzDSbc0qyJ_zbgA3BYHCi5zK3%3DaAra-saAq%2Bvj3EA%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.


-- 

Roberto López López
System Developer
Parallab, Uni Computing
+47 55584091

-- 
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/525D4806.7090509%40uni.no.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New to Django

2013-10-15 Thread Mahantesh U
Thanks a lot Lloyd Dube  :)

On Tuesday, October 15, 2013 5:38:33 PM UTC+5:30, Lloyd Dube wrote:
>
> Hi,
>
> Do the tutorial on the official Django website - it will show you where 
> else to look when you are done :)
>
>
> On Tue, Oct 15, 2013 at 7:55 AM, Mahantesh U 
> 
> > wrote:
>
>> Hi All,
>>
>>   I am new to Django framework. I worked on Flask framework using python. 
>> Please share the sites to learn Django easily.
>>
>> Thanks
>> Mahantesh
>>
>> -- 
>> 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/78b41661-9ac0-4433-bb16-fd8ea7b8ccd2%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> Regards,
> Sithu Lloyd Dube 
>

-- 
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/ceaab487-fd63-4fc0-bfb1-b37b765fa577%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django cron job - stops after reading some portion of huge file - why is this?

2013-10-15 Thread doniyor
yes, db code is doin all these calls in single transaction, i mean, i am 
not using transactions, may be this is the reason? 

this is my cron code: http://pastebin.com/Lrym1z8E i know, very ugly code, 
it is saving at least some objects into db

this is url where i am reading my xml file from: 
http://www.bookatable.com/feed.aspx?channel=524&secret=10F70A84-76D7-C56C-2350-779A1A849819&language=de-DE&type=restaurants

also i noticed now that in db, there are objects whose some fields are not 
fully filled out even if the xml file does have those information. it 
means, this is a transaction issue, right? 

could you please take a look at the code? would transaction solve this 
issue? 

On Tuesday, October 15, 2013 3:40:42 PM UTC+2, ke1g wrote:
>
> One possibility is that your code keeps all that is read (or something 
> derived from it) in memory, and you are running out.
>
> E.g.; Is your database code trying to do all this in a single transaction?
>
> Another possibility is that something in the file at that spot triggers a 
> but in your code that contains an infinite loop.
>
> There are other possibilities.  But there's no diagnosing it with the 
> information you've given.
>
> Can you, in python, read through the file, doing nothing with the data?  
> E.g.:
>
> f = open('your/file/path/here')
> n = 0
> s = True
> while s:
> s = f.read(1024*1024)
> n += len(s)
> print n
> print 'done'
>
> That should work.  If not, does your O/S not correctly handle files that 
> big?
>
> Bill
>
>
> On Tue, Oct 15, 2013 at 6:55 AM, doniyor 
> > wrote:
>
>> I am reading file from url and parsing it and saving some information out 
>> of this file into db - using cron job. 
>>
>> i am testing now in my local dev. 
>>
>> the problem is: job is reading file and saving into db without any 
>> problem but after some time, since file is very huge approx. >8GB, job 
>> doesnot do anything and freezes, without giving any error, 
>>
>> i am using django 1.4, python 2.7 and postgresql. is there any limit for 
>> writing into db? why is it freezing? 
>>
>>
>>  -- 
>> 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/b567f273-508b-4f14-9d40-197af8c8a079%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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/b61fec61-7481-4113-ab8c-31b7143df3f5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New to Django

2013-10-15 Thread Sithembewena Lloyd Dube
You're welcome, Mahantesh :) Did you find the tutorial I mentioned?


On Tue, Oct 15, 2013 at 3:56 PM, Mahantesh U wrote:

> Thanks a lot Lloyd Dube  :)
>
>
> On Tuesday, October 15, 2013 5:38:33 PM UTC+5:30, Lloyd Dube wrote:
>
>> Hi,
>>
>> Do the tutorial on the official Django website - it will show you where
>> else to look when you are done :)
>>
>>
>> On Tue, Oct 15, 2013 at 7:55 AM, Mahantesh U wrote:
>>
>>> Hi All,
>>>
>>>   I am new to Django framework. I worked on Flask framework using
>>> python. Please share the sites to learn Django easily.
>>>
>>> Thanks
>>> Mahantesh
>>>
>>> --
>>> 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/78b41661-**9ac0-4433-bb16-fd8ea7b8ccd2%**
>>> 40googlegroups.com
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>
>>
>>
>> --
>> Regards,
>> Sithu Lloyd Dube
>>
>  --
> 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/ceaab487-fd63-4fc0-bfb1-b37b765fa577%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Regards,
Sithu Lloyd Dube

-- 
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/CAH-SnCB_7aHO2szLDa_w7gbQnAxSjHQNSXECUT3fRkoBPHkh6g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New to Django

2013-10-15 Thread Mahantesh U
yeah ...
https://docs.djangoproject.com/en/1.5/intro/tutorial01/

And also wanted know how can I set-up mysql with django?

On Tuesday, October 15, 2013 7:31:15 PM UTC+5:30, Lloyd Dube wrote:
>
> You're welcome, Mahantesh :) Did you find the tutorial I mentioned?
>
>
> On Tue, Oct 15, 2013 at 3:56 PM, Mahantesh U 
> 
> > wrote:
>
>> Thanks a lot Lloyd Dube  :)
>>
>>
>> On Tuesday, October 15, 2013 5:38:33 PM UTC+5:30, Lloyd Dube wrote:
>>
>>> Hi,
>>>
>>> Do the tutorial on the official Django website - it will show you where 
>>> else to look when you are done :)
>>>
>>>
>>> On Tue, Oct 15, 2013 at 7:55 AM, Mahantesh U wrote:
>>>
 Hi All,

   I am new to Django framework. I worked on Flask framework using 
 python. Please share the sites to learn Django easily.

 Thanks
 Mahantesh

 -- 
 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/78b41661-**9ac0-4433-bb16-fd8ea7b8ccd2%**
 40googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .

>>>
>>>
>>>
>>> -- 
>>> Regards,
>>> Sithu Lloyd Dube 
>>>
>>  -- 
>> 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/ceaab487-fd63-4fc0-bfb1-b37b765fa577%40googlegroups.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> Regards,
> Sithu Lloyd Dube 
>

-- 
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/fc21b86e-6a92-4c96-b376-0633d75b32e2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New to Django

2013-10-15 Thread Roberto López López
>From your link:
https://docs.djangoproject.com/en/1.5/intro/tutorial01/#database-setup





On 10/15/2013 04:07 PM, Mahantesh U wrote:
> yeah ...
> https://docs.djangoproject.com/en/1.5/intro/tutorial01/
>
> And also wanted know how can I set-up mysql with django?
>
> On Tuesday, October 15, 2013 7:31:15 PM UTC+5:30, Lloyd Dube wrote:
>
> You're welcome, Mahantesh :) Did you find the tutorial I mentioned?
>
>
> On Tue, Oct 15, 2013 at 3:56 PM, Mahantesh U
> > wrote:
>
> Thanks a lot Lloyd Dube  :)
>
>
> On Tuesday, October 15, 2013 5:38:33 PM UTC+5:30, Lloyd Dube
> wrote:
>
> Hi,
>
> Do the tutorial on the official Django website - it will
> show you where else to look when you are done :)
>
>
> On Tue, Oct 15, 2013 at 7:55 AM, Mahantesh U
>  wrote:
>
> Hi All,
>
>   I am new to Django framework. I worked on Flask
> framework using python. Please share the sites to
> learn Django easily.
>
> Thanks
> Mahantesh
> -- 
> 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/78b41661-9ac0-4433-bb16-fd8ea7b8ccd2%40googlegroups.com
> 
> .
> For more options, visit
> https://groups.google.com/groups/opt_out
> .
>
>
>
>
> -- 
> Regards,
> Sithu Lloyd Dube
>
> -- 
> 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/ceaab487-fd63-4fc0-bfb1-b37b765fa577%40googlegroups.com
> 
> .
>
>
> For more options, visit
> https://groups.google.com/groups/opt_out
> .
>
>
>
>
> -- 
> Regards,
> Sithu Lloyd Dube
>
> -- 
> 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/fc21b86e-6a92-4c96-b376-0633d75b32e2%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.


-- 

Roberto López López
System Developer
Parallab, Uni Computing
+47 55584091

-- 
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/525D4CDE.3040600%40uni.no.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django cron job - stops after reading some portion of huge file - why is this?

2013-10-15 Thread doniyor
Awesome, then let me try these things you mentioned.. i let you know then.. 
thanks in tons for now 

On Tuesday, October 15, 2013 5:04:02 PM UTC+2, ke1g wrote:
>
> Yes, you should split the db activity into sensible transactions, since 
> information about how to roll back is being stored somewhere (though some 
> DBs may not have a problem with this.
>
> You've added a whole new dimension when you say that this data is not, in 
> fact, a local file that you are reading, but a network request.  There are 
> many more things between you and the data source that could have trouble 
> with the large data size.  I suspect that the most likely is that the 
> server limits the time allowed for the request to complete.  Hopefully a 
> server with such a limit provides for restarting the transfer from other 
> than the beginning.
>
> I'm sorry, but I don't have the spare cycles to debug this for you.  Try 
> instrumenting things to confirm whether it is a read on the source that is 
> hanging or something else.  Since it's hard to get data from a hung 
> process, this requires some imagination.  You could write to a file an 
> indication of the point in the code when you are about to read the source, 
> when the source completes, when you are about to talk to the database, when 
> that completes, etc., but note that you must close the file after each 
> write (and open it anew before the next) since otherwise the write may be 
> buffered in the process when it hangs.  All those opens and closes will be 
> slow, so if you feel adventurous, a write to a piece of shared memory, 
> shared with a monitoring process, might be better.
>
> If you find something other than the read on the source not returning, 
> write again and I, or someone else, with think with you some more.
>
>
>
> On Tue, Oct 15, 2013 at 9:59 AM, doniyor 
> > wrote:
>
>> yes, db code is doin all these calls in single transaction, i mean, i am 
>> not using transactions, may be this is the reason? 
>>
>> this is my cron code: http://pastebin.com/Lrym1z8E i know, very ugly 
>> code, it is saving at least some objects into db
>>
>> this is url where i am reading my xml file from: 
>> http://www.bookatable.com/feed.aspx?channel=524&secret=10F70A84-76D7-C56C-2350-779A1A849819&language=de-DE&type=restaurants
>>
>> also i noticed now that in db, there are objects whose some fields are 
>> not fully filled out even if the xml file does have those information. it 
>> means, this is a transaction issue, right? 
>>
>> could you please take a look at the code? would transaction solve this 
>> issue? 
>>
>>
>> On Tuesday, October 15, 2013 3:40:42 PM UTC+2, ke1g wrote:
>>
>>> One possibility is that your code keeps all that is read (or something 
>>> derived from it) in memory, and you are running out.
>>>
>>> E.g.; Is your database code trying to do all this in a single 
>>> transaction?
>>>
>>> Another possibility is that something in the file at that spot triggers 
>>> a but in your code that contains an infinite loop.
>>>
>>> There are other possibilities.  But there's no diagnosing it with the 
>>> information you've given.
>>>
>>> Can you, in python, read through the file, doing nothing with the data?  
>>> E.g.:
>>>
>>> f = open('your/file/path/here')
>>> n = 0
>>> s = True
>>> while s:
>>> s = f.read(1024*1024)
>>> n += len(s)
>>> print n
>>> print 'done'
>>>
>>> That should work.  If not, does your O/S not correctly handle files that 
>>> big?
>>>
>>> Bill
>>>
>>>
>>> On Tue, Oct 15, 2013 at 6:55 AM, doniyor  wrote:
>>>
 I am reading file from url and parsing it and saving some information 
 out of this file into db - using cron job. 

 i am testing now in my local dev. 

 the problem is: job is reading file and saving into db without any 
 problem but after some time, since file is very huge approx. >8GB, job 
 doesnot do anything and freezes, without giving any error, 

 i am using django 1.4, python 2.7 and postgresql. is there any limit 
 for writing into db? why is it freezing? 


  -- 
 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/b567f273-**508b-4f14-9d40-197af8c8a079%**
 40googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .

>>>
>>>  -- 
>> You received t

Re: django cron job - stops after reading some portion of huge file - why is this?

2013-10-15 Thread Bill Freeman
Yes, you should split the db activity into sensible transactions, since
information about how to roll back is being stored somewhere (though some
DBs may not have a problem with this.

You've added a whole new dimension when you say that this data is not, in
fact, a local file that you are reading, but a network request.  There are
many more things between you and the data source that could have trouble
with the large data size.  I suspect that the most likely is that the
server limits the time allowed for the request to complete.  Hopefully a
server with such a limit provides for restarting the transfer from other
than the beginning.

I'm sorry, but I don't have the spare cycles to debug this for you.  Try
instrumenting things to confirm whether it is a read on the source that is
hanging or something else.  Since it's hard to get data from a hung
process, this requires some imagination.  You could write to a file an
indication of the point in the code when you are about to read the source,
when the source completes, when you are about to talk to the database, when
that completes, etc., but note that you must close the file after each
write (and open it anew before the next) since otherwise the write may be
buffered in the process when it hangs.  All those opens and closes will be
slow, so if you feel adventurous, a write to a piece of shared memory,
shared with a monitoring process, might be better.

If you find something other than the read on the source not returning,
write again and I, or someone else, with think with you some more.



On Tue, Oct 15, 2013 at 9:59 AM, doniyor  wrote:

> yes, db code is doin all these calls in single transaction, i mean, i am
> not using transactions, may be this is the reason?
>
> this is my cron code: http://pastebin.com/Lrym1z8E i know, very ugly
> code, it is saving at least some objects into db
>
> this is url where i am reading my xml file from:
> http://www.bookatable.com/feed.aspx?channel=524&secret=10F70A84-76D7-C56C-2350-779A1A849819&language=de-DE&type=restaurants
>
> also i noticed now that in db, there are objects whose some fields are not
> fully filled out even if the xml file does have those information. it
> means, this is a transaction issue, right?
>
> could you please take a look at the code? would transaction solve this
> issue?
>
>
> On Tuesday, October 15, 2013 3:40:42 PM UTC+2, ke1g wrote:
>
>> One possibility is that your code keeps all that is read (or something
>> derived from it) in memory, and you are running out.
>>
>> E.g.; Is your database code trying to do all this in a single transaction?
>>
>> Another possibility is that something in the file at that spot triggers a
>> but in your code that contains an infinite loop.
>>
>> There are other possibilities.  But there's no diagnosing it with the
>> information you've given.
>>
>> Can you, in python, read through the file, doing nothing with the data?
>> E.g.:
>>
>> f = open('your/file/path/here')
>> n = 0
>> s = True
>> while s:
>> s = f.read(1024*1024)
>> n += len(s)
>> print n
>> print 'done'
>>
>> That should work.  If not, does your O/S not correctly handle files that
>> big?
>>
>> Bill
>>
>>
>> On Tue, Oct 15, 2013 at 6:55 AM, doniyor  wrote:
>>
>>> I am reading file from url and parsing it and saving some information
>>> out of this file into db - using cron job.
>>>
>>> i am testing now in my local dev.
>>>
>>> the problem is: job is reading file and saving into db without any
>>> problem but after some time, since file is very huge approx. >8GB, job
>>> doesnot do anything and freezes, without giving any error,
>>>
>>> i am using django 1.4, python 2.7 and postgresql. is there any limit for
>>> writing into db? why is it freezing?
>>>
>>>
>>>  --
>>> 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/b567f273-**508b-4f14-9d40-197af8c8a079%**
>>> 40googlegroups.com
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>
>>  --
> 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 v

Re: Defining new project as a service at nignx

2013-10-15 Thread carlos
Hi maybe you need use supervisord
http://supervisord.org/

Cheers


On Tue, Oct 15, 2013 at 3:12 AM, Muhammed TÜFEKYAPAN
wrote:

> Hello everyone,
>
> Yes I know that but now my problem is our new project doesn't seen on
> services list and so I can't start it.
>
> I use gunicorn.
>
> How can I made it?
>
>
> On Monday, October 14, 2013 10:03:22 PM UTC+3, Javier Guerra wrote:
>
>> On Mon, Oct 14, 2013 at 12:17 PM, Muhammed TÜFEKYAPAN
>>  wrote:
>> > I use digitalocean as a server. I upload my django project files on my
>> > server and start to setup. Made postgresql settings etc but I can't
>> define
>> > my new project as a new service on nginx. How can I define my new
>> projest as
>> > a service and make possible to start it as "service blabla start".
>> >
>> > When I type "service --statıs-all" I can't see my new project now.
>>
>>
>> i think you're mixing two things and missing a third.
>>
>> 1: AFAIK, nginx doesn't have "services", just serves requests via some
>> methods, either static files, internal plugins or backend servers.
>>
>> 2: on most linux distros, the 'service' command manages startup
>> scripts; with start/stop commands to run daemons.
>>
>> 3: nginx doesn't run python applications, you have to run them in an
>> app server.  for Django, (and most python frameworks), the best option
>> is a wsgi server.  One that runs really well with nginx is uWSGI.
>> another option is to run gunicorn as an HTTP backend server behind
>> nginx.
>>
>>
>> so, which is your deployment strategy?
>> (https://docs.djangoproject.**com/en/1.6/howto/deployment/)
>>
>>
>>
>> --
>> Javier
>>
>  --
> 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/ef9db670-7a3a-4b84-837a-c9e401840452%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAM-7rO3OnaOww7%3Dcwv%3DGc2vKWrAh1-hgP6skLcd9i%3DOdvBujzg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Defining new project as a service at nignx

2013-10-15 Thread Roberto López López

Hi Muhammed,

I agree with Javier: a django project is never run. In your case it is
deployed on gunicorn, which reads/interprets your source code. But it's
never started as a service. You can run nginx as a service, though.

Roberto







On 10/15/2013 11:12 AM, Muhammed TÜFEKYAPAN wrote:
> Hello everyone,
>
> Yes I know that but now my problem is our new project doesn't seen on
> services list and so I can't start it.
>
> I use gunicorn.
>
> How can I made it?
>
> On Monday, October 14, 2013 10:03:22 PM UTC+3, Javier Guerra wrote:
>
> On Mon, Oct 14, 2013 at 12:17 PM, Muhammed TÜFEKYAPAN
> > wrote:
> > I use digitalocean as a server. I upload my django project files
> on my
> > server and start to setup. Made postgresql settings etc but I
> can't define
> > my new project as a new service on nginx. How can I define my
> new projest as
> > a service and make possible to start it as "service blabla start".
> >
> > When I type "service --statıs-all" I can't see my new project now.
>
>
> i think you're mixing two things and missing a third.
>
> 1: AFAIK, nginx doesn't have "services", just serves requests via
> some
> methods, either static files, internal plugins or backend servers.
>
> 2: on most linux distros, the 'service' command manages startup
> scripts; with start/stop commands to run daemons.
>
> 3: nginx doesn't run python applications, you have to run them in an
> app server.  for Django, (and most python frameworks), the best
> option
> is a wsgi server.  One that runs really well with nginx is uWSGI.
> another option is to run gunicorn as an HTTP backend server behind
> nginx.
>
>
> so, which is your deployment strategy?
> (https://docs.djangoproject.com/en/1.6/howto/deployment/
> )
>
>
> -- 
> Javier
>
> -- 
> 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/ef9db670-7a3a-4b84-837a-c9e401840452%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.


-- 

Roberto López López
System Developer
Parallab, Uni Computing
+47 55584091

-- 
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/525D614A.1050702%40uni.no.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django data to Javascript

2013-10-15 Thread Larry Martell
On Tue, Oct 15, 2013 at 6:46 AM, drakko  wrote:

> Hello!
>
> I'm new to Django and Javascript and so I need some help with passing list
> from django template to Javascript.
>
> The list is available in template (template.html) by using
>
> {% for shbf in should_have_found_list %}
>
>
> but I have no idea how to access this list from Javascript.
>
> The should_have_found_list is created in context.py file like:
>
> should_have_found_list = ShouldHaveFound.objects.filter(enabled=1)
>
>
> and passed to template in view.py as a part of dictionary:
>
> return render_to_response(template_name, RequestContext(request, {
>>
>> 'form': form,
>>
>> 'fields': simplejson.dumps(form.field_mapping),
>>
>> }))
>>
>>
> I would appreciate some guidance :)
>

You can embed js anywhere in your template, e.g.:

{% for shbf in should_have_found_list %}

my_js_function(shbf);

{% endfor %}

-- 
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/CACwCsY4PvmRLOkpCrsRps4xLixqRbjkeMhqdvoOuS%2B3g9-RgEA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django data to Javascript

2013-10-15 Thread Scot Hacker


On Tuesday, October 15, 2013 8:45:09 AM UTC-7, larry@gmail.com wrote:
>
>
>>
> You can embed js anywhere in your template, e.g.:
>
> {% for shbf in should_have_found_list %}
> 
> my_js_function(shbf);
> 
> {% endfor %} 
>

I think you meant to write:

my_js_function({{shbf}});

Another take on this, should you need it, is to send JSON directly over 
from the django view or model method into the template. Here's how I solved 
that recently:

importance_options = json.dumps(dict(BundleNode.importance_options))

That will convert a Django queryset into a JSON object. Then, in your JS 
template, something like:

var $options_obj = {{importance_options|safe}};

Season to taste.

./s

-- 
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/5e97192a-e293-4856-9c78-65e9133e30a4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django data to Javascript

2013-10-15 Thread Bill Freeman
I'd probably put the script tag outside the for loop.

But I don't see where you're passing should_have_found_list to the
context.  If it's an item (top level) in form.field_mapping, then it needs
to be something like:

  ...
  {% for shbr in form.field_mapping.should_have_found_list %}
  ...


I don't understand why you are JSON encoding form.field_mapping for the
fields template variable.  There could be perfectly valid reasons.  But if
that was supposed to make should_have_found_list available in JavaScript,
it could work, but you would have to do something with the fields variable
inside a script tag, such as use it in a var statement to initialize a
variable (var fields = {{ fields }};), and then dereference it in JS.


On Tue, Oct 15, 2013 at 11:45 AM, Larry Martell wrote:

> On Tue, Oct 15, 2013 at 6:46 AM, drakko  wrote:
>
>> Hello!
>>
>> I'm new to Django and Javascript and so I need some help with passing
>> list from django template to Javascript.
>>
>> The list is available in template (template.html) by using
>>
>> {% for shbf in should_have_found_list %}
>>
>>
>> but I have no idea how to access this list from Javascript.
>>
>> The should_have_found_list is created in context.py file like:
>>
>> should_have_found_list = ShouldHaveFound.objects.filter(enabled=1)
>>
>>
>> and passed to template in view.py as a part of dictionary:
>>
>> return render_to_response(template_name, RequestContext(request, {
>>>
>>> 'form': form,
>>>
>>> 'fields': simplejson.dumps(form.field_mapping),
>>>
>>> }))
>>>
>>>
>> I would appreciate some guidance :)
>>
>
> You can embed js anywhere in your template, e.g.:
>
> {% for shbf in should_have_found_list %}
> 
> my_js_function(shbf);
> 
> {% endfor %}
>
> --
> 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/CACwCsY4PvmRLOkpCrsRps4xLixqRbjkeMhqdvoOuS%2B3g9-RgEA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAB%2BAj0uPASMP%3D6Sau5A3DpG8ve0389qtq%3Dn0KOdo8yDfSULsWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django data to Javascript

2013-10-15 Thread Larry Martell
On Tue, Oct 15, 2013 at 9:54 AM, Scot Hacker  wrote:

>
>
> On Tuesday, October 15, 2013 8:45:09 AM UTC-7, larry@gmail.com wrote:
>>
>>
>>>
>> You can embed js anywhere in your template, e.g.:
>>
>> {% for shbf in should_have_found_list %}
>> 
>> my_js_function(shbf);
>> 
>> {% endfor %}
>>
>
> I think you meant to write:
>
> my_js_function({{shbf}});
>

Yes - not enough coffee yet.


>
> Another take on this, should you need it, is to send JSON directly over
> from the django view or model method into the template. Here's how I solved
> that recently:
>
> importance_options =
> json.dumps(dict(BundleNode.importance_options))
>
> That will convert a Django queryset into a JSON object. Then, in your JS
> template, something like:
>
> var $options_obj = {{importance_options|safe}};
>
> Season to taste.
>
> ./s
>
>

-- 
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/CACwCsY7XAenh%2BTVJzwceGFsNhiku5_7p%2BH-8%2BmuSnKO2pL7mrw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


ImportError: cannot import name actions

2013-10-15 Thread rok
I have recently been testing the 1.6b4 tag with a new app we are writing, 
using apache and wsgi. However, I could not get rid of the following issue 
happening on every request:

...
[Tue Oct 15 12:50:36 2013] [error] [client 127.0.0.1]   File 
"/home/rok/apps/django-trunk/django/contrib/gis/admin/__init__.py", line 2, 
in 
[Tue Oct 15 12:50:36 2013] [error] [client 127.0.0.1] from 
django.contrib.admin import autodiscover, site, AdminSite, ModelAdmin, 
StackedInline, TabularInline, HORIZONTAL, VERTICAL
[Tue Oct 15 12:50:36 2013] [error] [client 127.0.0.1]   File 
"/home/rok/apps/django-trunk/django/contrib/admin/__init__.py", line 6, in 

[Tue Oct 15 12:50:36 2013] [error] [client 127.0.0.1] from 
django.contrib.admin.sites import AdminSite, site
[Tue Oct 15 12:50:36 2013] [error] [client 127.0.0.1]   File 
"/home/rok/apps/django-trunk/django/contrib/admin/sites.py", line 3, in 

[Tue Oct 15 12:50:36 2013] [error] [client 127.0.0.1] from 
django.contrib.admin import ModelAdmin, actions
[Tue Oct 15 12:50:36 2013] [error] [client 127.0.0.1] ImportError: cannot 
import name actions

by doing the following change, I could get rid of what looked like a 
circular import issue:
--- a/django/contrib/admin/sites.py
+++ b/django/contrib/admin/sites.py
@@ -1,6 +1,7 @@
 from functools import update_wrapper
 from django.http import Http404, HttpResponseRedirect
-from django.contrib.admin import ModelAdmin, actions
+from django.contrib.admin import ModelAdmin
+from django.contrib.admin.actions import delete_selected
 from django.contrib.admin.forms import AdminAuthenticationForm
 from django.contrib.auth import REDIRECT_FIELD_NAME
 from django.contrib.contenttypes import views as contenttype_views
@@ -46,7 +47,7 @@ class AdminSite(object):
 self._registry = {}  # model_class class -> admin_class instance
 self.name = name
 self.app_name = app_name
-self._actions = {'delete_selected': actions.delete_selected}
+self._actions = {'delete_selected': delete_selected}
 self._global_actions = self._actions.copy()
 
 def register(self, model_or_iterable, admin_class=None, **options):

Switching to 1.5.4 resolves the issue as well (even though the sites.py 
code is the same). What is more, this did not occur in the development 
environment when using the runserver run.

Any clue?

-- 
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/636730c0-6d2a-40d8-8837-8b9d73e40f24%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Best Practices/Examples/Working Demos For Adding Form Fields With Ajax?

2013-10-15 Thread Casey Havenor
I'm using Django 1.4.4 FINAL, crispy-forms with bootstrap 2.0. 
I have a very large form.  
I have sections within that form where I need the user to be able to add 
additional forms based on their needs.  (Button add another xyz form).
I still need validation to work with with this new fields.
I also need the CSRF not to break. 
I don't want to reload the entire form.

What are the best practices when trying to accomplish this?

I've looked around on Google but a lot of the examples are either out of 
date or don't work.   Perhaps I'm goggling the wrong search terms? 

Thanks for your 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/20310ce9-3d35-4edd-9d41-c80fec443cb9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Test

2013-10-15 Thread Casey Havenor
Test

-- 
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/bbed597c-293c-4fb2-9f73-c8bbb56ddf58%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


SQL cast for custom model lookup

2013-10-15 Thread Aryeh Leib Taurog
I'm working with 
and I'm wondering if there's a way to get django to add an explicit 
cast to the SQL generated for field lookups.

I have a model that looks like this:

class Floats(models.Model):
arr = FloatArrayField()

Which translates to the following table definition in postgresql:

CREATE TABLE "dbarray_floats" (
"id" serial NOT NULL PRIMARY KEY,
"arr" double precision[]
)
;

When I evaluate something along these lines:

Floats.objects.filter(arr=[3.0, 9.0])

I get the following error:

DatabaseError: operator does not exist: double precision[] = numeric[]
LINE 1: ...ROM "dbarray_floats" WHERE "dbarray_floats"."arr" = ARRAY[3
 ^
HINT:  No operator matches the given name and argument type(s). You might 
need to add explicit type casts.

It looks to me like psycopg2 is for some reason presenting the query 
parameter as numeric[], so I would need to somehow slip a type-cast 
into the SQL statement so that the WHERE clause would look something 
like this:

'WHERE "dbarray_floats"."arr" = %s::double precision[]'

But there doesn't seem to be any mechanism for a custom model field to 
influence the way its placeholders are presented in SQL statements.

Interestingly, this is not a problem when saving array data, only 
when performing lookups.

Is there any way either to get psycopg2's data adapter to present the 
query parameters as double precision[] instead of numeric[] or to put 
an explicit cast into the SQL, without rewriting django's sql 
compiler?

I'm using Django 1.3 with psycopg 2.4.1 and PostgreSQL 9.1

Please cc: me on replies.

Regards,
Aryeh Leib

-- 
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/20131015202008.GD1320%40localhost.
For more options, visit https://groups.google.com/groups/opt_out.


dates DateQuerySet includes time

2013-10-15 Thread Chad Vernon
I'm trying to use the dates QuerySet method but I am getting different 
values in the template:

view:
timecards = Timecard.objects.all()
dates = Timecard.objects.dates('date', 'day', order='DESC')


template:
{% for tc in timecards %}
  {{ tc.date }}
{% endfor %}

Oct. 14, 2013

{% for d in dates %}
  {{ d }}
{% endfor %}

Oct. 13, 2013, 5 p.m.

The documentation says dates is supposed to return a datetime.date object, 
so there should not be any time.  So where does the 5 p.m. come from?  Also 
I'm assuming the day difference is due to time zone which comes with time. 
 So am I using the dates method correctly?

Thanks,
Chad

-- 
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/c722d981-c1d3-4aa6-954b-42a64e4af918%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: dates DateQuerySet includes time

2013-10-15 Thread Chad Vernon
I'm using django 1.5.1 and I guess in in 1.5, the dates method returns 
datetime objects.  So nevermind!



On Tuesday, October 15, 2013 5:56:01 PM UTC-7, Chad Vernon wrote:
>
> I'm trying to use the dates QuerySet method but I am getting different 
> values in the template:
>
> view:
> timecards = Timecard.objects.all()
> dates = Timecard.objects.dates('date', 'day', order='DESC')
>
>
> template:
> {% for tc in timecards %}
>   {{ tc.date }}
> {% endfor %}
>
> Oct. 14, 2013
>
> {% for d in dates %}
>   {{ d }}
> {% endfor %}
>
> Oct. 13, 2013, 5 p.m.
>
> The documentation says dates is supposed to return a datetime.date object, 
> so there should not be any time.  So where does the 5 p.m. come from?  Also 
> I'm assuming the day difference is due to time zone which comes with time. 
>  So am I using the dates method correctly?
>
> Thanks,
> Chad
>

-- 
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/c754f176-5a07-4350-b0fd-08621b4407b5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New to Django

2013-10-15 Thread Bryan Kim Artificio
HI,

good day!

i would like to know id there's a way to connect the postgresSQL with 
django?

regards,

On Tuesday, October 15, 2013 1:55:01 PM UTC+8, Mahantesh U wrote:
>
> Hi All,
>
>   I am new to Django framework. I worked on Flask framework using python. 
> Please share the sites to learn Django easily.
>
> Thanks
> Mahantesh
>

-- 
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/d6099d99-2967-4686-b20a-7be9d2257327%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Image browsing in django

2013-10-15 Thread Harjot Mann
On Mon, Oct 14, 2013 at 9:48 PM, Harjot Mann  wrote:
> I have not done anything special in views..it just contains a simple
> form saving code.
> Should I need to do anything there?


Please reply. I am waiting :(

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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/CAB0GQhDC1MstEPp3LD_zgdAS0QMsoL3p-2pO3HhRvu6OPW14mQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: deploy ?

2013-10-15 Thread Diogene Laerce




You can use nxinx with uwsgi even with several domain names, nginx 
takes care of that, you just run several uwsgi/gunicorn processes on 
different tcp ports or unix sockets, and nginx will just select the 
one that fits for its domain name (set in config) of course you need 
to set it properly..


Anyways, when you want to host multiple python sites with 
nginx/something, I'd recommend uwsgi with supervisor .. which will 
help you manage the apps really easy ... of course you can use 
gunicorn instead of uwsgi ... it is up to you ...


So I will go for : nginx + uwsgi + supervisor + django !


Ok everything runs fine now ! Except :..

If I well understood uwsgi is supposed to update every code changes so
that I don't need to restart the all bundle but it still does not work : 
I do

need to restart everything ? Actually I need to kill all processes first and
after restart everything ?

/debian squeeze + nginx 1.2.1 (extra package) + uwsgi 1.9.18.1 +
supervisor 3.0a.8/

--
“One original thought is worth a thousand mindless quotings.”
“Le vrai n'est pas plus sûr que le probable.”

  Diogene Laerce

--
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/525E301D.4000108%40yahoo.fr.
For more options, visit https://groups.google.com/groups/opt_out.