Re: Weird error like tickets 8892 and 10811

2014-06-25 Thread Lachlan Musicman
ergh. Rookie error. Subtle bug in the Job class - see the save override:

def save(self, *args, **kwargs):
if not self.slug:
  self.slug = self.job_number
  super(Job, self).save(*args, **kwargs)


Note that the call to super is only reachedwhen there is no slug.
The fix is simple:

def save(self, *args, **kwargs):
if not self.slug:
  self.slug = self.job_number
super(Job, self).save(*args, **kwargs)


cheers
L.

On 26 June 2014 14:09, Lachlan Musicman  wrote:
> Ok, I now understand why this happens:
>
 x == j
> True
 j == x
> True
 j.findings
> 'data'
 x.findings
> u''
>
> https://docs.djangoproject.com/en/dev/ref/models/instances/#eq
>
> "with the same primary key value and the same concrete class are
> considered equal. "
>
> (no docs in 1.6, but I presume that was oversight rather than a
> change, since no changes are referenced in the docs.)
>
> cheers.
> L.
>
> On 26 June 2014 13:24, Lachlan Musicman  wrote:
>> I have run up against this bug before:
>>
>> https://code.djangoproject.com/ticket/8892
>>
>> Recently, it was updated to "duplicate of"
>>
>> https://code.djangoproject.com/ticket/10811
>>
>> The TL;DR is
>>
>> Sometimes when you have models with O2O or FK you can lose data if the
>> models are saved in the wrong order.
>>
>> I'm having a similar yet different issue, using Django 1.6.5
>>
>> I have a Job model with subclasses
>>
>> class Job(models.Model):
>>   job_number = models.CharField("Job Number", max_length=20,
>> unique=True, db_index=True)
>>   date_opened = models.DateField()
>>   slug = models.SlugField(max_length=20, unique=True)
>>   def save(self, *args, **kwargs):
>> if not self.slug:
>>   self.slug = self.job_number
>>   super(Job, self).save(*args, **kwargs)
>>
>> class WorkshopJob(Job)
>>   job = models.OneToOneField(Job, parent_link=True)
>>   invoice_number = models.CharField("Invoice Number", max_length=30, 
>> blank=True)
>>   reported_fault = models.TextField()
>>
>>
>> And here we see a similar result:
>>
> j = WorkshopJob.objects.get(id=9)
> j
>> 
> j.date_opened
>> datetime.date(2014, 6, 26)
> j.invoice_number
>> u'123'
> j.findings
>> u''
> j.findings="The CPU doesn't work"
> j.findings
>> "The CPU doesn't work"
> j.save()
> j.findings
>> "The CPU doesn't work"
> j = WorkshopJob.objects.get(id=10)
> j.findings
>> u''
> j = WorkshopJob.objects.get(id=9)
> j.findings
>> u''
>
>>
>>
>> Is this expected behaviour?
>>
>> Is this caused by having overridden the save method on the Job class
>> and then not following up with an overridden save method on
>> WorkshopJob?
>>
>> As another example:
>>
> j = WorkshopCivilJob.objects.get(id=9)
> j.findings
>> u''
> j.findings="data"
> j.findings
>> 'data'
> j.save()
> j.findings
>> 'data'
> x = WorkshopCivilJob.objects.get(id=9)
> x.findings
>> u''
> x == j
>> True
> j == x
>> True
> j.findings
>> 'data'
> x.findings
>> u''
>
>>
>> Now my brain hurts.
>>
>> How can I fix this?
>>
>> cheers
>> L.
>>
>>
>> --
>> The idea is that a beautiful image is frameable. Everything you need
>> to see is there: It’s everything you want, and it’s very pleasing
>> because there’s no extra information that you don’t get to see.
>> Everything’s in a nice package for you. But sublime art is
>> unframeable: It’s an image or idea that implies that there’s a bigger
>> image or idea that you can’t see: You’re only getting to look at a
>> fraction of it, and in that way it’s both beautiful and scary, because
>> it’s reminding you that there’s more that you don’t have access to.
>> It’s now sort of left the piece itself and it’s become your own
>> invention, so it’s personal as well as being scary as well as being
>> beautiful, which is what I really like about art like that.
>> ---
>> Adventure Time http://theholenearthecenteroftheworld.com/
>
>
>
> --
> The idea is that a beautiful image is frameable. Everything you need
> to see is there: It’s everything you want, and it’s very pleasing
> because there’s no extra information that you don’t get to see.
> Everything’s in a nice package for you. But sublime art is
> unframeable: It’s an image or idea that implies that there’s a bigger
> image or idea that you can’t see: You’re only getting to look at a
> fraction of it, and in that way it’s both beautiful and scary, because
> it’s reminding you that there’s more that you don’t have access to.
> It’s now sort of left the piece itself and it’s become your own
> invention, so it’s personal as well as being scary as well as being
> beautiful, which is what I really like about art like that.
> ---
> Adventure Time 

Re: Using Sum function in Models.py

2014-06-25 Thread Lachlan Musicman
I recommend you send through the code for model you are talking about
- since it doesn't make sense to have a sum of a single field of a
model.


Do you really want to keep the sum in the DB and not calculate it as needed?

Maybe if you told us what your desired end point is, we could suggest
best practice?

cheers
L.



On 26 June 2014 14:52, Amitt Bhardwj  wrote:
> I want to define a field in models.py which contains sum of a other field in
> same model class. I tried importing sum function in models but it gave
> errors. Please help me.
>
> --
> 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/756bbafb-ffc8-4cbb-a773-ef242e835f76%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
The idea is that a beautiful image is frameable. Everything you need
to see is there: It’s everything you want, and it’s very pleasing
because there’s no extra information that you don’t get to see.
Everything’s in a nice package for you. But sublime art is
unframeable: It’s an image or idea that implies that there’s a bigger
image or idea that you can’t see: You’re only getting to look at a
fraction of it, and in that way it’s both beautiful and scary, because
it’s reminding you that there’s more that you don’t have access to.
It’s now sort of left the piece itself and it’s become your own
invention, so it’s personal as well as being scary as well as being
beautiful, which is what I really like about art like that.
---
Adventure Time http://theholenearthecenteroftheworld.com/

-- 
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/CAGBeqiNVNMmfRy-yH70JMYTRpQM6UQZK3RjvpYHVo7jdwPwCJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Using Sum function in Models.py

2014-06-25 Thread Amitt Bhardwj
I want to define a field in models.py which contains sum of a other field 
in same model class. I tried importing sum function in models but it gave 
errors. Please help me.

-- 
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/756bbafb-ffc8-4cbb-a773-ef242e835f76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Weird error like tickets 8892 and 10811

2014-06-25 Thread Lachlan Musicman
Ok, I now understand why this happens:

>>> x == j
True
>>> j == x
True
>>> j.findings
'data'
>>> x.findings
u''

https://docs.djangoproject.com/en/dev/ref/models/instances/#eq

"with the same primary key value and the same concrete class are
considered equal. "

(no docs in 1.6, but I presume that was oversight rather than a
change, since no changes are referenced in the docs.)

cheers.
L.

On 26 June 2014 13:24, Lachlan Musicman  wrote:
> I have run up against this bug before:
>
> https://code.djangoproject.com/ticket/8892
>
> Recently, it was updated to "duplicate of"
>
> https://code.djangoproject.com/ticket/10811
>
> The TL;DR is
>
> Sometimes when you have models with O2O or FK you can lose data if the
> models are saved in the wrong order.
>
> I'm having a similar yet different issue, using Django 1.6.5
>
> I have a Job model with subclasses
>
> class Job(models.Model):
>   job_number = models.CharField("Job Number", max_length=20,
> unique=True, db_index=True)
>   date_opened = models.DateField()
>   slug = models.SlugField(max_length=20, unique=True)
>   def save(self, *args, **kwargs):
> if not self.slug:
>   self.slug = self.job_number
>   super(Job, self).save(*args, **kwargs)
>
> class WorkshopJob(Job)
>   job = models.OneToOneField(Job, parent_link=True)
>   invoice_number = models.CharField("Invoice Number", max_length=30, 
> blank=True)
>   reported_fault = models.TextField()
>
>
> And here we see a similar result:
>
 j = WorkshopJob.objects.get(id=9)
 j
> 
 j.date_opened
> datetime.date(2014, 6, 26)
 j.invoice_number
> u'123'
 j.findings
> u''
 j.findings="The CPU doesn't work"
 j.findings
> "The CPU doesn't work"
 j.save()
 j.findings
