comment app with quote, like, etc

2012-07-23 Thread subin
Hi,
Is there django comment app with quote & like feature?
I have searching and found django-comments-xtd, django-threaded-comments,
and django-comment-apps. But none of them support 'like'.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How To Display Non-Modal Popup From Resulting Asynchronous Javascript Request

2012-07-23 Thread Tomas Neme
your error's got nothing to do with AJAX. As the very helpful error
message you're getting, there's no URL that matches your requested
path:

> Request URL:
>
> http://127.0.0.1:8000/mediahelp/mediaHelpPopup.html
>
>  Using the URLconf defined in streamingmedia.urls, Django tried these URL
> patterns, in this order:
> 1.^mymedia/
> 2.^mediaadmin/
> 3.^mediahelp/ ^$
> 4.^mediahelp/ ^comphelp/$
> 5.^admin/

I don't know where did you get the 'mediaHelpPopup.html' part of your
URL, but it's quite clear it doesn't match any of those urls you've
got set up.

So if you give us some more details on your idea for this popup, where
does the data come from, and why do you feel the need to make a call
to some phantom html file
(https://docs.djangoproject.com/en/1.4/topics/http/urls/, and
especially http://www.w3.org/Provider/Style/URI).

Basically, you need to have a view that renders your popup's HTML, and
that view needs to be linked to an URL.

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Difficulties using generic views (Tutorial 4, Django 1.4)

2012-07-23 Thread Carlos Palol
I'm glad.

Not very prone to randomness, actually. Make sure the web server is restarting 
after your changes, and that the browser cache is not lying to you.

Also, if you are changing module (file) names, better delete the .pyc files.

Cheers, 


Carlos Palol





On 23 Jul 2012, at 16:11, Ricardo Cardoso wrote:

> Oddly, when i started up the server this morning i could now see the polls 
> correctly, while not having changed my code, by accessing 
> http://127.0.0.1:8000/polls. Don't know if Django is prone to such randomness 
> but am happy that it works now. Tested everything, added a view so that 
> http://127.0.0.1:8000 loads polls, voted and viewed results. All fine.
> 
> I'll carry on testing this and getting a couple more tutorials done before 
> moving to my first django production.
> 
> Thank you for your time and patience Carlos, much appreciated.
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/CrRjT-ql1AMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How To Display Non-Modal Popup From Resulting Asynchronous Javascript Request

2012-07-23 Thread curious1


I have a django application already developed which I'm trying to use to 
experiment with asynchronous javascript without using any of the standard 
JQuery type libraries, in order to better learn and understand AJAX 
concepts. The application itself has been written using python 2.7.1 and 
django 1.2.4. My view just returns the "request.responseText" from the 
asynchronous javascript call returns text only from a django view (via 
"return HttpResponse(message)"). I would try to use the 
"render_to_response()" shortcut function, but then it doesn't seem like the 
javascript callback function would be needed or used, so I hesitate to do 
so. I would like to display the returned text data on a new non-modal popup 
screen (using window.open()) so that the user can view it, while still 
interacting with the main screen, from which the asynchronous javascript 
call was originally issued. However when I initiate the asynchronous call 
and the popup is displayed I'm getting a 404, because apparently the url 
that I'm supplying for the popup is in error in some way. The 404 verbage 
returned in the popup looks like this:


Page not found (404)

Request Method:

GET

Request URL:

http://127.0.0.1:8000/mediahelp/mediaHelpPopup.html

 Using the URLconf defined in streamingmedia.urls, Django tried these URL 
patterns, in this order: 
1.^mymedia/
2.^mediaadmin/
3.^mediahelp/ ^$
4.^mediahelp/ ^comphelp/$
5.^admin/
The current URL, mediahelp/mediaHelpPopup.html, didn't match any of these.
 
 
So far I've tried numerous variations for the popup's url with only 404's 
resulting. Do I need to return something other HttpResponse in my 
asynchronous view in order to get this to work? At this point since I'm 
rather new to attempting AJAX I'm just looking for the simplest solution 
for displaying the returned data in a non-modal popup. Can someone help or 
point me to a good and simple (using simple javascript only) tutorial for 
doing something like this?
 
 
 
 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/sCb_cY7QI3UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Checking if a dynamicallygenerated dropdown has a selected item

2012-07-23 Thread Sithembewena Lloyd Dube
Thanks Daniel :) Was just poring over the Formsets documentation now ...
looks like what I need.

I will update this thread with the results later.



On Mon, Jul 23, 2012 at 10:09 PM, Daniel Roseman wrote:

> On Monday, 23 July 2012 21:05:54 UTC+1, Lloyd Dube wrote:
>>
>> Hi all,
>>
>> I am not using django forms for this. I did think along the lines of
>> doing the following:
>> - implement the Question form, override __init__ in the model to return
>> answers for that question,
>> - instantiate a form for each question, set model=whatever_model_in_
>> current_loop and append it to a list,
>> - in the template, render them out
>>
>> ... but ...
>>
>> How would I then access the forms collection in my view, say, from
>> request.POST?
>>
>> I think I may be trying to reinvent a wheel here.
>>
>>
>>
> Yes. This is what formsets are for.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/1Y1zt0RYaLMJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-admin.py startproject mysite... this command does nothing for me

2012-07-23 Thread Ramiro Morales
On Mon, Jul 23, 2012 at 4:58 PM, boxxtcy  wrote:
> I tried without the .py, still doesn't do anything.  django-admin.py lives
> in my C:\Python27\Scripts  just as it is supposed to.  I don't really see
> what the issue is :/

Don't rely on the association of .py files with the Python interpeter
and executability of .py files features provided by the OS.

