RE: Submit a form but stay on the page and the form changes

2013-07-12 Thread Babatunde Akinyanmi
I'm assuming you want the form to morph on the screen without a page reload. If that's the case, you need JavaScript like jQuery. let the view you are submitting your POST to return the data you need in JSON and use jQuery to remove the form and add the results or url Sent from my Windows Phone --

RE: 'SimpleLazyObject'

2013-07-12 Thread Babatunde Akinyanmi
How about changing this: Bookmark.objects.get_or_create( user = request.user, link = link ) To this: Bookmark.objects.get_or_create( user = request.user.id, link = link ) Sent from my Windows Phone ---

how to display image on a template

2013-07-12 Thread sah
hi , here is my view for getting image : I am using a stringIO buffer for temporary storage of the image file and then rendering it to the html . def my_image(request): from matplotlib import pyplot as plt buffer = cStringIO.StringIO() width = 0.5 males = int(Mice.object

Re: Submit a form but stay on the page and the form changes

2013-07-12 Thread Cody Scott
The code works, I can submit the form and go back to the page I came from with the HTTP_REFERER , what I need help is getting the form to change, to be the results. For the syntax highlighting I submit my code to bpaste and then copy into the message here. On Fri, Jul 12, 2013 at 10:43 AM, Sergi

Re: Django Project/App Folder Hierarchy Ambiguity

2013-07-12 Thread Ramiro Morales
On Fri, Jul 12, 2013 at 6:18 PM, Nkansah Rexford wrote: > My problem is the one in the question on the site. the Second answer is the > solution. > > I'm using django 1.5.1 > > My problem is the same as the one on the site If you are copying your code from the question verbatim the problem is in

Re: Chapter 5 problems

2013-07-12 Thread Randy Baxley
randy@randy-Inspiron-530s:~/dj/mfp/mysite$ sqlite3 /home/dj/mfp/mysite/mysite/mydb.db SQLite version 3.7.9 2011-11-01 00:52:41 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> but at least now I know I have SQLite3 though I did not before you asked that question.

Re: Django Project/App Folder Hierarchy Ambiguity

2013-07-12 Thread Nkansah Rexford
My problem is the one in the question on the site. the Second answer is the solution. I'm using django 1.5.1 My problem is the same as the one on the site -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: image rendering on the template

2013-07-12 Thread sahitya pavurala
however if i directly return the value i get the image .But i need to render the image to a different page . How can i do this ? -- 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, s

Re: Django Project/App Folder Hierarchy Ambiguity

2013-07-12 Thread Ramiro Morales
On Fri, Jul 12, 2013 at 5:38 PM, Nkansah Rexford wrote: > I'm new to Django, and for the past 2 days, I've been struggling with the > ImportError thing until I came across this useful answer that solved my > problem I don't see an answer there. I see one questions and three answers. It would be

Django Project/App Folder Hierarchy Ambiguity

2013-07-12 Thread Nkansah Rexford
I'm new to Django, and for the past 2 days, I've been struggling with the ImportError thing until I came across this useful answerthat solved my problem Though its not a bug, can the hierarchy be be

image rendering on the template

2013-07-12 Thread sahitya pavurala
hi , here is my view for getting image : I am using a stringIO buffer for temporary storage of the image file and then rendering it to the html . def my_image(request): from matplotlib import pyplot as plt buffer = cStringIO.StringIO() width = 0.5 males = int(Mice.objects

Re: Chapter 5 problems

2013-07-12 Thread John
Can you open the file using sqlite on the command line: # sqlite3 /home/dj/mfp/mysite/mydb.db John On 12/07/13 21:08, Randy Baxley wrote: > permissions for randy on mydb.db are read and write. > > > On Fri, Jul 12, 2013 at 3:05 PM, Jonathan Baker > mailto:jonathandavidba...@gmail.com>> > wrote:

Re: Chapter 5 problems

2013-07-12 Thread Randy Baxley
permissions for randy on mydb.db are read and write. On Fri, Jul 12, 2013 at 3:05 PM, Jonathan Baker < jonathandavidba...@gmail.com> wrote: > Does the file have the correct permissions? > > > On Fri, Jul 12, 2013 at 2:03 PM, Randy Baxley wrote: > >> that has been my first and my last variations

Re: Chapter 5 problems

2013-07-12 Thread Jonathan Baker
Does the file have the correct permissions? On Fri, Jul 12, 2013 at 2:03 PM, Randy Baxley wrote: > that has been my first and my last variations but it is still throwing the > same error. > > > On Fri, Jul 12, 2013 at 1:55 PM, John wrote: > >> 'NAME' doesn't look like a path to a sqlite database

Re: Chapter 5 problems

2013-07-12 Thread Randy Baxley
that has been my first and my last variations but it is still throwing the same error. On Fri, Jul 12, 2013 at 1:55 PM, John wrote: > 'NAME' doesn't look like a path to a sqlite database file. I'd expect it > to look more like: > > 'NAME': '/home/dj/mfp/mysite/mydb.db' > > John > > On 12/07/13

Re: 'SimpleLazyObject'

2013-07-12 Thread Kakar Arunachal Service
Here's the traceback info: Environment: Request Method: POST Request URL: http://localhost:8000/save/ Django Version: 1.5.1 Python Version: 2.7.5 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib

Re: 'SimpleLazyObject'

2013-07-12 Thread Sithembewena Lloyd Dube
What does the trace information say in your browser (or shell)? The trace should be giving more information - such as, in which line number of which file is the error showing up?. On Fri, Jul 12, 2013 at 8:45 PM, Kakar Arunachal Service < kakararunachalserv...@gmail.com> wrote: > I've got a Type

Re: Chapter 5 problems

2013-07-12 Thread John
'NAME' doesn't look like a path to a sqlite database file. I'd expect it to look more like: 'NAME': '/home/dj/mfp/mysite/mydb.db' John On 12/07/13 19:33, Randy Baxley wrote: > randy@randy-Inspiron-530s:~/dj/mfp/mysite$ python manage.py shell > Python 2.7.3 (default, Apr 10 2013, 05:46:21) > [GC

'SimpleLazyObject'

2013-07-12 Thread Kakar Arunachal Service
I've got a TypeError: int() argument must be a string or a number, not 'SimpleLazyObject' Here's my view: def bookmark_save_page(request): if request.method == 'POST': form = BookmarkSaveForm(request.POST) if form.is_valid(): # Create or get link. lin

Chapter 5 problems

2013-07-12 Thread Randy Baxley
randy@randy-Inspiron-530s:~/dj/mfp/mysite$ python manage.py shell Python 2.7.3 (default, Apr 10 2013, 05:46:21) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from django.db import connection >>> cursor = connection.cursor() Tr

Re: Unable to get python manage.py runserver to work

2013-07-12 Thread Nigel Legg
You need to create a project before you do anything. The docs and tutorials show you how to so it . On 12 Jul 2013 18:51, "Yves S. Garret" wrote: > On Friday, July 12, 2013 1:48:13 PM UTC-4, Yves S. Garret wrote: >> >> >> On Friday, July 12, 2013 5:18:58 AM UTC-4, Tom Evans wrote: >>> >>> On Fri,

Re: Unable to get python manage.py runserver to work

2013-07-12 Thread Yves S. Garret
On Friday, July 12, 2013 1:48:13 PM UTC-4, Yves S. Garret wrote: > > > On Friday, July 12, 2013 5:18:58 AM UTC-4, Tom Evans wrote: >> >> On Fri, Jul 12, 2013 at 4:01 AM, Yves S. Garret >> wrote: >> > I was able to import django from inside of python 2.6.6 (which is what >> I'm >> > going with

Re: Unable to get python manage.py runserver to work

2013-07-12 Thread Yves S. Garret
On Friday, July 12, 2013 5:18:58 AM UTC-4, Tom Evans wrote: > > On Fri, Jul 12, 2013 at 4:01 AM, Yves S. Garret > > wrote: > > I was able to import django from inside of python 2.6.6 (which is what > I'm > > going with > > at the moment). However, when I try to display something in a browser

Re: form.errors

2013-07-12 Thread Kakar Arunachal Service
Okay. Thank you so very much! Just one last question, just to know that i got it right. So, variables and return are not part of the else clause, and that they return the errors of the last form post. Did i got it right? On Fri, Jul 12, 2013 at 8:41 PM, Daniel Roseman wrote: > On Friday, 12 July

Re: form.errors

2013-07-12 Thread Daniel Roseman
On Friday, 12 July 2013 14:27:31 UTC+1, Kakar wrote: > Okay! That did solved the problem. Thank you! Here's my new view.py: > > def register_page(request): > if request.method == 'POST': > form = RegistrationForm(request.POST) > if form.is_valid(): > user = User.obj

Re: Submit a form but stay on the page and the form changes

2013-07-12 Thread Sergiy Khohlov
Hello Cody, I would like to help. 1 ) could you please check if POST is going from your browser to django (I hope yes) 2) First candidate for investigation is function post in class PollFormMixin I 'm proposing verify this by adding print "form status", form.is_valid() after string for

ForeignKey field access appears to be lazy evaluated

2013-07-12 Thread Sebastian Haase
Hello, I've implemented a tree-like structure in my model. My items have foreign key fields to the respective left and right neighbor. If I'm now trying to move an item one position forward it appears that the assigning of neighbors gets messed up. In my example I have an initial item order like

Re: form.errors

2013-07-12 Thread Kakar Arunachal Service
Okay! That did solved the problem. Thank you! Here's my new view.py: def register_page(request): if request.method == 'POST': form = RegistrationForm(request.POST) if form.is_valid(): user = User.objects.create_user( username=form.cleaned_data['usern

Issue with custom LogEntries action_flag

2013-07-12 Thread Alexandre Voiney
Hi there, I tried to save a LogEntry with a custom action_flag (4), but I faced an issue when I try to see it in the admin panel. Here is my issue : TypeError at /admin/admin/logentry/14/ > coercing to Unicode: need string or buffer, __proxy__ found Seems that i can't print this LogEntry, e

Re: how can an abstract class know which class inherits it

2013-07-12 Thread Sergiy Khohlov
Look like it is task for OOP list ;-) But I hope next can help you class ParentClass(object): def __init__(self, name): print "Constructor parent" print "Called from ", name class ChildClass(ParentClass): def __init__(self): super(ChildClass,self).__init__("Child")

Re: Unable to get python manage.py runserver to work

2013-07-12 Thread Tom Evans
On Fri, Jul 12, 2013 at 4:01 AM, Yves S. Garret wrote: > I was able to import django from inside of python 2.6.6 (which is what I'm > going with > at the moment). However, when I try to display something in a browser, this > is the > problem that I'm getting: > > $ python /path/to/file/manage.py

Re: Total number of flags on a comment (django.contrib.comment)

2013-07-12 Thread Daniel Roseman
On Wednesday, 10 July 2013 16:27:16 UTC+1, surya wrote: > I am using Django 1.4.5, using django.contrib.comments.. > Is there any field or model method that gives total number of flags on a > comment? > > CommentFlag is related to Comment by a ForeignKey, so you can use the normal aggregation m

Re: form.errors

2013-07-12 Thread Daniel Roseman
On Thursday, 11 July 2013 23:08:25 UTC+1, Kakar wrote: > Hi, > I am learning Django from an old Django version book, and i am stuck with > a problem regarding forms. When i render forms, i get the registration > right, but if its incorrect, it does not show the error msg in the html. I > tried