> "The CPU doesn't work"
 j = WorkshopJob.objects.get(id=10)
 j.findings
> u''
 j = WorkshopJob.objects.get(id=9)
 j.findings
> u''

>
>
> Is this expected behaviour?
>
> Is this caused by having overridden the save method on the Job class
> and then not following up with an overridden save method on
> WorkshopJob?
>
> As another example:
>
 j = WorkshopCivilJob.objects.get(id=9)
 j.findings
> u''
 j.findings="data"
 j.findings
> 'data'
 j.save()
 j.findings
> 'data'
 x = WorkshopCivilJob.objects.get(id=9)
 x.findings
> u''
 x == j
> True
 j == x
> True
 j.findings
> 'data'
 x.findings
> u''

>
> Now my brain hurts.
>
> How can I fix this?
>
> cheers
> L.
>
>
> --
> The idea is that a beautiful image is frameable. Everything you need
> to see is there: It’s everything you want, and it’s very pleasing
> because there’s no extra information that you don’t get to see.
> Everything’s in a nice package for you. But sublime art is
> unframeable: It’s an image or idea that implies that there’s a bigger
> image or idea that you can’t see: You’re only getting to look at a
> fraction of it, and in that way it’s both beautiful and scary, because
> it’s reminding you that there’s more that you don’t have access to.
> It’s now sort of left the piece itself and it’s become your own
> invention, so it’s personal as well as being scary as well as being
> beautiful, which is what I really like about art like that.
> ---
> Adventure Time http://theholenearthecenteroftheworld.com/



-- 
The idea is that a beautiful image is frameable. Everything you need
to see is there: It’s everything you want, and it’s very pleasing
because there’s no extra information that you don’t get to see.
Everything’s in a nice package for you. But sublime art is
unframeable: It’s an image or idea that implies that there’s a bigger
image or idea that you can’t see: You’re only getting to look at a
fraction of it, and in that way it’s both beautiful and scary, because
it’s reminding you that there’s more that you don’t have access to.
It’s now sort of left the piece itself and it’s become your own
invention, so it’s personal as well as being scary as well as being
beautiful, which is what I really like about art like that.
---
Adventure Time http://theholenearthecenteroftheworld.com/

-- 
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/CAGBeqiMhU5nv0hvyh-PPNma3TtnzRL1BFZfaf0nX2TsPQhWprQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: page not found errors for most urls but main landing page displaying okay

2014-06-25 Thread Kelvin Wong
If you have access to your logs, check your logs to figure out where those 
requests are going.

You can also SSH into the server and temporarily turn on the DEBUG=True, 
TEMPLATE_DEBUG=True and let Django tell you what is going on.

Without seeing your fcgi script, my guess is that it is Apache not mapping 
the request to your WSGI file/fcgi script. Double check your htaccess file 
mod_rewrite directives.

K