Simply specify the full path to the django-admin.py script
(and if needed, the full path to the Python interpeter).

As in:

python C:\Python27\Scripts\django-admin.py startproject foo

or

C:\Python27\python C:\Python27\Scripts\django-admin.py startproject foo

The basic concepts will always work. The above techniques will allow
you to execute script in any interpreted language on any platform.

HTH

-- 
Ramiro Morales

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Checking if a dynamicallygenerated dropdown has a selected item

2012-07-23 Thread Daniel Roseman
On Monday, 23 July 2012 21:05:54 UTC+1, Lloyd Dube wrote:
>
> Hi all,
>
> I am not using django forms for this. I did think along the lines of doing 
> the following:
> - implement the Question form, override __init__ in the model to return 
> answers for that question,
> - instantiate a form for each question, set model=whatever_model_in_
> current_loop and append it to a list,
> - in the template, render them out
>
> ... but ...
>
> How would I then access the forms collection in my view, say, from 
> request.POST?
>
> I think I may be trying to reinvent a wheel here.
>
>
>
Yes. This is what formsets are for.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/1Y1zt0RYaLMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Checking if a dynamicallygenerated dropdown has a selected item

2012-07-23 Thread Sithembewena Lloyd Dube
Hi all,

I am not using django forms for this. I did think along the lines of doing
the following:
- implement the Question form, override __init__ in the model to return
answers for that question,
- instantiate a form for each question, set model=whatever_model_in_
current_loop and append it to a list,
- in the template, render them out

... but ...

How would I then access the forms collection in my view, say, from
request.POST?

I think I may be trying to reinvent a wheel here.


On Mon, Jul 23, 2012 at 7:41 PM, Thomas Orozco wrote:

> Are you using django forms?
>
> Should be pretty straightforward once you have the input nicely formatted
> to just count the number of fields that have been filled in.
> Le 23 juil. 2012 19:01, "Babatunde Akinyanmi"  a
> écrit :
>
> Maybe I don't really understand the question but I think if you want
>> to check if the user has answered 3 questions, check from the keys in
>> request.GET or request.POST as the case may be.
>>
>> On 7/23/12, Sithembewena Lloyd Dube  wrote:
>> > Hi all,
>> >
>> > I have a dynamically generated dropdown in this fashion (when viewing
>> > source):
>> >
>> > 
>> >> > selected="selected">
>> >> > value="question_3_answer_7">a) Spend the majority of time
>> indoors
>> >> > value="question_3_answer_8">b) Value superior darkness and consider
>> in-car
>> > activation
>> >> > value="question_3_answer_9">c) Value indoor clarity over outdoor
>> > darkness
>> > 
>> >
>> > 
>> >> > selected="selected">
>> >> > value="question_3_answer_7">a) Spend the majority of time
>> indoors
>> >> > value="question_3_answer_8">b) Value superior darkness and consider
>> in-car
>> > activation
>> >> > value="question_3_answer_9">c) Value indoor clarity over outdoor
>> > darkness
>> > 
>> >
>> > How would one check, in a view, whether or not any of the dropdowns
>> have a
>> > selected item? I basically need to ensure that users answer at least 3
>> out
>> > of 5 questions?
>> >
>> > Thanks ...
>> > --
>> > Regards,
>> > Sithembewena Lloyd Dube
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>>
>> --
>> Sent from my mobile device
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Checking if a dynamicallygenerated dropdown has a selected item

2012-07-23 Thread Sithembewena Lloyd Dube
Hi all,

I am not using django forms for this. I did think along the lines of doing
the following:
- implement the Question form, override __init__ in the model to return
answers for that question,
- instantiate a form for each question, set
model=whatever_model_in_current_loop and append it to a list,
- in the template, render them out

... but ...

How wuld I then access the forms collection in my view, say, from
request.POST?

I think I may be trying to reinvent a wheel here.

On Mon, Jul 23, 2012 at 7:41 PM, Thomas Orozco wrote:

> Are you using django forms?
>
> Should be pretty straightforward once you have the input nicely formatted
> to just count the number of fields that have been filled in.
> Le 23 juil. 2012 19:01, "Babatunde Akinyanmi"  a
> écrit :
>
> Maybe I don't really understand the question but I think if you want
>> to check if the user has answered 3 questions, check from the keys in
>> request.GET or request.POST as the case may be.
>>
>> On 7/23/12, Sithembewena Lloyd Dube  wrote:
>> > Hi all,
>> >
>> > I have a dynamically generated dropdown in this fashion (when viewing
>> > source):
>> >
>> > 
>> >> > selected="selected">
>> >> > value="question_3_answer_7">a) Spend the majority of time
>> indoors
>> >> > value="question_3_answer_8">b) Value superior darkness and consider
>> in-car
>> > activation
>> >> > value="question_3_answer_9">c) Value indoor clarity over outdoor
>> > darkness
>> > 
>> >
>> > 
>> >> > selected="selected">
>> >> > value="question_3_answer_7">a) Spend the majority of time
>> indoors
>> >> > value="question_3_answer_8">b) Value superior darkness and consider
>> in-car
>> > activation
>> >> > value="question_3_answer_9">c) Value indoor clarity over outdoor
>> > darkness
>> > 
>> >
>> > How would one check, in a view, whether or not any of the dropdowns
>> have a
>> > selected item? I basically need to ensure that users answer at least 3
>> out
>> > of 5 questions?
>> >
>> > Thanks ...
>> > --
>> > Regards,
>> > Sithembewena Lloyd Dube
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>>
>> --
>> Sent from my mobile device
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-admin.py startproject mysite... this command does nothing for me

2012-07-23 Thread boxxtcy
I tried without the .py, still doesn't do anything.  django-admin.py lives 
in my C:\Python27\Scripts  just as it is supposed to.  I don't really see 
what the issue is :/

