Help needed in constructing __in query

2014-08-04 Thread Subodh Nijsure
I have two tables as shown below. class AlertTable(models.Model): id = models.AutoField(primary_key=True) alarm_text = models.CharField(max_length=800,blank=False,null=False) event_type = models.SmallIntegerField(blank=False,null=False) created = models.DateTimeField() class Me

Re: Foreign key User on migration‏

2014-08-04 Thread Sam Contapay
I downloaded the latest code from stable/1.7.x branch and this problem no longer exists. On Monday, August 4, 2014 8:06:00 AM UTC-7, Sam Contapay wrote: > > Hi, > > I tried adding a foreign key to a model in a Django app I'm building to > learn 1.7. I am using Python 3.4 and Django 1.7c2 > > #bl

Re: html response before saving object

2014-08-04 Thread pylo...@gmail.com
> > - does the product exist? > Yes, - is the cart_item really not created? (or is the cart the thing not being > created?) > The cartItem is created, but it shown if I request again the url 1) request: /cart/?add=productslug 2) response: without the new item 3) request : /cart/ 4) response: th

Re: html response before saving object

2014-08-04 Thread Collin Anderson
database save is not async. a few possibilities: - does the product exist? - is the cart_item really not created? (or is the cart the thing not being created?) - is the prefetch_related pre-caching the related cart items, so in the template it doesn't see the new item? (hint: redirect to the sam

html response before saving object

2014-08-04 Thread pylo...@gmail.com
Hi Guys, I've update my site from django 1.3 to 1.5 The site works fine, except for a view, the template renders before the obj.save() in the view: def cart(request): try: cart = Cart.objects.prefetch_related('cartitem_set__product__category').get(id=request.session['cart_id'])

Re: deploying django

2014-08-04 Thread Adrian Marshall
I've went through a few different ways. If your set on using apache, Configure Apache with Mod-WSGI on a server. Here's a Good Tutorial: http://thecodeship.com/deployment/deploy-django-apache-virtualenv-and-mod_wsgi/ If you're having trouble with that and your app isn't too demanding you can e

Django - Login from Android

2014-08-04 Thread Adrian Marshall
I have a Django app up and running and It's more mobile based than a web app. I'm new to development with both Django and Android. I've setup an API using Django-Tasty pie and I can get JSON data from my models,including the user model that comes with Django. I've implemented logging in function

Re: Redirect with string?

2014-08-04 Thread Lachlan Musicman
Collin, worked a charm - thankyou! L. On 1 August 2014 22:51, Lachlan Musicman wrote: > Thanks Collin, I'll test on Monday > L. > > On 1 August 2014 22:47, Collin Anderson wrote: >> redirect is a django shortcut for an http redirect response, not a file/pipe >> redirect. You need to use a python

Re: Changing website version written in python+django

2014-08-04 Thread Jagger
Hi Clifford, Thanks for your detailed answer. Regards, Zoli > Hi Zoli, > > I'm assuming that you're not using virtualenv right now. The best way to > do this is to use virtualenv, virtualenwrapper, and a revision control > system like Mercurial. The workflow goes something like this. > > m

Re: unsupported opperand type(s)

2014-08-04 Thread Collin Anderson
If you have no data that is important, I'd just delete the database and start fresh. If you're using sqlite you can simply `rm db.sqlite3` and then run python manage.py migrate again. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscr

Re: unsupported opperand type(s)

2014-08-04 Thread Mariusz Wilk
Django-1.6.5 W dniu poniedziałek, 4 sierpnia 2014 13:34:41 UTC+1 użytkownik Collin Anderson napisał: > > What version of django are you using? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Javascript loading while executing backend python query.

2014-08-04 Thread Collin Anderson
You are saying you have a div with id="loading" with the image in it that is not being shown? loading image here -- 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

Re: How to Construct a View with multiple and singular objects?