On Wednesday, June 25, 2014 2:53:21 PM UTC-7, Lee wrote:
>
> Thanks - it must be a problem with the site accessing templates but I 
> can't figure it out. This django project works on another server but I have 
> copied it to a shared host webserver  (Bluehost) and am running it with 
> fcgi so maybe the problem is in the setup.
>
> I am focusing on one url and template, but all have the same problem 
> except the main landing page, which does work.
>
> The url http://mysite/project/map/nav/ shows the right text without any 
> styling
> This is the url pattern for this page in urls.py.
> url(r'^map/nav/$', 'citi_digits.views.mapNavigation', name='mav_nav'),
>
> The view for this url references the template:
> def mapNavigation(request):
> """
> Loads the map navigation elements
> """
> #get all classes
> #get classes
> classes = Teacher.objects.values_list('className', flat=True)
> return 
> render_to_response('map_navigation.html',{'classes':classes},context_instance=RequestContext(request))
>
> In the settings.py the setting for templates is:
> TEMPLATE_DIRS = (
> os.path.join(PROJECT_ROOT, '..', 'citi_digits','templates'),
>
> I also tried an absolute path and put the templates in www but this did 
> not work.
>
> My static settings are:
>
> STATIC_ROOT = '/home5/user/public_html/project/static/'
> STATIC_URL = 'http://mysite.org/project/static/'
>
> Lee
>
>
>
> On Wednesday, June 25, 2014 3:36:52 PM UTC-4, Michael Lind Hjulskov wrote:
>>
>> Hi
>>
>> I had the exact same problem a few days ago. It was one of my templates 
>> that suddenntly was emty. very spooky
>> Or maybe you have an "extends" somewhere that is not correct
>> I would debug by looking in the relevant view and see which template is 
>> called, and the simplify that template to test if bug is in templates or 
>> elsewhere
>>
>> Michael
>>
>> Den onsdag den 25. juni 2014 21.08.35 UTC+2 skrev Lee:
>>>
>>> I have copied a Django project to my web server from a repo and am 
>>> getting the correct initial landing page for the website with the right 
>>> styling when I go to the main URL. Most other urls give "page not found" 
>>> errors. This includes the divs that are called on to make menus on the main 
>>> page so the "Page not found" error is printing over the main landing page. 
>>>
>>> I'm not sure where to start with diagnosis - any thoughts would be 
>>> appreciated.
>>>
>>> I have checked the urls.py file and have tried to go directly to the 
>>> URLs listed starting with http://mysite.org/project/ ...
>>>
>>> urlpatterns = patterns('',
>>> # index.html gives a page not found error
>>>  url(r'^$', 'project.views.index', name='index'),
>>>
>>>
>>> # These go to an unstyled page with correct text
>>> url(r'^signup/$', 'project.views.signUp', name='signup'),
>>> url(r'^login/$', 'project.views.login', name='login'),
>>> url(r'^logout/$', 'project.views.logout', name='logout'),
>>>
>>>
>>> # These also give a page not found error
>>>
>>> url(r'^$', 'project.views.index', name='index'),
>>> url(r'^map/nav/$', 'project.views.mapNavigation', name='mav_nav'),
>>> url(r'^interview/new/$', 'project.views.interviewSelect', 
>>> name='interview_select'),
>>> url(r'^interview/player/$', 'project.views.interviewPlayer', 
>>> name='interview_player'),
>>> url(r'^interview/retailer/$', 'project.views.interviewRetailer', 
>>> name='interview_retailer'),
>>>
>>> url(r'^popup/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/$','project.views.popup',name='popup'),
>>>
>>>
>>> Lee
>>>
>>>

-- 
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/2de669cf-c2cd-4013-b1ad-f54e73b5e933%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Weird error like tickets 8892 and 10811

2014-06-25 Thread Lachlan Musicman
I have run up against this bug before:

https://code.djangoproject.com/ticket/8892

Recently, it was updated to "duplicate of"

https://code.djangoproject.com/ticket/10811

The TL;DR is

Sometimes when you have models with O2O or FK you can lose data if the
models are saved in the wrong order.

I'm having a similar yet different issue, using Django 1.6.5

I have a Job model with subclasses

class Job(models.Model):
  job_number = models.CharField("Job Number", max_length=20,
unique=True, db_index=True)
  date_opened = models.DateField()
  slug = models.SlugField(max_length=20, unique=True)
  def save(self, *args, **kwargs):
if not self.slug:
  self.slug = self.job_number
  super(Job, self).save(*args, **kwargs)

class WorkshopJob(Job)
  job = models.OneToOneField(Job, parent_link=True)
  invoice_number = models.CharField("Invoice Number", max_length=30, blank=True)
  reported_fault = models.TextField()


And here we see a similar result:

>>> j = WorkshopJob.objects.get(id=9)
>>> j

>>> j.date_opened
datetime.date(2014, 6, 26)
>>> j.invoice_number
u'123'
>>> j.findings
u''
>>> j.findings="The CPU doesn't work"
>>> j.findings
"The CPU doesn't work"
>>> j.save()
>>> j.findings
"The CPU doesn't work"
>>> j = WorkshopJob.objects.get(id=10)
>>> j.findings
u''
>>> j = WorkshopJob.objects.get(id=9)
>>> j.findings
u''
>>>


Is this expected behaviour?

Is this caused by having overridden the save method on the Job class
and then not following up with an overridden save method on
WorkshopJob?

As another example:

>>> j = WorkshopCivilJob.objects.get(id=9)
>>> j.findings
u''
>>> j.findings="data"
>>> j.findings
'data'
>>> j.save()
>>> j.findings
'data'
>>> x = WorkshopCivilJob.objects.get(id=9)
>>> x.findings
u''
>>> x == j
True
>>> j == x
True
>>> j.findings
'data'
>>> x.findings
u''
>>>

Now my brain hurts.

How can I fix this?

cheers
L.


-- 
The idea is that a beautiful image is frameable. Everything you need
to see is there: It’s everything you want, and it’s very pleasing
because there’s no extra information that you don’t get to see.
Everything’s in a nice package for you. But sublime art is
unframeable: It’s an image or idea that implies that there’s a bigger
image or idea that you can’t see: You’re only getting to look at a
fraction of it, and in that way it’s both beautiful and scary, because
it’s reminding you that there’s more that you don’t have access to.
It’s now sort of left the piece itself and it’s become your own
invention, so it’s personal as well as being scary as well as being
beautiful, which is what I really like about art like that.
---
Adventure Time http://theholenearthecenteroftheworld.com/

-- 
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/CAGBeqiNqdYkANeV5PtmgvrYO%3DXL_0KJAAewR%3Des9ytspCecX4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to store/model reachable data in django.

2014-06-25 Thread Mario Gudelj
You don't want to use a csv. Store them in a db table cell. Even if you
have a million entries you'll be surprised how quick it will be.
On 26/06/2014 12:45 am, "Subodh Nijsure"  wrote:

> Hello
>
> I have need to store data that can be graphed. Example I have mobile app
> that collects temperature every 30 seconds for say 5 min and uploads these
> samples via REST api to my database. I happen to be using django for
> visualization.
>
> Question I am pondering is what is the best way to store these values in
> database. Store each point as record in db or store csv file? Downside if
> trying to upload single point means lots of request to web site to upload
> data. Csv file means I can't graph across data collected over say one
> month.
>
> Any tips on how to manage graphable data within django?
>
> Subodh
>
> --
> 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/CALr9Q3Z%3D9CJvuG0vvbBPBoX_RXHJYCnuRifQN4OKautOG6ruvA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: page not found errors for most urls but main landing page displaying okay

2014-06-25 Thread Lee
Thanks - it must be a problem with the site accessing templates but I can't 
figure it out. This django project works on another server but I have 
copied it to a shared host webserver  (Bluehost) and am running it with 
fcgi so maybe the problem is in the setup.

I am focusing on one url and template, but all have the same problem except 
the main landing page, which does work.

The url http://mysite/project/map/nav/ shows the right text without any 
styling
This is the url pattern for this page in urls.py.
url(r'^map/nav/$', 'citi_digits.views.mapNavigation', name='mav_nav'),

The view for this url references the template:
def mapNavigation(request):
"""
Loads the map navigation elements
"""
#get all classes
#get classes
classes = Teacher.objects.values_list('className', flat=True)
return 
render_to_response('map_navigation.html',{'classes':classes},context_instance=RequestContext(request))

In the settings.py the setting for templates is:
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, '..', 'citi_digits','templates'),

I also tried an absolute path and put the templates in www but this did not 
work.

My static settings are:

STATIC_ROOT = '/home5/user/public_html/project/static/'
STATIC_URL = 'http://mysite.org/project/static/'

Lee



On Wednesday, June 25, 2014 3:36:52 PM UTC-4, Michael Lind Hjulskov wrote:
>
> Hi
>
> I had the exact same problem a few days ago. It was one of my templates 
> that suddenntly was emty. very spooky
> Or maybe you have an "extends" somewhere that is not correct
> I would debug by looking in the relevant view and see which template is 
> called, and the simplify that template to test if bug is in templates or 
> elsewhere
>
> Michael
>
> Den onsdag den 25. juni 2014 21.08.35 UTC+2 skrev Lee:
>>
>> I have copied a Django project to my web server from a repo and am 
>> getting the correct initial landing page for the website with the right 
>> styling when I go to the main URL. Most other urls give "page not found" 
>> errors. This includes the divs that are called on to make menus on the main 
>> page so the "Page not found" error is printing over the main landing page. 
>>
>> I'm not sure where to start with diagnosis - any thoughts would be 
>> appreciated.
>>
>> I have checked the urls.py file and have tried to go directly to the URLs 
>> listed starting with http://mysite.org/project/ ...
>>
>> urlpatterns = patterns('',
>> # index.html gives a page not found error
>>  url(r'^$', 'project.views.index', name='index'),
>>
>>
>> # These go to an unstyled page with correct text
>> url(r'^signup/$', 'project.views.signUp', name='signup'),
>> url(r'^login/$', 'project.views.login', name='login'),
>> url(r'^logout/$', 'project.views.logout', name='logout'),
>>
>>
>> # These also give a page not found error
>>
>> url(r'^$', 'project.views.index', name='index'),
>> url(r'^map/nav/$', 'project.views.mapNavigation', name='mav_nav'),
>> url(r'^interview/new/$', 'project.views.interviewSelect', 
>> name='interview_select'),
>> url(r'^interview/player/$', 'project.views.interviewPlayer', 
>> name='interview_player'),
>> url(r'^interview/retailer/$', 'project.views.interviewRetailer', 
>> name='interview_retailer'),
>>
>> url(r'^popup/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/$','project.views.popup',name='popup'),
>>
>>
>> Lee
>>
>>

-- 
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/1988fa57-8738-4495-909a-65ebecbeedb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Time Zone Problem when following on tutorial

2014-06-25 Thread Mike Dewhirst
Jerry

I just figured it out and it is simple. Time is constant and all you need 
to do is decide how* you want to display it. The TIME_ZONE setting tells 
the server. 

An event happens at the same time everywhere in the universe (there may be 
Einsteinian exceptions to this) and you can store that time in the database 
relative to UTC. If you choose Shanghai time in settings then all recorded 
times are stored/displayed as Shanghai time. That is totally fair. People 
elsewhere just need to know the system is runing on "Shanghai time"

I don't know why it was necessary to switch the Django default to UTC 
except that lots of people use and can think in UTC as well as local time. 
The entire aviation industry for example. There may be a tiny performance 
gain avoiding calculating a local time.

The backwards compatibility thing is vital because if you have history in 
your database you can't just switch the base from UTC+8 to UTC without 
making all the stored times invalid by 8 hours.

What do you think?

Mike

On Tuesday, June 24, 2014 10:34:03 AM UTC+12, Jerry Wu wrote:
>
> Dear every one,
>
> I am following the tutorial 
>  and meet with 
> some problem with Time Zone part. Since I am in Shanghai, China (UTC+8) , I 
> think it is necessary to reset the time part.
>
> Below is what I tried but failed with valuerror incorrect timezone setting:
>
> TIME_ZONE="UTC+8"
> TIME_ZONE="UTC+8:00"
>
> I have tried "Asia/Shanghai", it works, but I think it is kind of 
> out-of-date style due to the description 
>  
> in the tutorial.
>
> Could some one give me a hint?
>
> Thans in advance.
>

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


Handling checkbox inputs

2014-06-25 Thread Saloni Baweja
I'm building a small app that at first displays the form containing the 
checkboxes and asks the user to select one or more of them and then 
displays the name of only selected ones. 
This works fine. Now, I want to display the data only corresponding to the 
fields that the user has checked or selected. This creates problem as I'm 
not able to fetch the attributes or objects from the list object named ' 
info ' since it is list of unicode strings like [u'name', u'marks'] . In 
display.html {{ j.i }} is not being fetched as  ' i ' isn't an object but 
unicode string whereas ( when tried in shell ) j.name, j.marks fetches the 
information marks and name being objects or attributes. 
Templates :

 # form.html



 Name 
 Roll No. 
 Branch 
 Session 
 Marks 
 Backlog 
  


# display.html


You selected for : {{ nothing }}
{% for i in info %}
  {% for j in list %}
{{ j.i }} 
  {% endfor %}
{% endfor %} 
{% if error %}
  Please select atleast one field.
{% endif %}


# views.py

def index(request):
return render(request, 'index.html')

def display(request):
   list = Student.objects.all()
   if 'info' in request.GET:
   info = request.GET.getlist('info')
   return render(request, 'display.html', { 'info': info, 'list':list })
   else:
   
   return render(request, 'display.html', {'error': True, 
'nothing':'nothing'})
  

-- 
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/523ff8cd-14e7-48d7-8c4f-28e5d0f05c3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: on manage.py migrate appname I get: AttributeError: 'module' object has no attribute 'Migration'

2014-06-25 Thread Michael Lind Hjulskov
Hi Erik

I solved it.. You vere right I should check again the files in migration
folder
It was my IDE (Pycharm) which for some reason sometimes fail on uploading
files. So there was missing a few files, in a migrations folder
Sorry I didnt know that - Pycharm is still new for me. I'm use to Filezilla
which would prompt such error more clearly

Let me know if I can help You some day
I work with ecommerce and my number is 22116322

Thank You very much

Michael


2014-06-25 22:07 GMT+02:00 Michael Lind Hjulskov :

> hmm
> could it be:
> I run my local development env with a sqlite3 as database
> when I launch to deployment, I use mysql as db
>
> But doesnt South produce the same result when i run schemamigration,
> nomatter what db I'm using ?
> Hope You undderstand what I mean
>
>
>
> *Med venlig hilsen*
> Michael Hjulskov
>
> Mobil +45 22116322
>
>
> 2014-06-25 22:02 GMT+02:00 Michael Lind Hjulskov :
>
>  Den 25/06/2014 kl. 21.30 skrev Michael Lind Hjulskov >> >:
>>>
>>> > Hi Erik
>>> >
>>> > Thank You
>>> >
>>> > I tried ./manage.py migrate myappname --traceback
>>> > Still the same error message and no more info available than before.
>>>
>>> Check your migrations folder and make sure you only have South migration
>>> files in there. Also, update to the latest South version, if you haven't
>>> already.
>>>
>> Just checked on the server
>>  There are only south files, and one __init__.py file i each migration
>> folder
>> I have South 0.8.4 installed, which is the latest I can find
>>
>>>
>>>
>> > PS I see You are from DK - I'm from Aalborg, You?
>>>
>>> Roskilde.
>>>
>> OKay I'm looking for a Danish django developer to help me sometimes when
>> i'm in finding myself in a dead end.
>>
>>>
>>> Erik
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/django-users/d6TT9Z6nDLI/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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/1E00F7CB-168A-4EAA-92D9-89B235A25155%40cederstrand.dk
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

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


Re: on manage.py migrate appname I get: AttributeError: 'module' object has no attribute 'Migration'

2014-06-25 Thread Michael Lind Hjulskov
hmm
could it be:
I run my local development env with a sqlite3 as database
when I launch to deployment, I use mysql as db

But doesnt South produce the same result when i run schemamigration,
nomatter what db I'm using ?
Hope You undderstand what I mean



*Med venlig hilsen*
Michael Hjulskov

Mobil +45 22116322


2014-06-25 22:02 GMT+02:00 Michael Lind Hjulskov :

> Den 25/06/2014 kl. 21.30 skrev Michael Lind Hjulskov > >:
>>
>> > Hi Erik
>> >
>> > Thank You
>> >
>> > I tried ./manage.py migrate myappname --traceback
>> > Still the same error message and no more info available than before.
>>
>> Check your migrations folder and make sure you only have South migration
>> files in there. Also, update to the latest South version, if you haven't
>> already.
>>
> Just checked on the server
>  There are only south files, and one __init__.py file i each migration
> folder
> I have South 0.8.4 installed, which is the latest I can find
>
>>
>>
> > PS I see You are from DK - I'm from Aalborg, You?
>>
>> Roskilde.
>>
> OKay I'm looking for a Danish django developer to help me sometimes when
> i'm in finding myself in a dead end.
>
>>
>> Erik
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/d6TT9Z6nDLI/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/1E00F7CB-168A-4EAA-92D9-89B235A25155%40cederstrand.dk
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: on manage.py migrate appname I get: AttributeError: 'module' object has no attribute 'Migration'

2014-06-25 Thread Michael Lind Hjulskov
>
> Den 25/06/2014 kl. 21.30 skrev Michael Lind Hjulskov  >:
>
> > Hi Erik
> >
> > Thank You
> >
> > I tried ./manage.py migrate myappname --traceback
> > Still the same error message and no more info available than before.
>
> Check your migrations folder and make sure you only have South migration
> files in there. Also, update to the latest South version, if you haven't
> already.
>
Just checked on the server
There are only south files, and one __init__.py file i each migration folder
I have South 0.8.4 installed, which is the latest I can find

>
>
> PS I see You are from DK - I'm from Aalborg, You?
>
> Roskilde.
>
OKay I'm looking for a Danish django developer to help me sometimes when
i'm in finding myself in a dead end.

>
> Erik
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/d6TT9Z6nDLI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/1E00F7CB-168A-4EAA-92D9-89B235A25155%40cederstrand.dk
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: on manage.py migrate appname I get: AttributeError: 'module' object has no attribute 'Migration'

2014-06-25 Thread Erik Cederstrand
Den 25/06/2014 kl. 21.30 skrev Michael Lind Hjulskov :

> Hi Erik
> 
> Thank You
> 
> I tried ./manage.py migrate myappname --traceback
> Still the same error message and no more info available than before.

Check your migrations folder and make sure you only have South migration files 
in there. Also, update to the latest South version, if you haven't already.

> PS I see You are from DK - I'm from Aalborg, You?

Roskilde.

Erik

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


Re: page not found errors for most urls but main landing page displaying okay

2014-06-25 Thread Michael Lind Hjulskov
Hi

I had the exact same problem a few days ago. It was one of my templates 
that suddenntly was emty. very spooky
Or maybe you have an "extends" somewhere that is not correct
I would debug by looking in the relevant view and see which template is 
called, and the simplify that template to test if bug is in templates or 
elsewhere

Michael

Den onsdag den 25. juni 2014 21.08.35 UTC+2 skrev Lee:
>
> I have copied a Django project to my web server from a repo and am getting 
> the correct initial landing page for the website with the right styling 
> when I go to the main URL. Most other urls give "page not found" errors. 
> This includes the divs that are called on to make menus on the main page so 
> the "Page not found" error is printing over the main landing page. 
>
> I'm not sure where to start with diagnosis - any thoughts would be 
> appreciated.
>
> I have checked the urls.py file and have tried to go directly to the URLs 
> listed starting with http://mysite.org/project/ ...
>
> urlpatterns = patterns('',
> # index.html gives a page not found error
>  url(r'^$', 'project.views.index', name='index'),
>
>
> # These go to an unstyled page with correct text
> url(r'^signup/$', 'project.views.signUp', name='signup'),
> url(r'^login/$', 'project.views.login', name='login'),
> url(r'^logout/$', 'project.views.logout', name='logout'),
>
>
> # These also give a page not found error
>
> url(r'^$', 'project.views.index', name='index'),
> url(r'^map/nav/$', 'project.views.mapNavigation', name='mav_nav'),
> url(r'^interview/new/$', 'project.views.interviewSelect', 
> name='interview_select'),
> url(r'^interview/player/$', 'project.views.interviewPlayer', 
> name='interview_player'),
> url(r'^interview/retailer/$', 'project.views.interviewRetailer', 
> name='interview_retailer'),
>
> url(r'^popup/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/$','project.views.popup',name='popup'),
>
>
> Lee
>
>

-- 
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/54f9de55-4acf-4ede-bc28-f67cbac12eee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: on manage.py migrate appname I get: AttributeError: 'module' object has no attribute 'Migration'

2014-06-25 Thread Michael Lind Hjulskov
Hi Erik

Thank You

I tried ./manage.py migrate myappname --traceback
Still the same error message and no more info available than before.

PS I see You are from DK - I'm from Aalborg, You?

Michael


2014-06-25 20:31 GMT+02:00 Erik Cederstrand :

> Den 25/06/2014 kl. 16.19 skrev Michael Lind Hjulskov  >:
>
> > Hi there :)
> >
> > I'm stuck with this problem
> > when I run python manage.py migrate myappname i get the following error:
> > AttributeError: 'module' object has no attribute 'Migration'
> >
> > I remember I had this problem before, and I remember that I solved it by
> deleting all pyc files  - I tried that - still error
> >
> > any clues?
>
>
> Try getting a backtrace:
>
> ./manage.py migrate myappname --traceback
>
>
> Erik
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/d6TT9Z6nDLI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/4657E66A-9476-49A5-8EB1-BD2BEBA86049%40cederstrand.dk
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


page not found errors for most urls but main landing page displaying okay

2014-06-25 Thread Lee
I have copied a Django project to my web server from a repo and am getting 
the correct initial landing page for the website with the right styling 
when I go to the main URL. Most other urls give "page not found" errors. 
This includes the divs that are called on to make menus on the main page so 
the "Page not found" error is printing over the main landing page. 

I'm not sure where to start with diagnosis - any thoughts would be 
appreciated.

I have checked the urls.py file and have tried to go directly to the URLs 
listed starting with http://mysite.org/project/ ...

urlpatterns = patterns('',
# index.html gives a page not found error
 url(r'^$', 'project.views.index', name='index'),


# These go to an unstyled page with correct text
url(r'^signup/$', 'project.views.signUp', name='signup'),
url(r'^login/$', 'project.views.login', name='login'),
url(r'^logout/$', 'project.views.logout', name='logout'),


# These also give a page not found error

url(r'^$', 'project.views.index', name='index'),
url(r'^map/nav/$', 'project.views.mapNavigation', name='mav_nav'),
url(r'^interview/new/$', 'project.views.interviewSelect', 
name='interview_select'),
url(r'^interview/player/$', 'project.views.interviewPlayer', 
name='interview_player'),
url(r'^interview/retailer/$', 'project.views.interviewRetailer', 
name='interview_retailer'),
url(r'^popup/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/$','project.views.popup',name='popup'),


Lee

-- 
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/168719a0-8a10-4bb0-aa9a-ecd490dbf977%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


testing equality in template tag

2014-06-25 Thread Lee Hinde
with view code like so:

import calendar
months_choices = []
for i in range(1,13):
months_choices.append((i, calendar.month_name[i]))
context['months'] = months_choices


and

context['default_month'] = today.month

I have this snippet in a template (my first use of lists like this):


{% for month in months %}

{{ month.1 }}
{% endfor %}



The issue is the  {% if default_month == month.0 %} always returns false...
The rest of the select is properly built - I get a number for the value and
the month name as the label.

Why?

-- 
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%2BePoMzx%2B4774Ne21djP-EdSAHDL_64DWhZVQYrUYdND%3DBk2%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: on manage.py migrate appname I get: AttributeError: 'module' object has no attribute 'Migration'

2014-06-25 Thread Erik Cederstrand
Den 25/06/2014 kl. 16.19 skrev Michael Lind Hjulskov :

> Hi there :)
> 
> I'm stuck with this problem 
> when I run python manage.py migrate myappname i get the following error:
> AttributeError: 'module' object has no attribute 'Migration'
> 
> I remember I had this problem before, and I remember that I solved it by 
> deleting all pyc files  - I tried that - still error
> 
> any clues?


Try getting a backtrace:

./manage.py migrate myappname --traceback


Erik

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


Re: Copied django project to shared host from repo - can't import settings

2014-06-25 Thread Lee
This worked, thank you! I don't understand why it worked, but pleased that 
it did.

Lee

On Wednesday, June 25, 2014 11:14:46 AM UTC-4, sacrac wrote:
>
> ok i make different configuration
>
> #!/home5/myorg/.virtualenvs/mydjango/bin/python
> import sys, os
>
> # Add a custom Python path.
> sys.path.insert(0, "/home//projects/")
> sys.path.insert(0, "/home//projects/yourproyect")
>
> from flup.server.fcgi import WSGIServer
> os.environ['DJANGO_SETTINGS_MODULE'] = '.settings'
> from django.core.handlers.wsgi import WSGIHandler
> WSGIServer(WSGIHandler()).run()
>
> Cheers
>
>
> On Tue, Jun 24, 2014 at 9:51 PM, Lee  
> wrote:
>
>> For mysite.fcgi I have: 
>>
>> #!/home5/myorg/.virtualenvs/mydjango/bin/python
>> import sys, os
>>
>> # Add a custom Python path.
>> sys.path.insert(0, "/home5/myorg/.virtualenvs/mydjango")
>> sys.path.insert(13, "/home5/myorg/django_projects/mysite")
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
>> from django.core.servers.fastcgi import runfastcgi
>> runfastcgi(method="threaded", daemonize="false")
>>
>>
>> and for .htaccess I have - 
>>
>> AddHandler fcgid-script .fcgi
>> RewriteEngine On
>> RewriteCond %{REQUEST_FILENAME} !-f
>> RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
>>
>>
>> Thanks,
>> Lee
>>
>> On Tuesday, June 24, 2014 9:23:17 PM UTC-4, sacrac wrote:
>>
>>> Hi, maybe show the content mysite.fcgi and .htaccess, the error say not 
>>> exist your project mysite
>>> maybe the path is not good in mysite.fcgi!
>>>
>>> Cheers
>>>  
>>>
>>> On Tue, Jun 24, 2014 at 3:39 PM, Lee  wrote:
>>>
  Hello,

 I setup Django successfully on my shared Bluehost account following the 
 tutorial below: http://www.nyayapati.com/srao/
 2012/08/setup-python-2-7-and-django-1-4-on-bluehost/

 I am now having problems with a Django project I have copied from a 
 GitHub repo to my Bluehost directory. I am getting this error when I run 
 python mysite.fcgi in my virtualenv

 go-1.5.1-py2.7.egg/django/conf/__init__.py", line 134, in __init__
 raise ImportError("Could not import settings '%s' (Is it on 
 sys.path?): %s" % (self.SETTINGS_MODULE, e))
 ImportError: Could not import settings 'mysite.settings' (Is it on 
 sys.path?): No module named settings

 Any thoughts on where to look for errors? I have checked .htaccess and 
 the mysite.fcgi file in my www directory, the pointer to settings in my 
 manage.py and these seem as they should be. Running python manage.py 
 runserver on the project says there are no errors.

 Lee

 -- 
 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/595e7cff-5af9-4c63-a052-41d3ce472e30%
 40googlegroups.com 
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d31f24ec-601b-4b4a-8d83-05d7048c442c%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: Criar slideShow

2014-06-25 Thread Carlos Andre
Valeu marco aurélio! obrigado!


2014-06-25 9:29 GMT-03:00 Sandro Dutra :

> Você está em uma lista de discussão internacional, se espera alguma
> resposta, escreva em inglês.
>
> You're on international group, if you expect some answer, write in english.
>
>
> 2014-06-24 21:50 GMT-03:00 Carlos Andre :
>
>> Olá pessoal, tudo bem com todos?
>> Gostaria de uma solução que permita referenciar fotos para m slideshow
>> com até no máximo 5 fotos que seguirão ordem de inserção! tipo usando um id!
>> Obrigado pela atenção de todos!
>>
>> --
>> 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/CAA8yBMzR-r9dsUeYrHN6xiLNOqGXpj%3DSMLsPjv5TcjEhLhARzA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAH%2Bpf9nXzfdrgVmza8qRvUt3YEO3ym9PckdZ6wjyPKCjdpNqDA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Copied django project to shared host from repo - can't import settings

2014-06-25 Thread carlos
ok i make different configuration

#!/home5/myorg/.virtualenvs/mydjango/bin/python
import sys, os

# Add a custom Python path.
sys.path.insert(0, "/home//projects/")
sys.path.insert(0, "/home//projects/yourproyect")

from flup.server.fcgi import WSGIServer
os.environ['DJANGO_SETTINGS_MODULE'] = '.settings'
from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()

Cheers


On Tue, Jun 24, 2014 at 9:51 PM, Lee  wrote:

> For mysite.fcgi I have:
>
> #!/home5/myorg/.virtualenvs/mydjango/bin/python
> import sys, os
>
> # Add a custom Python path.
> sys.path.insert(0, "/home5/myorg/.virtualenvs/mydjango")
> sys.path.insert(13, "/home5/myorg/django_projects/mysite")
> os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
> from django.core.servers.fastcgi import runfastcgi
> runfastcgi(method="threaded", daemonize="false")
>
>
> and for .htaccess I have -
>
> AddHandler fcgid-script .fcgi
> RewriteEngine On
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
>
>
> Thanks,
> Lee
>
> On Tuesday, June 24, 2014 9:23:17 PM UTC-4, sacrac wrote:
>
>> Hi, maybe show the content mysite.fcgi and .htaccess, the error say not
>> exist your project mysite
>> maybe the path is not good in mysite.fcgi!
>>
>> Cheers
>>
>>
>> On Tue, Jun 24, 2014 at 3:39 PM, Lee  wrote:
>>
>>>  Hello,
>>>
>>> I setup Django successfully on my shared Bluehost account following the
>>> tutorial below: http://www.nyayapati.com/srao/
>>> 2012/08/setup-python-2-7-and-django-1-4-on-bluehost/
>>>
>>> I am now having problems with a Django project I have copied from a
>>> GitHub repo to my Bluehost directory. I am getting this error when I run
>>> python mysite.fcgi in my virtualenv
>>>
>>> go-1.5.1-py2.7.egg/django/conf/__init__.py", line 134, in __init__
>>> raise ImportError("Could not import settings '%s' (Is it on sys.path?): 
>>> %s" % (self.SETTINGS_MODULE, e))
>>> ImportError: Could not import settings 'mysite.settings' (Is it on 
>>> sys.path?): No module named settings
>>>
>>> Any thoughts on where to look for errors? I have checked .htaccess and
>>> the mysite.fcgi file in my www directory, the pointer to settings in my
>>> manage.py and these seem as they should be. Running python manage.py
>>> runserver on the project says there are no errors.
>>>
>>> Lee
>>>
>>> --
>>> 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/595e7cff-5af9-4c63-a052-41d3ce472e30%
>>> 40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d31f24ec-601b-4b4a-8d83-05d7048c442c%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Django Login/Session Not Sticking

2014-06-25 Thread LaPerl
Hello all,

I'm not sure if you  discovered the problem, but if you have different 
types of authentication backends, maybe the problem is on the session 
objects. Did you do a delete?.
See the NOTE in this chapter: 
https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#specifying-authentication-backends

Hope it helps


El dimecres 4 de juny de 2014 6:55:38 UTC-5, Juergen Schackmann va escriure:
>
> Hi all, 
> this question refers to this previous question: 
> https://groups.google.com/forum/#!topic/django-users/8IXEvfU72S4. 
> However, it seems like the problem is slightly different, I decided to open 
> a new question:
>
> After my site has been up and running for a while in production, I 
> suddenly have a problem with my users loging into it.
>
>1. I have protected certain views/pages with the login_required 
>decorator and I am also using the django admin.
>2. When an anonymous user hits any of these pages, he is redirected to 
>the login page.
>3. When this anonymous user adds its credentials, the POST request is 
>successful and he is redirected to the inital page. At the same time, the 
>user gets a new sessionid (as expected)
>4. However, now the results get very unreliable. When pressing reload 
>or when navigating to other pages (that require a login), either of the 2 
>outcomes might happen:
>
>
>- a) The user is identified and the page is displayed correctly
>- b) The user is redirect to the login page.
>
> I have checked the content of the session via the shell, and nothing is 
> changing there.
>
> The production site is served via a load balancer and 8 application 
> servers. Even stranger: if I test the same code (with the same settings) on 
> a test server, that is not load balanced and basically has not traffic, 
> everything is working fine.
>
> I am running Django 1.6 on Ubuntu with Apache and mod_wsgi in daemon mode 
> behind SSL and I am using the Session database backend. I am using 
> django-allauth.account for account management/login. My Session settings 
> are like this:
>
> SESSION_COOKIE_HTTPONLY = True
> SESSION_COOKIE_AGE = 60*60*24
> SESSION_COOKIE_SECURE = True
>
> So I have the following questions/ideas?
>
> 1. Can this be related to loadbalancing in anyway? My understanding was 
> that Django does not need sticky sessions, when the DB session backend is 
> used.
>
> 2. Can this be related to a threading issue?
>
> 3. Can this be related to high load?
>
> 4. Can this be related to a decoding issue: 
> https://github.com/django/django/blob/master/django/contrib/sessions/backends/base.py#L83.
>  
> However, I have not found any log entries that refer to "Session data 
> corrupted".
>
> Any other hints are welcome.
>
>
>

-- 
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/a1598521-261d-4efd-b442-9562bedfce1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to store/model reachable data in django.

2014-06-25 Thread Subodh Nijsure
Hello

I have need to store data that can be graphed. Example I have mobile app
that collects temperature every 30 seconds for say 5 min and uploads these
samples via REST api to my database. I happen to be using django for
visualization.

Question I am pondering is what is the best way to store these values in
database. Store each point as record in db or store csv file? Downside if
trying to upload single point means lots of request to web site to upload
data. Csv file means I can't graph across data collected over say one
month.

Any tips on how to manage graphable data within django?

Subodh

-- 
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/CALr9Q3Z%3D9CJvuG0vvbBPBoX_RXHJYCnuRifQN4OKautOG6ruvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: on manage.py migrate appname I get: AttributeError: 'module' object has no attribute 'Migration'

2014-06-25 Thread Michael Lind Hjulskov
Hi

Here's a bit more info about the error
this is the line 
 
where it fails in south

Hope to get help

Thanks

Den onsdag den 25. juni 2014 16.19.08 UTC+2 skrev Michael Lind Hjulskov:
>
> Hi there :)
>
> I'm stuck with this problem 
> when I run python manage.py migrate myappname i get the following error:
> AttributeError: 'module' object has no attribute 'Migration'
>
> I remember I had this problem before, and I remember that I solved it by 
> deleting all pyc files  - I tried that - still error
>
> any clues?
>
> Thank You
>