On Monday, July 23, 2012 2:59:18 PM UTC-4, Joel Goldstick wrote:
>
> On Mon, Jul 23, 2012 at 12:38 PM, boxxtcy  wrote: 
> > When trying to follow this tutorial, I get stuck after django-admin.py 
> > startproject mysite because no directory is created.  I doubt the 
> command is 
> > even being executed, all it brings up is the code in a notepad++ window. 
>  I 
> > have django installed properly because I can go to my python interpreter 
> and 
> > type 'import django' and print the version.  I have two different Python 
> > installs 2.6 and 2.7.3  I am using 2.7.3 and I no longer use 2.6.  Could 
> > having multiple versions of Python affect Django?  Please help! 
> > 
>
> Did you check all the caveats in the boxs below the initial 
> instructions?  sounds like django-admin.py isn't being run.  Try it 
> without the .py.  If that fails, see if you can find where it is and 
> if its in your path 
>
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/django-users/-/6qtT4QQ6FPQJ. 
> > To post to this group, send email to django-users@googlegroups.com. 
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com. 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>
>
>
> -- 
> Joel Goldstick 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/RAwHipg-OqoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to install psycopg2 using Pip?

2012-07-23 Thread Mehrdad Majzoobi
Ok, I realized what the issue was. In the setup.cfg file, the pg_config 
path had to include the pg_config executable name as well:

pg_config = /usr/pgsql-9.1/bin/pg_config

On Monday, July 23, 2012 2:01:29 PM UTC-5, Mehrdad Majzoobi wrote:
>
> Guys, I have a similar problem but the difference is pg_config is actually 
> in my PATH:
>
> $ which pg_config
> /usr/pgsql-9.1/bin/pg_config
>
> I get the following error when I try to pip install psychopg2
>
> ###
> Error: pg_config executable not found.
>
>
>
> Please add the directory containing pg_config to the PATH
>
> or specify the full executable path with the option:
>
>
>
> python setup.py build_ext --pg-config /path/to/pg_config build ...
>
>
>
> or with the pg_config option in 'setup.cfg'.
>
> 
> Command python setup.py egg_info failed with error code 1 in 
> /tmp/pip-build/psycopg2
>
> ###
>
> I tried adding pg_config path to the setup.cfg file and build it using the 
> source files I downloaded from their website and I get the following error 
> message!
>
> Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/'
>
>
> But it is actually THERE!!!
>
> I am baffled by these errors. Can anyone help please?
>
> By the way, I sudo all the commands. Also I am RHEL 5.5.
>
>
>
> On Thursday, March 24, 2011 11:18:23 AM UTC-5, Shawn Milochik wrote:
>>
>> On Thu, Mar 24, 2011 at 12:03 PM, Andre Lopes  
>> wrote:
>> > I have solved.
>> >
>> > I just edited "setup.cfg" on the psycopg2 and added:
>> >
>> > pg_config=C:\Program Files\PostgreSQL\8.4\bin\pg_config.exe
>>
>>
>> Yeah, that's the easiest method, but you specifically wanted to know
>> how to install it with pip. That way you have to install the module
>> manually. But it works. ;o)
>>
>> Shawn
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/T4W21ymaOwAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to install psycopg2 using Pip?

2012-07-23 Thread Mehrdad Majzoobi
Guys, I have a similar problem but the difference is pg_config is actually 
in my PATH:

$ which pg_config
/usr/pgsql-9.1/bin/pg_config

I get the following error when I try to pip install psychopg2

###
Error: pg_config executable not found.



Please add the directory containing pg_config to the PATH

or specify the full executable path with the option:



python setup.py build_ext --pg-config /path/to/pg_config build ...



or with the pg_config option in 'setup.cfg'.


Command python setup.py egg_info failed with error code 1 in 
/tmp/pip-build/psycopg2

###

I tried adding pg_config path to the setup.cfg file and build it using the 
source files I downloaded from their website and I get the following error 
message!

Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/'


But it is actually THERE!!!

I am baffled by these errors. Can anyone help please?

By the way, I sudo all the commands. Also I am RHEL 5.5.



On Thursday, March 24, 2011 11:18:23 AM UTC-5, Shawn Milochik wrote:
>
> On Thu, Mar 24, 2011 at 12:03 PM, Andre Lopes  
> wrote:
> > I have solved.
> >
> > I just edited "setup.cfg" on the psycopg2 and added:
> >
> > pg_config=C:\Program Files\PostgreSQL\8.4\bin\pg_config.exe
>
>
> Yeah, that's the easiest method, but you specifically wanted to know
> how to install it with pip. That way you have to install the module
> manually. But it works. ;o)
>
> Shawn
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/iq3tj3Qpj8AJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-admin.py startproject mysite... this command does nothing for me

2012-07-23 Thread Joel Goldstick
On Mon, Jul 23, 2012 at 12:38 PM, boxxtcy  wrote:
> When trying to follow this tutorial, I get stuck after django-admin.py
> startproject mysite because no directory is created.  I doubt the command is
> even being executed, all it brings up is the code in a notepad++ window.  I
> have django installed properly because I can go to my python interpreter and
> type 'import django' and print the version.  I have two different Python
> installs 2.6 and 2.7.3  I am using 2.7.3 and I no longer use 2.6.  Could
> having multiple versions of Python affect Django?  Please help!
>

Did you check all the caveats in the boxs below the initial
instructions?  sounds like django-admin.py isn't being run.  Try it
without the .py.  If that fails, see if you can find where it is and
if its in your path

> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/6qtT4QQ6FPQJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



-- 
Joel Goldstick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Two identical pages but only one works