2014-08-04 Thread Collin Anderson
Do you get an error if you wrap it in an if statement? {% if object.sub_object %}{{ object.sub_object }}{% endif %} -- 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

Javascript loading while executing backend python query.

2014-08-04 Thread G Z
Hi I'm trying to write a loading script that displays a loading image while the django backend queries i have written are exectuting. This is to say i have some very complicated sql queries i call mannually with python by watching for specific post from the webpage to execute different queries.

Re: What is the difference between running manage.py and ./manage.py?

2014-08-04 Thread Malik Rumi
Thanks for the clarification! On Sunday, August 3, 2014 9:16:01 PM UTC-5, Lachlan Musicman wrote: > > Not really, it's a Nix thing (ie, OSX and BSD as well as linux). > > Basically, if you set the file to be executable (chmod +x) then > ./filename is a way of executing using the default file ass

How to Construct a View with multiple and singular objects?

2014-08-04 Thread Malik Rumi
I have a model with numerous objects. However, some of these objects have sub-objects and some do not. When calling up an object with sub-objects, (linked by a foreign key) I’d like to display Object 1.Sub object 2.Sub object And when the user requests an object with no subs, they

Foreign key User on migration‏

2014-08-04 Thread Sam Contapay
Hi, I tried adding a foreign key to a model in a Django app I'm building to learn 1.7. I am using Python 3.4 and Django 1.7c2 #blog/models.py from django.contrib.auth.models import User from django.db import models class Comment(models.Model): user = models.ForeignKey(User, blank=True, nul

Re: unsupported opperand type(s)

2014-08-04 Thread Collin Anderson
What version of django are you using? -- 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 emai

Re: deploying django

2014-08-04 Thread Collin Anderson
I'd start by reading the docs on deploying with apache and mod_wsgi https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails fr

Re: Get latest timestamp+value from each group

2014-08-04 Thread Collin Anderson
Or if you have a "latest" boolean, that would also work. -- 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 th

Re: Please help:ImportError: No module named django

2014-08-04 Thread Collin Anderson
in the python shell try running: import sys sys.path -- 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

Re: How to modify subpackage in django project

2014-08-04 Thread Collin Anderson
I recommend not messing with sys.modules. Does your huge package not have any other way to override things? Is there a smaller package that you can use instead? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: Image upload problem with UserProfile and my form

2014-08-04 Thread Collin Anderson
Set MEDIA_URL to '/media/' or something. Then add static() to your urls.py if you haven't. https://docs.djangoproject.com/en/dev/howto/static-files/#serving-files-uploaded-by-a-user-during-development -- You received this message because you are subscribed to the Google Groups "Django users" g

Re: unsupported opperand type(s)

2014-08-04 Thread Mariusz Wilk
Kinda worked. I deleted my Poll objects and created a new one. But then, a few more lines into the tutorial, there are these commands one after another: p = Poll.objects.get(pk=1) p.choice_set.all() I get: *OperationalError: no such column: polls_choice.choice_text* It should be simply: []

deploying django

2014-08-04 Thread ngangsia akumbo
I have created a complete site, i have configured it to run with mysql using wamp i have also configured apache in wamp which is up and running so i want to deploy the site to run as a life page on the internet using apache what should i do next -- You received this message because you are

Re: How to use send_mail function.

2014-08-04 Thread Andreas Kuhne
Hi Chen, Check this post: http://stackoverflow.com/questions/15985191/how-can-i-send-e-mail-from-django-using-the-google-smtp-server I think you are missing the settings for secure SMTP (which google requires). Regards, Andréas 2014-08-04 9:42 GMT+02:00 Chen Xu : > Hi Everyone, > I am trying

How to use send_mail function.

2014-08-04 Thread Chen Xu
Hi Everyone, I am trying to send emails from gmail, I know I can do it if I put the following in settings.py: EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'exam...@gmail.com' EMAIL_HOST_PASSWORD = 'password' But I wonder if I dont specify them, and call it in the following