-- 
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/740a3b38-bca5-4514-9032-c181740228a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Howto update a package in venv

2014-06-25 Thread Michael Lind Hjulskov
Thanks Lachlan
Good to know
Python and Django is so cool and full of fancy stuff.
Have a good day

Den søndag den 22. juni 2014 13.07.20 UTC+2 skrev Lachlan Musicman:
>
> I'm a big fan of pip-tools: 
>
> pip install pip-tools 
>
> Once installed, you can do: 
>
> pip-review --interactive 
>
> which will check all installed apps and off to update them - you can 
> choose to upgrade for each app (hence the --interactive). 
>
> Cheers 
> L. 
>
> On 22 June 2014 07:28, Tom Evans  
> wrote: 
> > On Sat, Jun 21, 2014 at 4:57 PM, Michael Lind Hjulskov 
> >  wrote: 
> >> Hi 
> >> 
> >> Im relative new to Django and Linux commands etc. 
> >> I hope to get help in here :o) 
> >> 
> >> I use virtualenv and requirements and one of the requirements is Sorl 
> >> But Sorl together with Django 1.6.5 is giving me this error on 
> runserver 
> >> 
> "/home/mh/v/local/lib/python2.7/site-packages/sorl/thumbnail/helpers.py:5: 
> >> DeprecationWarning: django.utils.simplejson is deprecated; use json 
> instead. 
> >>   from django.utils import simplejson" 
> >> 
> >> I believe i found a fix here 
> >> https://github.com/mariocesar/sorl-thumbnail/pull/165/files 
> >> 
> >> My question is 
> >> 1. Is there a way that I can simply add a line to my requirements.txt 
> file, 
> >> so that these two files will be automatically updated when I do the 
> "pip -r 
> >> requirements.txt" ? 
> >> 2. if not, how do I pull such changes into my sorl, inside my venv? 
> >> 
> >> Bby the way, is this the right place to ask such questions? or is there 
> >> anoter forum/group I should use? 
> >> 
> >> Thank You :o) 
> >> 
> >> Michael 
> > 
> > That fix (a better one, actually) is in a released version of 
> > sorl-thumbnail - 11.12.1b. 
> > 
> > So you should just be able to say "pip install --upgrade 
> > sorl-thumbnail" and it will install the correct (latest) version. 
> > 
> > You can check what version you currently have with "pip freeze". 
> > 
> > You can specify you want that exact version in your requirements.txt, 
> > or even on the command line - "sorl-thumbnail==11.12.1b" - but I 
> > wouldn't do that. I much prefer this in development 
> > "sorl-thumbnail>=11.12.1b", or more conservatively on a production 
> > box, "sorl-thumbnail>=11.12.1b,<11.13". 
> > 
> > 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...@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/CAFHbX1LHCcB%3DwOri0pZu9VBy5CRWCcySSVMukYMC0e84hcKAQg%40mail.gmail.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> The idea is that a beautiful image is frameable. Everything you need 
> to see is there: It’s everything you want, and it’s very pleasing 
> because there’s no extra information that you don’t get to see. 
> Everything’s in a nice package for you. But sublime art is 
> unframeable: It’s an image or idea that implies that there’s a bigger 
> image or idea that you can’t see: You’re only getting to look at a 
> fraction of it, and in that way it’s both beautiful and scary, because 
> it’s reminding you that there’s more that you don’t have access to. 
> It’s now sort of left the piece itself and it’s become your own 
> invention, so it’s personal as well as being scary as well as being 
> beautiful, which is what I really like about art like that. 
> ---
>  
>
> Adventure Time http://theholenearthecenteroftheworld.com/ 
>