2012-07-23 Thread Javier Guerra Giraldez
On Mon, Jul 23, 2012 at 1:20 PM, twelve_o_clock
 wrote:
> return render_to_response('micropost/micropost_list.html',
> {'mposts',mposts})

is that copy/paste?  check the dictionary syntax, it should be

{'mposts':mposts}

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Two identical pages but only one works

2012-07-23 Thread twelve_o_clock


I have a page that I want to list all users and another page which I want 
to use to list all microposts. The user page works fine but the micropost 
page does not work even though the two look like they are of an identical 
format. On the micropost page, I just get an empty table.

Here is part of views.py:

def list(request):
users = User.objects.all()
return render_to_response('micropost/list.html', {'users':users})

def micropost_list(request):
mposts = Micropost.objects.all()
return render_to_response('micropost/micropost_list.html', 
{'mposts',mposts})

Here is list.html:




List all Users




IDNameE-mail 
address
{% for u in users %}
  {{ u.id }}  {{ u.name }}  {{ u.email }} 

{% endfor %}




Here is micropost_list.html:




List all Microposts




IDContentDate 
Posted
{% for m in mposts %}
  {{ m.id }}  {{ m.content }}  {{ m.date }} 

{% endfor %}

{{ mposts }}



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/EMh7NmmsumwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



CSRF token missing or incorrect

2012-07-23 Thread twelve_o_clock


When I try to submit a form in my django project, I get an error saying, 
"CSRF token missing or incorrect," even though I put a "{% csrf_token %}" 
tag inside the form.

Here is signup.html:




Sign up




 {% csrf_token %}
 Name: 
 E-mail address: 
 Password: 
 




Here is a part of views.py:

def signup(request):
if request.method == 'POST':
user = User.new()
user.name = request.POST["name"]
user.email = request.POST["email"]
user.password = request.POST["password"]
return HttpResponse("User created")
else:
return render_to_response('micropost/signup.html')

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/3dj5GbXKavAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Checking if a dynamicallygenerated dropdown has a selected item

2012-07-23 Thread Thomas Orozco
Are you using django forms?

Should be pretty straightforward once you have the input nicely formatted
to just count the number of fields that have been filled in.
Le 23 juil. 2012 19:01, "Babatunde Akinyanmi"  a
écrit :

> Maybe I don't really understand the question but I think if you want
> to check if the user has answered 3 questions, check from the keys in
> request.GET or request.POST as the case may be.
>
> On 7/23/12, Sithembewena Lloyd Dube  wrote:
> > Hi all,
> >
> > I have a dynamically generated dropdown in this fashion (when viewing
> > source):
> >
> > 
> > > selected="selected">
> > > value="question_3_answer_7">a) Spend the majority of time
> indoors
> > > value="question_3_answer_8">b) Value superior darkness and consider
> in-car
> > activation
> > > value="question_3_answer_9">c) Value indoor clarity over outdoor
> > darkness
> > 
> >
> > 
> > > selected="selected">
> > > value="question_3_answer_7">a) Spend the majority of time
> indoors
> > > value="question_3_answer_8">b) Value superior darkness and consider
> in-car
> > activation
> > > value="question_3_answer_9">c) Value indoor clarity over outdoor
> > darkness
> > 
> >
> > How would one check, in a view, whether or not any of the dropdowns have
> a
> > selected item? I basically need to ensure that users answer at least 3
> out
> > of 5 questions?
> >
> > Thanks ...
> > --
> > Regards,
> > Sithembewena Lloyd Dube
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Checking if a dynamicallygenerated dropdown has a selected item

2012-07-23 Thread Babatunde Akinyanmi
Maybe I don't really understand the question but I think if you want
to check if the user has answered 3 questions, check from the keys in
request.GET or request.POST as the case may be.

On 7/23/12, Sithembewena Lloyd Dube  wrote:
> Hi all,
>
> I have a dynamically generated dropdown in this fashion (when viewing
> source):
>
> 
> selected="selected">
> value="question_3_answer_7">a) Spend the majority of time indoors
> value="question_3_answer_8">b) Value superior darkness and consider in-car
> activation
> value="question_3_answer_9">c) Value indoor clarity over outdoor
> darkness
> 
>
> 
> selected="selected">
> value="question_3_answer_7">a) Spend the majority of time indoors
> value="question_3_answer_8">b) Value superior darkness and consider in-car
> activation
> value="question_3_answer_9">c) Value indoor clarity over outdoor
> darkness
> 
>
> How would one check, in a view, whether or not any of the dropdowns have a
> selected item? I basically need to ensure that users answer at least 3 out
> of 5 questions?
>
> Thanks ...
> --
> Regards,
> Sithembewena Lloyd Dube
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't access members in a template

2012-07-23 Thread twelve_o_clock
That worked. Thanks for the help.

On Monday, July 23, 2012 9:50:07 AM UTC-7, Dmitry Zimnukhov wrote:

> Note, that u1 is not a model instance, but a QuerySet object 
> To get a model you should call manager's "get" method rather than "filter" 
> replace: 
> u1 = User.objects.filter(id=u) 
> with: 
> u1 = User.objects.get(id=u) 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/6Jd96LIUZ48J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django-admin.py startproject mysite... this command does nothing for me

2012-07-23 Thread boxxtcy
When trying to follow this 
tutorial, 
I get stuck after django-admin.py startproject mysite because no directory 
is created.  I doubt the command is even being executed, all it brings up 
is the code in a notepad++ window.  I have django installed properly 
because I can go to my python interpreter and type 'import django' and 
print the version.  I have two different Python installs 2.6 and 2.7.3  I 
am using 2.7.3 and I no longer use 2.6.  Could having multiple versions of 
Python affect Django?  Please help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/6qtT4QQ6FPQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Not able to run django-admin.py startproject on Windows 7