-- 
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/ceb303c0-3228-4e1e-96b8-bb58c9b211a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Howto update a package in venv

2014-06-25 Thread Michael Lind Hjulskov
That did the trick Tom
Thanks alot for spending Your time on me.
Cheers

Den lørdag den 21. juni 2014 23.29.24 UTC+2 skrev Tom Evans:
>
> On Sat, Jun 21, 2014 at 4:57 PM, Michael Lind Hjulskov 
>  wrote: 
> > Hi 
> > 
> > Im relative new to Django and Linux commands etc. 
> > I hope to get help in here :o) 
> > 
> > I use virtualenv and requirements and one of the requirements is Sorl 
> > But Sorl together with Django 1.6.5 is giving me this error on runserver 
> > 
> "/home/mh/v/local/lib/python2.7/site-packages/sorl/thumbnail/helpers.py:5: 
> > DeprecationWarning: django.utils.simplejson is deprecated; use json 
> instead. 
> >   from django.utils import simplejson" 
> > 
> > I believe i found a fix here 
> > https://github.com/mariocesar/sorl-thumbnail/pull/165/files 
> > 
> > My question is 
> > 1. Is there a way that I can simply add a line to my requirements.txt 
> file, 
> > so that these two files will be automatically updated when I do the "pip 
> -r 
> > requirements.txt" ? 
> > 2. if not, how do I pull such changes into my sorl, inside my venv? 
> > 
> > Bby the way, is this the right place to ask such questions? or is there 
> > anoter forum/group I should use? 
> > 
> > Thank You :o) 
> > 
> > Michael 
>
> That fix (a better one, actually) is in a released version of 
> sorl-thumbnail - 11.12.1b. 
>
> So you should just be able to say "pip install --upgrade 
> sorl-thumbnail" and it will install the correct (latest) version. 
>
> You can check what version you currently have with "pip freeze". 
>
> You can specify you want that exact version in your requirements.txt, 
> or even on the command line - "sorl-thumbnail==11.12.1b" - but I 
> wouldn't do that. I much prefer this in development 
> "sorl-thumbnail>=11.12.1b", or more conservatively on a production 
> box, "sorl-thumbnail>=11.12.1b,<11.13". 
>
> 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/5e7e2b67-4ca7-436e-834e-82ff530fd614%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


on manage.py migrate appname I get: AttributeError: 'module' object has no attribute 'Migration'

2014-06-25 Thread Michael Lind Hjulskov
Hi there :)

I'm stuck with this problem 
when I run python manage.py migrate myappname i get the following error:
AttributeError: 'module' object has no attribute 'Migration'

I remember I had this problem before, and I remember that I solved it by 
deleting all pyc files  - I tried that - still error

any clues?

Thank You

-- 
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/757031e8-0951-4d97-908c-ba0e9f9fd88e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: apps for hotel site

2014-06-25 Thread Sithembewena Lloyd Dube
That really depends on what functionality you want. Booking? Reporting? etc
...


On Wed, Jun 25, 2014 at 3:41 PM, ngangsia akumbo  wrote:

> please what are the basic apps i need to include in my hotel website?
>
>
>  --
> 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/f82691fe-413d-41f4-aee4-51f90cc43ef7%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
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-SnCDZ5LBkGO0Q72QnYN_FtsdA5Z8cKN-KdGXiLYWa8q638A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django not reconnecting to database after mysql server restart

2014-06-25 Thread cercatrova2

  
  
Dear django'ers:


Configuration: django 1.6.5, mysql connector/python 1.2.2, mysql
server 5.5.37, apache worker 2.2.22 with mod_fastcgi, and python
3.3.5 on an otherwise stock and up-to-date ubuntu 12.04 setup.