2012-07-23 Thread shm



Hi,

I am trying to create a new project to work on. Have installed python and 
Django and tested they are working (Was able to get the version numbers for 
both from the shell).
But, It doesn't let me run " django-admin.py startproject"

it gives me this error. It looks like it doesn't recognise the sub commands.



I read through some forums and some suggestion was given to create 
VirtualENV as sometimes python doesn't let us create projects under 
"site-packages" or more than one. Since it already has Django, I thought 
that could be the problem.

I also thought it would help have a home folder for my project seperate 
from the Python folder. 

So, I installed VirtualENV using "python setup.py install"

And then I went to the path where "virtualenv.py" is (that is 
C:\Python27\Lib\site-packages) and tried to create the VirtualENV by typing 
this - virtualenv.py C:\SHIYAM\Personal\MyFolder\SOWL0.1

where "SOWL0.1" is an empty folder. It says "You must provide a DEST_DIR"

Then I tried virtualenv.py C:\SHIYAM\Personal\MyFolder\SOWL0.1\SOWL

SOWL doesn't exist. In case if the script wants to create it. 

I got the same error.

Then I added the path (C:\Python27\Lib\site-packages) to the windows 
environment Variable.

Then went to the destination folder in CMD prompt - 
C:\SHIYAM\Personal\MyFolder\SOWL0.1\SOW.

and typed "virtualenv.py SOWL". I get the same error.

Not sure how to move forward with this.

Any help is much appreciated.

Thanks,

SHM











-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/e5Zd0YgtqpEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't access members in a template

2012-07-23 Thread Sithembewena Lloyd Dube
pardon, the closing 'for' tag would be {% endfor %}

On Mon, Jul 23, 2012 at 6:53 PM, Sithembewena Lloyd Dube
wrote:

> ^^ as above ...
>
> try ...
>
> 
> {% for user in u %}
> User ID{{user.id }}
> User Name{{user.name }}
> tr>
> User E-mail{{user.email}}
> Date/Time joined{{user.date}}
>
> {% end %}
> 
>
>
> On Mon, Jul 23, 2012 at 6:50 PM, Dmitry Zimnukhov wrote:
>
>> Note, that u1 is not a model instance, but a QuerySet object
>> To get a model you should call manager's "get" method rather than "filter"
>> replace:
>> u1 = User.objects.filter(id=u)
>> with:
>> u1 = User.objects.get(id=u)
>>
>> 2012/7/23 twelve_o_clock :
>> > I tried that and it still did not work. Also, {{u}} and {{i}} without
>> spaces
>> > works, but it doesn't work when I try to access the member of something
>> like
>> > {{ u.name }}.
>> >
>> > On Monday, July 23, 2012 9:14:24 AM UTC-7, Kurtis wrote:
>> >>
>> >> Try: {{ u.name }} (with spaces)
>> >>
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/django-users/-/8Xvau8WcTm8J.
>> >
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't access members in a template

2012-07-23 Thread Sithembewena Lloyd Dube
^^ as above ...

try ...


{% for user in u %}
User ID{{user.id }}
User Name{{user.name }}
User E-mail{{user.email}}
Date/Time joined{{user.date}}

{% end %}



On Mon, Jul 23, 2012 at 6:50 PM, Dmitry Zimnukhov wrote:

> Note, that u1 is not a model instance, but a QuerySet object
> To get a model you should call manager's "get" method rather than "filter"
> replace:
> u1 = User.objects.filter(id=u)
> with:
> u1 = User.objects.get(id=u)
>
> 2012/7/23 twelve_o_clock :
> > I tried that and it still did not work. Also, {{u}} and {{i}} without
> spaces
> > works, but it doesn't work when I try to access the member of something
> like
> > {{ u.name }}.
> >
> > On Monday, July 23, 2012 9:14:24 AM UTC-7, Kurtis wrote:
> >>
> >> Try: {{ u.name }} (with spaces)
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/8Xvau8WcTm8J.
> >
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't access members in a template

2012-07-23 Thread Dmitry Zimnukhov
Note, that u1 is not a model instance, but a QuerySet object
To get a model you should call manager's "get" method rather than "filter"
replace:
u1 = User.objects.filter(id=u)
with:
u1 = User.objects.get(id=u)

2012/7/23 twelve_o_clock :
> I tried that and it still did not work. Also, {{u}} and {{i}} without spaces
> works, but it doesn't work when I try to access the member of something like
> {{ u.name }}.
>
> On Monday, July 23, 2012 9:14:24 AM UTC-7, Kurtis wrote:
>>
>> Try: {{ u.name }} (with spaces)
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/8Xvau8WcTm8J.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't access members in a template

2012-07-23 Thread twelve_o_clock
I tried that and it still did not work. Also, {{u}} and {{i}} without 
spaces works, but it doesn't work when I try to access the member of 
something like {{ u.name }}.

On Monday, July 23, 2012 9:14:24 AM UTC-7, Kurtis wrote:

> Try: {{ u.name }} (with spaces)
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/8Xvau8WcTm8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Checking if a dynamicallygenerated dropdown has a selected item

2012-07-23 Thread Sithembewena Lloyd Dube
Hi all,

I have a dynamically generated dropdown in this fashion (when viewing
source):


   
   a) Spend the majority of time indoors
   b) Value superior darkness and consider in-car
activation
   c) Value indoor clarity over outdoor
darkness



   
   a) Spend the majority of time indoors
   b) Value superior darkness and consider in-car
activation
   c) Value indoor clarity over outdoor
darkness