Problem: django is not reconnecting to the database after a mysql
server restart. From what I read it should connect to the database
*on each request* if CONN_MAX_AGE is 0. Access works properly in
normal operation but after bouncing the mysql server the database
access fails with an exception of "MySQL Connection not available"
and an http server restart is required. After that access works
properly again.


I've tested restarting mysql server with all of the above except
django i.e. with just a simple wsgi script and no http server
restart is required so this doesn't seem to be a problem with the
mysql connector/python adapter itself but between django and the
adapter i.e. something in django/db/backends/__init__.py or
mysql/connector/django/base.py. The ensure_connection() method in
backends/__init.py__ just doesn't seem to be doing what it should.

Am I misinterpreting what I read about reconnecting?

Last part of traceback:

File
"/usr/local/lib/python3.3/dist-packages/django/db/models/sql/compiler.py"
in results_iter

  713. for rows in self.execute_sql(MULTI):

File
"/usr/local/lib/python3.3/dist-packages/django/db/models/sql/compiler.py"
in execute_sql

  785. cursor = self.connection.cursor()

File "/usr/local/lib/python3.3/dist-packages/django/db/backends/__init__.py" in cursor

  160. cursor = self.make_debug_cursor(self._cursor())

File
"/usr/local/lib/python3.3/dist-packages/mysql/connector/django/base.py"
in _cursor

  554. return super(DatabaseWrapper, self)._cursor()

File "/usr/local/lib/python3.3/dist-packages/django/db/backends/__init__.py" in _cursor

  134. return self.create_cursor()

File "/usr/local/lib/python3.3/dist-packages/django/db/utils.py" in
__exit__

  99. six.reraise(dj_exc_type, dj_exc_value,
traceback)

File "/usr/local/lib/python3.3/dist-packages/django/utils/six.py" in
reraise

  549. raise value.with_traceback(tb)

File "/usr/local/lib/python3.3/dist-packages/django/db/backends/__init__.py" in _cursor

  134. return self.create_cursor()

File
"/usr/local/lib/python3.3/dist-packages/mysql/connector/django/base.py"
in create_cursor

  539. cursor = self.connection.cursor()

File
"/usr/local/lib/python3.3/dist-packages/mysql/connector/connection.py"
in cursor

  1328. raise errors.OperationalError("MySQL Connection
not available.")



  




-- 
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/53AAC8FB.5010607%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


apps for hotel site

2014-06-25 Thread ngangsia akumbo
please what are the basic apps i need to include in my hotel website?


-- 
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/f82691fe-413d-41f4-aee4-51f90cc43ef7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using session data to populate multiple forms

2014-06-25 Thread Aaron Reabow
haha - okay

*model_instance.participant = request.session.get('participant')*

works perfectly.

I thought the incorrect use of objects was just the start :)

Thanks Daniel, much appreciated.


On Wednesday, 25 June 2014 11:07:19 UTC+2, Daniel Roseman wrote:
>
> On Wednesday, 25 June 2014 08:58:05 UTC+1, Aaron Reabow wrote:
>>
>> Perhaps I should be more specific.
>>
>> How do i populate some fields in a table from a form, and other fields 
>> from session variables in the view  (or the template or the model if that 
>> was more appropriate)
>>
>> many thanks,
>>
>> aaron
>>
>>
> Well, I understand that bit. What I don't understand is what's wrong with 
> the code you've posted, once you correct the use of dictionary syntax? 
>  This is exactly the correct approach.
> --
> DR.
>

-- 
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/4e2efcb1-bb19-491d-9db4-7792f359474a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: admin generated form, change dropdown with selction from popup menu