How would one check, in a view, whether or not any of the dropdowns have a
selected item? I basically need to ensure that users answer at least 3 out
of 5 questions?

Thanks ...
-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't access members in a template

2012-07-23 Thread Kurtis Mullins
Try: {{ u.name }} (with spaces)

On Mon, Jul 23, 2012 at 10:35 AM, twelve_o_clock  wrote:

> I am trying to access data in a template in django. I have a variable u
> with members name, email, id, and date. However when I put {{u.name}} in
> a template, it doesn't appear in the HTML file even though just {{u}}
> appears just fine.
>
> For reference, here is the template:
>
> 
> 
> 
> View user {{ u.id }}
> 
> 
> 
> 
> User ID{{u.id}}
> User Name{{u.name}}
> User E-mail{{u.email}}
> Date/Time joined{{u.date}}
> 
> {{u}}
> {{i}}
> {{u.name}}
> 
> 
>
> and here is the function in views.py
>
> def user(request, u):
> u1 = User.objects.filter(id=u)
> return render_to_response('micropost/user.html', {'u':u1, 'i':u})
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/FyEy3rIU1LkJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: phpBB3 to DjangoBB migration...

2012-07-23 Thread jens

We improve the migration. Seems that the most work is done!

The last thing to migrate is the topic subscriptions, but django can't
handle the model. See: https://github.com/jedie/django-phpBB3/issues/5


On 20 Jul., 15:27, jens  wrote:
> Anyone who interest the migration from phpBB3 to DjangoBB should take
> a look at
> my project:
>
>        https://github.com/jedie/django-phpBB3

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Can't access members in a template

2012-07-23 Thread twelve_o_clock


I am trying to access data in a template in django. I have a variable u 
with members name, email, id, and date. However when I put {{u.name}} in a 
template, it doesn't appear in the HTML file even though just {{u}} appears 
just fine.

For reference, here is the template:




View user {{ u.id }}




User ID{{u.id}}
User Name{{u.name}}
User E-mail{{u.email}}
Date/Time joined{{u.date}}

{{u}}
{{i}}
{{u.name}}



and here is the function in views.py

def user(request, u):
u1 = User.objects.filter(id=u)
return render_to_response('micropost/user.html', {'u':u1, 'i':u})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/FyEy3rIU1LkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Image Cropping in template form

2012-07-23 Thread Nicolas Noé
Hi Patrick,

Did you find any solution to this issue ? I'm facing exactly the same 
problem... The widget is imported and assigned to the field without any 
error, but on rendering it works like a basic textfield. 

The markup look like the field is initially rendered correctly in HTML, but 
then the mandatory JavaScript code (jcrop, image_cropping.js & co) is not 
loaded executed here. At least that's what a quick comparison between the 
rendering of the Admin and the my frontend code shows.

Thanks in advance,

Nicolas

Le mercredi 4 avril 2012 23:16:34 UTC+2, Patrick Sweet a écrit :
>
> Hi folks, I'm hoping someone can help me with this. I can't get the 
> image_cropping widget to work in my template.
>
> I've installed django-image-cropping ( 
> https://github.com/jonasundderwolf/django-image-cropping ) and have set 
> up my models appropriately. It works absolutely perfect in the admin, but I 
> can't seem to get it to work with a front-end form in a template.
>
> Digging around for information, I've tried to import 
> image_cropping.widgets and assign the ImageCropWidget to the cropping 
> field, but the form field still shows up as a text input.
> *
> FROM Forms.py:*
> class ProfileForm(forms.ModelForm):
> class Meta:
> model = Candidate
> exclude = ('user')
> widgets = {
> 'cropping': ImageCropWidget(),
> }
>
> And in my template, I'm calling the form field directly, not "as_p" or 
> "as_table."
> *FROM form.html:*
> 
> {{ Form.cropping.errors }}
> {{ Form.cropping }}
> 
>
>
> Any help would be greatly appreciated.
>
> - Pat
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/czAi5KRFOfoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Difficulties using generic views (Tutorial 4, Django 1.4)

2012-07-23 Thread Ricardo Cardoso
Oddly, when i started up the server this morning i could now see the polls 
correctly, while not having changed my code, by accessing 
http://127.0.0.1:8000/polls. Don't know if Django is prone to such 
randomness but am happy that it works now. Tested everything, added a view 
so that http://127.0.0.1:8000 loads polls, voted and viewed results. All 
fine.

I'll carry on testing this and getting a couple more tutorials done before 
moving to my first django production.

Thank you for your time and patience Carlos, much appreciated.




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/CrRjT-ql1AMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Variable # of fields in a form

2012-07-23 Thread Alex Strickland

On 2012/07/23 02:29 PM, Alex Strickland wrote:


Thank you Daniel. I have done this and see that it answers my question
(that HTML output is pretty ugly!). In Bootstrap I have used an
accordion so that the the categories are grouped:

Internal
 x Evan
 x Joe
External
 x Alex

where x's are checkboxes and only one of Internal or External would be
expanded at any one time. Do you have a recommendation as to how break
up this CheckboxSelectMultiple widget into groups (also variable)?


https://docs.djangoproject.com/en/dev/topics/forms/formsets/ ?

--
Regards
Alex

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Variable # of fields in a form

2012-07-23 Thread Alex Strickland

On 2012/07/20 01:37 PM, Daniel Roseman wrote:


You don't want a variable number of fields, you just want a single
MultipleChoiceField field using a CheckboxSelectMultiple widget.

https://docs.djangoproject.com/en/1.4/ref/forms/fields/#multiplechoicefield
https://docs.djangoproject.com/en/1.4/ref/forms/widgets/#checkboxselectmultiple