2014-06-25 Thread Derek
Yes, you will need to use a third-party app such as django-selectable 
(http://django-selectable.readthedocs.org/en/v0.8.X/admin.html)

On Wednesday, 25 June 2014 07:43:16 UTC+2, Aeh. ABID wrote:
>
> Is there a way to display a field value other than id in the textbox
>
> On Wednesday, June 25, 2014 6:11:27 AM UTC+1, Aeh. ABID wrote:
>>
>> When dropdown could hold a pretty long list which may slowdown the page 
>> load, how can I override the drop-down menu in the change-form to a 
>> "read-only input" that can be filled with value from popup window.
>>
>

-- 
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/2dec08fe-0f85-48dd-a4e6-be4130c4df4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: WANTED: Photo Contest Package

2014-06-25 Thread tinkert
Photologue might be useful as part of the solution - I used it on a 
previous project some time ago, but it looks like it's still actively 
maintained:

https://github.com/jdriscoll/django-photologue

On Tuesday, 24 June 2014 13:31:15 UTC+1, André Meyer-Vitali wrote:
>
> Hi all
>
> I'm organising a photography contest and would like to set up a web site 
> for submission, display and voting of the pictures.
>
> Do you know of any django package or plugin that could be helpful?
>
> thanks in advance!
> André
>

-- 
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/ceebd9e5-4168-4da4-8a4b-d37df9327722%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Criar slideShow

2014-06-25 Thread Sandro Dutra
Você está em uma lista de discussão internacional, se espera alguma
resposta, escreva em inglês.

You're on international group, if you expect some answer, write in english.


2014-06-24 21:50 GMT-03:00 Carlos Andre :

> Olá pessoal, tudo bem com todos?
> Gostaria de uma solução que permita referenciar fotos para m slideshow com
> até no máximo 5 fotos que seguirão ordem de inserção! tipo usando um id!
> Obrigado pela atenção de todos!
>
> --
> 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/CAA8yBMzR-r9dsUeYrHN6xiLNOqGXpj%3DSMLsPjv5TcjEhLhARzA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Using session data to populate multiple forms

2014-06-25 Thread Daniel Roseman
On Wednesday, 25 June 2014 08:58:05 UTC+1, Aaron Reabow wrote:
>
> Perhaps I should be more specific.
>
> How do i populate some fields in a table from a form, and other fields 
> from session variables in the view  (or the template or the model if that 
> was more appropriate)
>
> many thanks,
>
> aaron
>
>
Well, I understand that bit. What I don't understand is what's wrong with 
the code you've posted, once you correct the use of dictionary syntax? 
 This is exactly the correct approach.
--
DR.

-- 
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/f76e6ab1-6c16-4a88-a66b-f2241fe164cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using session data to populate multiple forms

2014-06-25 Thread Aaron Reabow
Perhaps I should be more specific.

How do i populate some fields in a table from a form, and other fields from 
session variables in the view  (or the template or the model if that was 
more appropriate)

many thanks,

aaron

On Tuesday, 24 June 2014 18:21:02 UTC+2, Aaron Reabow wrote:
>
> Hi Daniel,
>
> Thanks for the response. 
>
> What I am trying to get right is the ability to save session data across 
> multiple forms.
>
> In an initial form, people can tell me some generic information about 
> their department, role etc.
>
> It is then useful for me to save that information alongside their answers 
> in subsequent forms that they complete within a session.  (It helps me to 
> know who is who when I analyse their responses)
>
> I save a little session dictionary of their core information in URL1 and 
> am looking to add that information to the models that they complete in 
> URL2,3,4...
>
> I hope that makes some sense.
>
> warm regards,
>
> Aaron
>
> On Tuesday, 24 June 2014 18:04:16 UTC+2, Daniel Roseman wrote:
>>
>> On Tuesday, 24 June 2014 14:30:48 UTC+1, Aaron Reabow wrote:
>>>
>>> Hi All,
>>>
>>> I have been scratching around this for a bit now.
>>>
>>> Sometimes I *don't want people to have to register* on my site, but I 
>>> do want to *capture some information* about them and *reuse it across 
>>> multiple mini questionnaires/forms*.
>>>
>>> I can happily set and get a session variable using the session 
>>> 'dictionary'
>>>
>>> What I am trying to figure out is how to then use this information to 
>>> populate fields so I can know who is giving which answers.
>>>
>>> I could take the session variable and write this to the template, grab 
>>> this information in the template and write it to the input using jquery. 
>>>  This doesn't seem the most efficient way.
>>>
>>> I assume writing this information in the view would be optional, 
>>> alternatively is there a way to foreignkey type of approach.
>>>
>>> Also I am pretty new to django so i might be way off the mark..
>>>
>>> many thanks in advance,
>>>
>>> Aaron
>>>
>>> my view:
>>>
>>> def sessionStoreView(request):
>>> if request.method == "POST":
>>> form = sessionStoreForm(request.POST)
>>> if form.is_valid():
>>> model_instance = form.save(commit=False)
>>> *model_instance['participant'] 
>>> = request.session.get('participant') #something like that would be great if 
>>> it worked*
>>> model_instance.save()
>>> return HttpResponseRedirect('sessionStore')
>>> else:
>>> form = sessionStoreForm()
>>> return render(request, "sessionStore.html", {'form': form})
>>>
>>
>> Apart from the fact that model_instance is, well, a model instance, and 
>> therefore you access it via dot notation not dictionary notation, what 
>> exactly are you having trouble with here?
>> --
>> DR. 
>>
>

-- 
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/c43f521c-6765-457f-9fe1-6f851ebaae1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Time Zone Problem when following on tutorial

2014-06-25 Thread miked

It respects the settings.py time zone not the system locale.

This means your question needs to be addressed by someone smarter than 
me.


Sorry

Mike

On 2014-06-25 16:42, mi...@dewhirst.com.au wrote:

On 25/06/2014 7:44 AM, Jerry Wu wrote:> Thanks, Mike.


I still have a question. In your code, which part should I change in
order to set the time zone to Asia/Shanghai?


My settings uses Australia/Melbourne and Postgres stores time
correctly as UTC+10 (or UTC+11 in daylight saving time).

But as it happens I'm in New Zealand for a couple of days. So I'll
change my laptop location to Wellington tonight and log in and create
some test entries and knowing when I do that I should be able to check
the results after switching the laptop back to Melbourne time.

Now I think of it I could pretend I'm in Shanghai :)

You can see from the above that I half-believe pytz uses the system
locale to figure out the UTC offset. But I suppose it might be
TIME_ZONE in settings.

Have to go out now. I'll report back later

Mike




On Tuesday, June 24, 2014 7:26:52 AM UTC+8, Mike Dewhirst wrote:

On 24/06/2014 8:34 AM, Jerry Wu wrote:
 > Dear every one,
 >
 > I am following the tutorial
 > > and 
meet

with
 > some problem with Time Zone part. Since I am in Shanghai, China
(UTC+8)
 > , I think it is necessary to reset the time part.
 >
 > Below is what I tried but failed with valuerror incorrect
timezone setting:
 >
 > TIME_ZONE="UTC+8"
 > TIME_ZONE="UTC+8:00"
 >
 > I have tried "Asia/Shanghai", it works, but I think it is kind 
of

 > out-of-date style due to the description
 >

>


 > in the tutorial.

This a very good question. Especially considering the variability
between databases. At least I think so - I use Postgres and that 
seems

to store times in UTC. In my case it is accidentally just what I
want so
I'm not changing anything.

But just in case, I use the following utility everywhere ...

import pytz
from datetime import datetime

def when():
  return datetime.now(tz=pytz.utc)

I wish I understood (or had the time and brainspace to commit to
memory)
exactly how it all works. I think the target audience for the
documentation is somewhat smarter than I.

Mike
 >
 > Could some one give me a hint?
 >
 > Thans in advance.
 >


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


Re: Time Zone Problem when following on tutorial

2014-06-25 Thread miked

On 25/06/2014 7:44 AM, Jerry Wu wrote:> Thanks, Mike.


I still have a question. In your code, which part should I change in
order to set the time zone to Asia/Shanghai?


My settings uses Australia/Melbourne and Postgres stores time correctly 
as UTC+10 (or UTC+11 in daylight saving time).


But as it happens I'm in New Zealand for a couple of days. So I'll 
change my laptop location to Wellington tonight and log in and create 
some test entries and knowing when I do that I should be able to check 
the results after switching the laptop back to Melbourne time.


Now I think of it I could pretend I'm in Shanghai :)

You can see from the above that I half-believe pytz uses the system 
locale to figure out the UTC offset. But I suppose it might be TIME_ZONE 
in settings.


Have to go out now. I'll report back later

Mike




On Tuesday, June 24, 2014 7:26:52 AM UTC+8, Mike Dewhirst wrote:

On 24/06/2014 8:34 AM, Jerry Wu wrote:
 > Dear every one,
 >
 > I am following the tutorial
 > > and meet
with
 > some problem with Time Zone part. Since I am in Shanghai, China
(UTC+8)
 > , I think it is necessary to reset the time part.
 >
 > Below is what I tried but failed with valuerror incorrect
timezone setting:
 >
 > TIME_ZONE="UTC+8"
 > TIME_ZONE="UTC+8:00"
 >
 > I have tried "Asia/Shanghai", it works, but I think it is kind 
of

 > out-of-date style due to the description
 >

>


 > in the tutorial.

This a very good question. Especially considering the variability
between databases. At least I think so - I use Postgres and that 
seems

to store times in UTC. In my case it is accidentally just what I
want so
I'm not changing anything.

But just in case, I use the following utility everywhere ...

import pytz
from datetime import datetime

def when():
  return datetime.now(tz=pytz.utc)

I wish I understood (or had the time and brainspace to commit to
memory)
exactly how it all works. I think the target audience for the
documentation is somewhat smarter than I.

Mike
 >
 > Could some one give me a hint?
 >
 > Thans in advance.
 >


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