Thank you Daniel. I have done this and see that it answers my question 
(that HTML output is pretty ugly!). In Bootstrap I have used an 
accordion so that the the categories are grouped:


Internal
x Evan
x Joe
External
x Alex

where x's are checkboxes and only one of Internal or External would be 
expanded at any one time. Do you have a recommendation as to how break 
up this CheckboxSelectMultiple widget into groups (also variable)?


I know I am digging my own grave...

--
Regards
Alex

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-23 Thread Cal Leeming [Simplicity Media Ltd]
Hi Alex,

Yup - video will be made available - although I may ask if anyone here with
a Vimeo/Youtube Director account would mind uploading it instead..
Otherwise the video will need splitting :/

Cal

On Mon, Jul 23, 2012 at 7:54 AM, Alex  wrote:

> Hello!
>
> Will you make the video available after the webcast?
>
>
> Thanks.
>
>
> On Saturday, June 30, 2012 7:10:27 PM UTC+4, Cal Leeming [Simplicity Media
> Ltd] wrote:
>>
>> Hi all,
>>
>> As some of you know, I did a live webcast last year (July 2011) on our
>> LLG project, which explained how we overcome some of the problems
>> associated with large data processing.
>>
>> After reviewing the video, I found that the sound quality was very
>> poor, the slides weren't very well structured, and some of the information
>> is now out of date (at the time it was 40mil rows, now we're dealing with
>> 700+mil rows).
>>
>> Therefore, I'm considering doing another live webcast (except this time
>> it'll be recorded+posted the next day, the stream will be available in
>> 1080p, it'll be far better structured, and will only last 50 minutes).
>>
>> The topics I'd like to cover are:
>>
>> * Bulk data processing where bulk_insert() is still not viable (we went
>> from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still
>> using the ORM - no raw sql here!!)
>> * Applying faux child/parent relationship when standard ORM is too
>> expensive (allows for ORM approach without the cost)
>> * Applying faux ORM read-only structure to legacy applications (allows
>> ORM usage on schemas that weren't properly designed, and cannot be changed
>> - for example, vendor software with no source code).
>> * New Relic is beautiful, but expensive. Hear more about our plans to
>> make an open source version.
>> * Appropriate use cases for IAAS vs colo with SSDs.
>> * Percona is amazing, some of the tips/tricks we've learned over.
>>
>> If you'd like to see this happen, please leave a reply in the thread - if
>> enough people want this, then we'll do public vote for the scheduled date.
>>
>> Cheers
>>
>> Cal
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/x7P21YF3MM4J.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Difficulties using generic views (Tutorial 4, Django 1.4)

2012-07-23 Thread Carlos Palol
Let's see the whole error page.


On Sunday, 22 July 2012 23:43:59 UTC+2, Ricardo Cardoso wrote:
>
> Thank you for your input guys. 
>
> Sadly, i had already checked it Carlos and have my templates for polls 
> under:
> /home/my_user/Webdev/Templates/polls
>
> In this case my template dir is set up as:
> /home/my_user/Webdev/Templates/
>
> Should i create another polls dir under templates 
> (/home/my_user/Webdev/Templates/polls/polls) considering in the error 
> message i get 'polls/poll_list.html' , besides 'index.html'? This seems 
> redundant and i'd like to understand why i would have to. 
>
> Thanks again for your help.
>
> On Thursday, July 19, 2012 12:08:39 AM UTC+1, Ricardo Cardoso wrote:
>>
>> I'm new to django and python, and decided to follow up the available 
>> tutorials to get up to speed. These were helpful and got me on my feet but 
>> while finishing up the tutorial i hit a major snag. While everything was 
>> working properly using custom views, i can't seem to make my app load the 
>> correct templates after switching to generic views.
>>
>> Here's the code:
>>
>> #urls.py
>> from django.conf.urls import patterns, include, url
>> from django.views.generic import DetailView, ListView
>> from polls.models import Poll
>>
>> urlpatterns = patterns('',
>> url(r'^$',
>> ListView.as_view(
>> queryset=Poll.objects.order_by('-pub_date')[:5],
>> context_object_name='latest_poll_list',
>> template_name='polls/index.html')),
>> url(r'^(?P\d+)/$',
>> DetailView.as_view(
>> model=Poll,
>> template_name='polls/detail.html')),
>> url(r'^(?P\d+)/results/$',
>> DetailView.as_view(
>> model=Poll,
>> template_name='polls/results.html'),
>> name='poll_results'),
>> url(r'^(?P\d+)/vote/$', 'polls.views.vote'),
>> )
>>
>> The way i decided (perhaps wrongly) to organize my apps and templates is 
>> as follows:
>>
>> Template dir as defined in settings.py:
>> TEMPLATE_DIRS = ('/home/my_user/Webdev/Templates/', # this is where i'm 
>> storing my templates at the moment
>>
>> App location: /home/my_user/Webdev/Django-lessons/pollproject/polls
>>
>> If i try to access the polls app directly by using the URL: 
>> http://127.0.0.1:8000/polls/ i now get an error message stating that:
>>
>> TemplateDoesNotExist at /polls/ 
>>
>> index.html, polls/poll_list.html
>>
>>
>>
>> I realize this might have something to do with where i decided to store 
>> my templates (made more sense at the time to store them separately since i 
>> thought i could use different templates for the same app, for different 
>> purposes).
>>
>> This is probably a basic issue but any help regarding this would be 
>> greatly appreciated.
>>
>> Thanks!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Xn2AVhifd2MJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django TypeError

2012-07-23 Thread bruno desthuilliers
On Tuesday, July 17, 2012 8:00:39 AM UTC+2, sandy wrote:
>
> I want to have different views for my application for different types 
> of users. For this I have this code for my views.py file : 
>
> def index1(request): 
> u = User.objects.all() 
>

This has been solved.
 

> if u.is_staff ==1 and u.is_active == 1 and u.is_superuser == 1: 
>


User.is_staff, User.is_active and User.is_superuser already have a boolean 
value, so you don't need to test against 1 (or True etc).

if u.is_staff  and u.is_active and u.is_superuser : 


 

> return render_to_response('tcc11_12/index1.html', 
> context_instance=RequestContext(request)) 
> elif u.is_staff == 1 and u.is_active == 1 and u.is_superuser == 0: 
>


You only have one different predicate here, so you could factor your tests:


 if u.is_staff  and u.is_active:
 if u.is_superuser : 
 return render_to_response('tcc11_12/index1.html', 
context_instance=RequestContext(request))
 else:
 return render_to_response('tcc11_12/index2.html', 
context_instance=RequestContext(request)) 
 else: 
 return 
render_to_response('index3.html',context_instance=RequestContext(request)) 


Note that if only the template change, you could avoid multiple returns too:
 
 template = 'index3.html' # default
 if u.is_staff  and u.is_active:
 template = 'tcc11_12/index1.html' if u.is_superuser else  
'tcc11_12/index2.html'
 
 return 
render_to_response(template,context_instance=RequestContext(request)) 


Also, if you're using request.user as the user *and the default 
authentication backend and auth form*, only "active" users should be able 
to log in, so your test on 'is_active' _may_ (or not !) be just useless:

https://docs.djangoproject.com/en/1.3/topics/auth/#django.contrib.auth.models.User.is_active

HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/r11xbhdW5fAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-23 Thread Alex
Hello!

Will you make the video available after the webcast?


Thanks.

On Saturday, June 30, 2012 7:10:27 PM UTC+4, Cal Leeming [Simplicity Media 
Ltd] wrote:
>
> Hi all,
>
> As some of you know, I did a live webcast last year (July 2011) on our LLG 
> project, which explained how we overcome some of the problems associated 
> with large data processing.
>
> After reviewing the video, I found that the sound quality was very 
> poor, the slides weren't very well structured, and some of the information 
> is now out of date (at the time it was 40mil rows, now we're dealing with 
> 700+mil rows).
>
> Therefore, I'm considering doing another live webcast (except this time 
> it'll be recorded+posted the next day, the stream will be available in 
> 1080p, it'll be far better structured, and will only last 50 minutes).
>
> The topics I'd like to cover are:
>
> * Bulk data processing where bulk_insert() is still not viable (we went 
> from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still 
> using the ORM - no raw sql here!!)
> * Applying faux child/parent relationship when standard ORM is too 
> expensive (allows for ORM approach without the cost)
> * Applying faux ORM read-only structure to legacy applications (allows ORM 
> usage on schemas that weren't properly designed, and cannot be changed - 
> for example, vendor software with no source code).
> * New Relic is beautiful, but expensive. Hear more about our plans to make 
> an open source version.
> * Appropriate use cases for IAAS vs colo with SSDs.
> * Percona is amazing, some of the tips/tricks we've learned over.
>
> If you'd like to see this happen, please leave a reply in the thread - if 
> enough people want this, then we'll do public vote for the scheduled date.
>
> Cheers
>
> Cal
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/x7P21YF3MM4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: What does this error mean?

2012-07-23 Thread Russell Keith-Magee
I'll bet good money that one of the things you are assuming is true,
is in fact wrong.

You say that "His other requests in the same session have a user and
group". The evidence you're showing demonstrates that, for whatever
reason, in *this* request, the user *doesn't* have a group.

Unfortunately, nobody but you can determine exactly what is going on.
It's time to spend some quality time with your debugging tools.

Yours,
Russ Magee %-)

On Mon, Jul 23, 2012 at 10:31 AM, ydjango  wrote:
> But user is logged in and authenticated. His other requests in same session
> has user and group. Why would few ajax calls not have it?
>
>
> On Sunday, July 22, 2012 4:39:21 PM UTC-7, Russell Keith-Magee wrote:
>>
>> On Mon, Jul 23, 2012 at 5:30 AM, ydjango wrote:
>> >
>> >
>> > [Django] ERROR (EXTERNAL IP): Internal Server Error:
>> >
>> >
>> >File
>> > "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py",
>> > line
>> > 111, in get_response
>> > response = callback(request, *callback_args, **callback_kwargs)
>> >
>> >   File "/home/ubuntu/webapps/myapp/core/views.py", line 7048, in
>> > loadmydata
>> > my_group, my_address, my_url, my_name=
>> > get_info_from_session(request)
>> >
>> >   File "/home/ubuntu/webapps/myapp/core/myutility.py", line 343, in
>> > get_info_from_session
>> > my_group = request.user.groups.all()[0].id
>> >
>> >   File
>> > "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>> > line 173, in __getitem__
>> > return self._result_cache[k]
>> >
>> > IndexError: list index out of range
>> >
>> > I get email from django with the  above error on above line. The
>> > application
>> > works fine. I do not notice any error on screen. I also do not see error
>> > in
>> > firebug in the network calls. The the view which contains above line is
>> > called from AJAX calls. I am logged into app and authenticated.
>> >
>> > Using Django 1.3.1 and Python 2.6
>> >
>> > I can ignore these emails. But any clue what can be causing it?
>>
>> What is causing the error? Exactly what the error message says: You're
>> requesting a specific list index. That index is out of range.
>>
>> Looking at the stack trace, you're trying to retrieve:
>>
>> request.user.groups.all()[0]
>>
>> The error is being raised when there *isn't* an element 0 -- that is,
>> when a user has no groups.
>>
>> Yours,
>> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/SXTXfrRmUBwJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.