standalone server

2011-02-08 Thread rahul jain
Hi Guys,

I would like to create a standalone server using django environment which
accepts/receive inputs through socket connections. After that some
processing and then updating the database.

I created one python server and set the environment variable  but I figured
out that as soon as something goes wrong, server crashes and then I have to
manually re-run the server. So was not reliable at all.

Please if someone worked on these kind of issues before where you would like
to accept connections from outside not web request, but would like to
receive some data from outside through sockets then please let me know how
to best deal with it.

thanks.

Rahul

-- 
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 should I properly impliment HTTP(S) auth (REMOTE_AUTH) in django?

2011-02-08 Thread Eric Chamberlain
I wouldn't consider using a UUID as multi-factor authentication.

All our API traffic is over https.  We use the basic authentication included 
with django-piston.

Any reason why you want to exchange username and password for an API Key?  Why 
not just authenticate each request with username and password?



On Feb 8, 2011, at 5:37 PM, Sean W wrote:

> This is a re-post of my stack overflow question here 
> http://stackoverflow.com/questions/4939908/how-should-i-properly-impliment-https-auth-remote-auth-in-django
> 
> Hi,
> 
> I am in the planning phase a new project. I want to be able to control 
> multiple relays from my android powered phone over the internet. I need to 
> use an HTTP based server as a middleman between the phone and the relays. 
> Django is my preferred platform because Python is my strongest skill set. 
> This would not be a "web app" (with the exception of the admin interface for 
> managing the user and their access to the relays). Rather, the server would 
> simply provide an API in the form of HTTPS requests and JSON encoding. 
> Though, I should note that I have never done any web development in my life, 
> so I don't know best practices (yet). The authentication method should meet 
> the following criteria:
> 
> Works over HTTPS (self-signed SSL)
> Provides multi-factor authentication (in the form of something you have and 
> something you know)
> Be reasonably secure (Would be very difficult to fool, guess at. or otherwise 
> bypass)
> Is simple in implementation for the server operator and end user on the 
> mobile client
> Is lightweight in in terms of both CPU cycles and bandwidth
> 
> I plan to use the following scheme to solve this:
> 
> An administrator logs into the web interface, creates a user, and sets up 
> his/her permissions (including a username and a password chosen by the user).
> The user starts the client, selects add server, and enters the server URL and 
> his/her credentials.
> The client attempts to authenticate the the user via HTTP auth (over SSL). If 
> the authentication was successful, the server will generate an API key in the 
> form of a UUID and sends it to the client. The client will save this key and 
> use it in all API calls over HTTPS. HTTP auth is only used for the initial 
> authentication process prior to reviving a key, as a session scheme would not 
> be nessessary for this application. Right? The client will only work if the 
> phone is configured to automatically lock with a PIN or pattern after a short 
> timeout. The server will only allow one key to be generated per user, unless 
> an administrator resets the key. Hence, simple, mobile, multifactor 
> authentication.
> Is this sound from a security standpoint? Also, can anyone point me to an 
> example of how to use the HTTP auth that is built into Django? From a Google 
> search, I can find a lot of snipits witch hack the feature together. But, 
> none of them implement HTTP auth in the wayit was added to Django in 1.1. The 
> official documentation for REMOTE_AUTH can be found here, but I am having 
> difficulty understanding the documentation as I am very new to Django.
> 

-- 
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: No POST response when using checkbox form

2011-02-08 Thread Ethan Yandow
How bad of an Idea is it to not use Django forms?  I feel like Django forms
are kinda a pain

On Fri, Feb 4, 2011 at 12:06 PM, Tom Evans  wrote:

> On Fri, Feb 4, 2011 at 4:20 PM, Shawn Milochik  wrote:
> > Here's the main piece:
> > http://docs.djangoproject.com/en/1.2/ref/forms/
> > Just make a form with a boolean field.
> > When you've successfully made one form that you submit, validate, and act
> > upon, just throw a bunch in a formset:
> > http://docs.djangoproject.com/en/1.2/topics/forms/formsets/
> > If you get stuck along the way, paste the full error messages and sample
> > code.
> > Shawn
> >
>
> If the fields are semanticly related, then that advice makes a lot of
> sense. However if they are disparate options, and the only thing that
> relates them is that they are boolean options, then it may be easier
> to do this as a single form, with a ChoiceField that uses a
> CheckboxSelectMultiple widget:
>
> QUESTIONS = (
>( 'cheese', 'Do you like cheese?' ),
>( 'meat', 'Do you eat meat?' ),
>( 'stupid', 'Do you like inane questions?' ),
>  )
>
> class QuestionnaireForm(forms.Form):
>  questions = forms.MultipleChoiceField(choices=QUESTIONS,
>  required=False,
>  label='Please answer these questions',
> widget=forms.CheckboxSelectMultiple(),)
>
> Cheers
>
> Tom
>
> --
> 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: Django login() and authenticate() functions

2011-02-08 Thread Shawn Milochik
I think the documentation on creating your own authorization backend is 
what you need.


http://docs.djangoproject.com/en/1.2/topics/auth/#writing-an-authentication-backend

It's very simple to do, and you can do it however you want. For example, 
it would take you about five minutes to write one that authorizes the 
username and password against a Gmail account or your own database.


Shawn

--
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: Looking for IDE + FTP

2011-02-08 Thread broz
I've been curious about workflow with Django sites (or other
frameworks for that matter). I LOVE being able to remote edit. I can
see where this request is coming from. If I want to edit a file on the
server, I just open it up on my local machine, edit, and save. The
SFTP transfer all happens behind the scenes. This is very efficient.
There are no risks. I am editing a test instance. I do use version
control, but that's not what this is about.

In order to work on my code locally, I need to have a system set up
locally that mimics the remote system. So, I need to have a running
database, and a web server, and some other pieces and parts. My local
instance will not match the remote instance, ever. The remote uses
virtual hosts, the local one does not. The remote is an older version
of apache. The remote uses Oracle. Perhaps I could set my local system
up with old apache, and old Oracle. The remote server is remote, so
there's performance issues to consider.

I can set something up locally, fiddle, fuss, make it work, and then
ship the changes to the server. Whoa, it doesn't work on the server,
because my local system is just not the same.

This is why I want to remote edit my files. I want to test on a test
instance on the same server that will run the production version when
I'm done. And that's what I do with BBEdit.

BBEdit does remote editing very very well. It's not an IDE.

With BBEdit, I open the file, edit, test, edit, test.

PyCharm is a great IDE, but it doesn't remote edit. I download, I open
the file, I edit, save, upload, test, edit, save, upload, test, edit,
save, upload, test. Pydev works this way too. Wingware, I donno.
Komodo? I donno.

I would welcome enthusiastically, some recommendations on workflow,
given the constraints of the IDEs we have. There are lots of people
out there smarter than me.

Thanks for bringing up this topic!

Broz

On Feb 8, 8:32 pm, Łukasz Rekucki  wrote:
> On 9 February 2011 02:03, Karen McNeil  wrote:
>
> > So... that's a no, then?
>
> > I mean, about the question I asked.  You know, the "is there an IDE +
> > FTP program" question?
>
> Quotinghttp://www.aptana.org/products/studio2:
>
> File Transfer & Synchronization
> Support for one-shot as well as keep-synchronized setups. Multiple
> protocols including FTP, SFTP and FTPS. Ability to automatically
> publish your application to selected ISPs and hosting services.
>
> >    - I *do* do a very simple kind of version control, where I save a
> > numbered copy of the major site files
> >      whenever I've made changes and I've got a stable, working site.
> > I've looked into Subversion and Git and,
> >      believe me, they would be way overkill for my little projects.
>
> Version control is never an overkill, if the setup is so simple (like
> in Git or Mercurial - that git init doesn't really cost you anything).
> Plus it solves 3 major problems:
>
> 1) Keeping history for your own sanity. Too many times I seen people
> go crazy over code that "suddenly stoped working even if I revert the
> change".
>
> 2) Backups - pushing your code to remote sites like Bitbucket or
> Github is a great way, to make sure you don't lose or your work.
>
> 3) Deployment - Instead of uploading stuff via FTP, you can just push
> your changes to the site. This wil proably require some more knowledge
> about VCS, but it will save lots of time.
>
> --
> Łukasz Rekucki

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



ANN: Security releases issued

2011-02-08 Thread James Bennett
Tonight the Django team has released updated versions of Django 1.2
and Django 1.1 to correct multiple security issues reported to us.

* Details in the blog post here:
http://www.djangoproject.com/weblog/2011/feb/08/security/

* Download updated versions of Django here:
http://www.djangoproject.com/download/

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

-- 
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 should I properly impliment HTTP(S) auth (REMOTE_AUTH) in django?

2011-02-08 Thread ivan sugiarto
greetings,
a year ago I had the same problem and did not found any solution, after that
i started to build my own HTTP(S) single sign on using PHP (but recently i
ported on the Django) with the work flow like this

login :
clients (consumer) check the credential server using hidden iframe
server (single sign on) check whether the browser has the session and check
whether the clients is on the database using hashed api key
if it has the session server send (via post ) user credential without
password (username, role, email etc)/but also i provided the username using
csv that can be modified to json
clients check if the request ip is from the server if yes then the post
parameters is accepted
servers redirects user to server (hidden iframe)
the clients created the session

you can check it on

https://github.com/ivansugi/django-single-sign-on--soekarno-

i hope it match your requirement

On Wed, Feb 9, 2011 at 8:37 AM, Sean W  wrote:

> This is a re-post of my stack overflow question here
> http://stackoverflow.com/questions/4939908/how-should-i-properly-impliment-https-auth-remote-auth-in-django
>
>   Hi,
>
> I am in the planning phase a new project. I want to be able to control
> multiple relays from my android powered phone over the internet. I need to
> use an HTTP based server as a middleman between the phone and the relays.
> Django is my preferred platform because Python is my strongest skill set.
> This would not be a "web app" (with the exception of the admin interface for
> managing the user and their access to the relays). Rather, the server would
> simply provide an API in the form of HTTPS requests and JSON encoding.
> Though, I should note that I have never done any web development in my life,
> so I don't know best practices (yet). The authentication method should meet
> the following criteria:
>
>- Works over HTTPS (self-signed SSL)
>- Provides multi-factor authentication (in the form of something you
>have and something you know)
>- Be reasonably secure (Would be very difficult to fool, guess at. or
>otherwise bypass)
>- Is simple in implementation for the server operator and end user on
>the mobile client
>-
>
>Is lightweight in in terms of both CPU cycles and bandwidth
>
>I plan to use the following scheme to solve this:
>1. An administrator logs into the web interface, creates a user, and
>   sets up his/her permissions (including a username and a password chosen 
> by
>   the user).
>   2. The user starts the client, selects add server, and enters the
>   server URL and his/her credentials.
>   3. The client attempts to authenticate the the user via HTTP auth
>   (over SSL). If the authentication was successful, the server will 
> generate
>   an API key in the form of a UUID and sends it to the client. The client 
> will
>   save this key and use it in all API calls over HTTPS. HTTP auth is only 
> used
>   for the initial authentication process prior to reviving a key, as a 
> session
>   scheme would not be nessessary for this application. Right? The client 
> will
>   only work if the phone is configured to automatically lock with a PIN or
>   pattern after a short timeout. The server will only allow one key to be
>   generated per user, unless an administrator resets the key. Hence, 
> simple,
>   mobile, multifactor authentication.
>
> Is this sound from a security standpoint? Also, can anyone point me to an
> example of how to use the HTTP auth that is built into Django? From a Google
> search, I can find a lot of snipits witch hack the feature together. But,
> none of them implement HTTP auth in the wayit was added to Django in 
> 1.1.
> The official documentation for REMOTE_AUTH can be found 
> here,
> but I am having difficulty understanding the documentation as I am very new
> to Django.
>
>  --
> 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.
>



-- 
ketika anda mentok, anda bisa memutar atau maju terus, tapi tidak mundur

Ivan Sugiarto Widodo, ST
Commander In Chief
PT Widodo Rekayasa Komputasi
http://ivan-sugi.blogspot.com
http://wirekom.co.id

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



Django login() and authenticate() functions

2011-02-08 Thread Ethan Yandow
How can I use these functions to login and authenticate with my own
database?  I was trying to look for it in the documentation but it
doesn't seem to have the answer.

-- 
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 Populate A Dropdown List

2011-02-08 Thread Brian Neal
On Feb 8, 10:03 am, hank23  wrote:
> I have coded a form which will display some data in a dropdown
> selection box. The data is being populated from a a queryset that I
> have setup in the form's code. However the entries in the dropdown
> only display as objects of the table from which they're being
> retrieved, and don't display the actual field data that I was hoping
> to have it display. So how do I specify in the form which of the table
> fields is to be the display field and which is suppoed to be the
> underying key value to be passed when and entry is selected? Thanks
> for the help.

Post your code somewhere, e.g. dpaste.com so we have a better idea
what you are trying to do.

Best,
BN

-- 
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: pip django-registration fork install

2011-02-08 Thread Álex González
I've solved it creating a new virtualenv, if anybody knows the error, please
tell me!

On Wed, Feb 9, 2011 at 02:46, Álex González  wrote:

> Hi guys! I receive a strange errror when I try to get my pip pacakges:
>
> (lukkom_env)alex@big:~/lukkom_env/lukkom$ pip freeze|grep registration
> -e hg+Not trusting file
> /home/alex/lukkom_env/lib/src/django-registration/.hg/hgrc from untrusted
> user root, group root
> Not trusting file
> /home/alex/lukkom_env/lib/src/django-registration/.hg/hgrc from untrusted
> user root, group root@Not trusting file
> /home/alex/lukkom_env/lib/src/django-registration/.hg/hgrc from untrusted
> user root, group root
> Not trusting file
> /home/alex/lukkom_env/lib/src/django-registration/.hg/hgrc from untrusted
> user root, group root
> 394#egg=django_registration-0.8_alpha_1-py2.6-dev
>
> I did:
>
>1. Change my local django-registration
>2. Made a commit to my django-registration fork
>3. Erased my local django-registration
>4. Install it again, but as root because I can't as a normal user
>
> Anyone know why this problem?
> --
> @agonzalezro 
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx
>



-- 
@agonzalezro 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

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



pip django-registration fork install

2011-02-08 Thread Álex González
Hi guys! I receive a strange errror when I try to get my pip pacakges:

(lukkom_env)alex@big:~/lukkom_env/lukkom$ pip freeze|grep registration
-e hg+Not trusting file
/home/alex/lukkom_env/lib/src/django-registration/.hg/hgrc from untrusted
user root, group root
Not trusting file /home/alex/lukkom_env/lib/src/django-registration/.hg/hgrc
from untrusted user root, group root@Not trusting file
/home/alex/lukkom_env/lib/src/django-registration/.hg/hgrc from untrusted
user root, group root
Not trusting file /home/alex/lukkom_env/lib/src/django-registration/.hg/hgrc
from untrusted user root, group root
394#egg=django_registration-0.8_alpha_1-py2.6-dev

I did:

   1. Change my local django-registration
   2. Made a commit to my django-registration fork
   3. Erased my local django-registration
   4. Install it again, but as root because I can't as a normal user

Anyone know why this problem?
-- 
@agonzalezro 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
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: E-commerce site

2011-02-08 Thread Kenneth Gonsalves
On Tue, 2011-02-08 at 05:53 -0800, Arun K.Rajeevan wrote:
> The one e-commerce solution I found and looks promising is Stachmo 
>  http://www.satchmoproject.com/
> which is django based. 

go for it - it is developed by people with a long history of developing
e-commerce sites in a variety of platforms before they came to django
and they know what they are doing.
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Fabfile for a multi-server project

2011-02-08 Thread mack the finger
I'm working on building a fabric deployment for a project with a
fairly complex environment. There will be 2+ app servers running
django code, a few database servers running in some kind of master/
slave configuration, a rabbitmq server, a mail server, some load
balancers, etc. There will be over 12 different machines at least. My
question is how should I write fabric scripts for all these servers? I
realize this isn't a fabric group, but I imagine there are a lot of
people here who have used fabric extensively, and fabric doesn't have
its own group...

Right now I plan on having a separate repository for both server
config files and deployment scripts, and another separate repo for the
django application code. The deploy repo will have a 'deploy' folder,
and then inside that folder there will be an 'app' folder, containing
the fabfile for apt-get installing, as well as pip installing all
requirements for the app server. I'll also have a 'db' folder which
will contain a fabfile with a task for apt-get installing postgres, a
task for copying over postgres config files, etc. Eventually, I'll
have a separate folder for each type of server, with it's own fabfile.

Is this the right way?  Does it make much sense to have it split up
like that? Would it be easier to have one fab file for all different
servers?

-- 
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 should I properly impliment HTTP(S) auth (REMOTE_AUTH) in django?

2011-02-08 Thread Sean W
This is a re-post of my stack overflow question here 
http://stackoverflow.com/questions/4939908/how-should-i-properly-impliment-https-auth-remote-auth-in-django

  Hi,

I am in the planning phase a new project. I want to be able to control 
multiple relays from my android powered phone over the internet. I need to 
use an HTTP based server as a middleman between the phone and the relays. 
Django is my preferred platform because Python is my strongest skill set. 
This would not be a "web app" (with the exception of the admin interface for 
managing the user and their access to the relays). Rather, the server would 
simply provide an API in the form of HTTPS requests and JSON encoding. 
Though, I should note that I have never done any web development in my life, 
so I don't know best practices (yet). The authentication method should meet 
the following criteria:

   - Works over HTTPS (self-signed SSL)
   - Provides multi-factor authentication (in the form of something you have 
   and something you know)
   - Be reasonably secure (Would be very difficult to fool, guess at. or 
   otherwise bypass)
   - Is simple in implementation for the server operator and end user on the 
   mobile client
   - 
   
   Is lightweight in in terms of both CPU cycles and bandwidth
   
   I plan to use the following scheme to solve this:
   1. An administrator logs into the web interface, creates a user, and sets 
  up his/her permissions (including a username and a password chosen by the 
  user).
  2. The user starts the client, selects add server, and enters the 
  server URL and his/her credentials.
  3. The client attempts to authenticate the the user via HTTP auth 
  (over SSL). If the authentication was successful, the server will 
generate 
  an API key in the form of a UUID and sends it to the client. The client 
will 
  save this key and use it in all API calls over HTTPS. HTTP auth is only 
used 
  for the initial authentication process prior to reviving a key, as a 
session 
  scheme would not be nessessary for this application. Right? The client 
will 
  only work if the phone is configured to automatically lock with a PIN or 
  pattern after a short timeout. The server will only allow one key to be 
  generated per user, unless an administrator resets the key. Hence, 
simple, 
  mobile, multifactor authentication.
   
Is this sound from a security standpoint? Also, can anyone point me to an 
example of how to use the HTTP auth that is built into Django? From a Google 
search, I can find a lot of snipits witch hack the feature together. But, 
none of them implement HTTP auth in the wayit was added to Django in 
1.1. 
The official documentation for REMOTE_AUTH can be found 
here, 
but I am having difficulty understanding the documentation as I am very new 
to Django.

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Łukasz Rekucki
On 9 February 2011 02:03, Karen McNeil  wrote:
> So... that's a no, then?
>
> I mean, about the question I asked.  You know, the "is there an IDE +
> FTP program" question?

Quoting http://www.aptana.org/products/studio2:

File Transfer & Synchronization
Support for one-shot as well as keep-synchronized setups. Multiple
protocols including FTP, SFTP and FTPS. Ability to automatically
publish your application to selected ISPs and hosting services.

>    - I *do* do a very simple kind of version control, where I save a
> numbered copy of the major site files
>      whenever I've made changes and I've got a stable, working site.
> I've looked into Subversion and Git and,
>      believe me, they would be way overkill for my little projects.

Version control is never an overkill, if the setup is so simple (like
in Git or Mercurial - that git init doesn't really cost you anything).
Plus it solves 3 major problems:

1) Keeping history for your own sanity. Too many times I seen people
go crazy over code that "suddenly stoped working even if I revert the
change".

2) Backups - pushing your code to remote sites like Bitbucket or
Github is a great way, to make sure you don't lose or your work.

3) Deployment - Instead of uploading stuff via FTP, you can just push
your changes to the site. This wil proably require some more knowledge
about VCS, but it will save lots of time.


-- 
Łukasz Rekucki

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Karen McNeil
So... that's a no, then?

I mean, about the question I asked.  You know, the "is there an IDE +
FTP program" question?

Although, to assuage everyone's concerns:

-- I do have a development site that I use to test any significant
changes before I put them on the live site. The point that I was
trying to make was that I *like* being about to upload the changes
(which I've already tested on the development site) as I'm going
along, from within the same program that I'm coding in.  Also, in DW
I'm able to have several files all open at once, each in a separate
tab.  And, if I want to look at a different file (either on the local
site or the remote site), the folder tree is right there so I can open
up whatever I want without having to switch programs.
-- The "live" site is pretty much my personal playground, so if I
accidentally break something for a few minutes it doesn't really
matter.
-- I *do* do a very simple kind of version control, where I save a
numbered copy of the major site files whenever I've made changes and
I've got a stable, working site. I've looked into Subversion and Git
and, believe me, they would be way overkill for my little projects.
-- I exercise regularly and eat all my vegetables.
-- I would rather poke my eyes out than use vim.

:-)  Karen

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Karen McNeil
So... that's a no, then?

I mean, about the question I asked.  You know, the "is there an IDE +
FTP program" question?

Although, to assuage everyone's concerns:
- I do have a development site that I use to test any significant
changes before I put them on the live site.
  The point that I was trying to make was that I *like* being
about to upload the changes (which I've already
  tested on the development site) as I'm going along, from within
the same program that I'm coding in.  Also,
  I like having several files all open at once in Dreamweaver,
each in a separate tab.  And, if I want to check
  out a different file, the folder tree is right there so I can
open up whatever I want without having to switch
  programs.
- The "live" site is pretty much my personal playground, so if I
accidentally break something for a few minutes
  it doesn't really matter.
- I *do* do a very simple kind of version control, where I save a
numbered copy of the major site files
  whenever I've made changes and I've got a stable, working site.
I've looked into Subversion and Git and,
  believe me, they would be way overkill for my little projects.
- I exercise regularly and eat all my vegetables.
- I would rather poke my eyes out than use vim.

:-) Karen

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Rainy


On Feb 8, 3:30 pm, Karen McNeil  wrote:
> I have three Django sites that I've been working on recently and I've
> been doing most of the development work in Dreamweaver.  I don't use
> any of the wysiwyg features (or, pretty much, any of the Dreamweaver
> program features), but I like it because I can do all the the code
> edits and the FTP transfers all in one program.  I like being able to
> grab a remote file, make some code changes, save and upload all at
> once, and view a nice graphical display of the file structure for the
> local and remote sites.
>
> Problem is, Dreamweaver's code view is definitely not built for
> Python, and it doesn't look like they have any plans to support it any
> time in the foreseeable future.  Which means that I get no color-
> coding of the code, and I'm constantly getting indentation errors.
>
> I've always had Dreamweaver on my computer (a Mac) and so have never
> used a separate FTP program, and the only IDE I've ever used is IDLE.
> I used IDLE when I was first learning Python, but now that I'm working
> with the websites, I find it much more convenient to just open the
> files from within DW.  Does anyone know of another, Python-friendly,
> program that I could use for both code-editing and ftp?
>
> Thanks,
> Karen

I recommend Gvim, although it takes time to configure and tune
it. As for uploading, simply run a devserver locally and then after
a few days (or a week) of work, upload everything in bulk, perhaps
using a version control system. Basic use of version control is
actually
very easy to pick up and the nice bonus is that you can clean up
code as needed, deleting parts that you don't use anymore, without
fear of losing them: you can always go back in history and retrieve
it. This leads to cleaner code IME.

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Eric Chamberlain

On Feb 8, 2011, at 12:30 PM, Karen McNeil wrote:

> I have three Django sites that I've been working on recently and I've
> been doing most of the development work in Dreamweaver.  I don't use
> any of the wysiwyg features (or, pretty much, any of the Dreamweaver
> program features), but I like it because I can do all the the code
> edits and the FTP transfers all in one program.  I like being able to
> grab a remote file, make some code changes, save and upload all at
> once, and view a nice graphical display of the file structure for the
> local and remote sites.
> 
> Problem is, Dreamweaver's code view is definitely not built for
> Python, and it doesn't look like they have any plans to support it any
> time in the foreseeable future.  Which means that I get no color-
> coding of the code, and I'm constantly getting indentation errors.
> 
> I've always had Dreamweaver on my computer (a Mac) and so have never
> used a separate FTP program, and the only IDE I've ever used is IDLE.
> I used IDLE when I was first learning Python, but now that I'm working
> with the websites, I find it much more convenient to just open the
> files from within DW.  Does anyone know of another, Python-friendly,
> program that I could use for both code-editing and ftp?
> 

I use BBEdit.

--
Eric Chamberlain, Founder
RF.com - http://RF.com/







-- 
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: Slow performance with Django when connected to Oracle

2011-02-08 Thread Ian
On Feb 8, 3:15 pm, dw314159  wrote:
> I am observing the same behavior in the Django shell. Here the actual
> query runtime is about the same between Oracle and PostgreSQL back-
> ends, but the total turnaround time is about 18 times longer with
> Oracle. I believe the following code demonstrates this case:
>
> from django.db import connection
> import minilims.log.models as log
> import time
> time_list = []
> for n in range(0, 20):
>  t1 = time.time()
>  entries = log.Param.objects.filter(log = 6).order_by('stuff', 'id')
>  entry = [x for x in entries]
>  t2 = time.time()
>  time_list.append(t2 - t1)
> print len(connection.queries), 'queries ran.'
> average_time = sum(time_list) / len(time_list)
> # display minimum, average, and maximum turnaround time
> print min(time_list), average_time, max(time_list)
> # display average query time
> print sum([float(x['time']) for x in connection.queries]) /
> len(connection.queries)
>
> The above code in the shell using a PostgreSQL backend reports:
>
> >>> # display minimum, average, and maximum turnaround time
> >>> print min(time_list), average_time, max(time_list)
>
> 0.203052997589 0.211852610111 0.234575033188
>
> >>> # display average query time
> >>> print sum([float(x['time']) for x in connection.queries]) / 
> >>> len(connection.queries)
>
> 0.0557
>
> However, running the same code with an Oracle back-end, after
> restarting the shell, results in:
>
> >>> # display minimum, average, and maximum turnaround time
> >>> print min(time_list), average_time, max(time_list)
>
> 3.59030008316 3.64263659716 4.33223199844
>
> >>> # display average query time
> >>> print sum([float(x['time']) for x in connection.queries]) / 
> >>> len(connection.queries)
>
> 0.05825
>
> Any ideas?

What does the model look like, and how many rows does your query
return?  The Oracle backend has to do some extra processing over the
data to get its results into the expected format.  This may be what
you're seeing, although I would be surprised if it is really
dominating the query time by that much.  LOB columns can also slow the
backend down significantly, since we have to make extra round-trips to
the database to read their contents.  Neither of these things would be
included in the recorded query time.

If your model includes LOB columns or has a large number of fields,
then your best bet is probably to use QuerySet.defer() or
QuerySet.only() to limit the fields returned to those that are
specifically of interest.

-- 
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: Class-based views & authentication

2011-02-08 Thread Russell Keith-Magee
On Tue, Feb 8, 2011 at 11:34 PM, Pascal Germroth  wrote:
> Hi,
>
> I'm new to Django, but since this project will take a while I'm already
> using 1.3 alpha since it will probably be released when I'm done…
>
> As I understand it, the preferred method now are class-based views. But
> I seem to be missing some kind of AuthenticationMixin… right now, have
> to override `dispatch`, add the authentication decorator as one would
> for function views, and call super.
>
> To make things a bit easier, I'm about to write my own mixin for that so
> I only have to provide a method that checks if credentials are OK.
>
>
> Or am I doing this completely wrong?

You're not doing anything wrong -- you've hit one of the slightly
sharp corners of class-based generic views.

You can still use a decorator -- but at the point of deploying a view.

login_required(MyView.as_view())

You can't decorate the MyView class itself -- Django doesn't provide
the tools to turn a view decorator into a class decorator.

As you've noticed, you can override the dispatch to decorate the view
as required, and if you have a common authentication pattern, you can
put that logic into a mixin.

In a general sense, the problem that Django has as a project is that
while login_required is a very common decorator for checking
authentication, it isn't the *only* decorator that can be used.

Authentication -- and decorating views in general -- is a fairly
common patterns, though, so we obviously need to do something to
address this. There have been a couple of discussions about the best
way to implement that feature. However, these discussions are a work
in progress. In the interim, a mixin is probably the best approach.

Yours,
Russ Magee %-)

-- 
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: default header template file

2011-02-08 Thread Shawn Milochik
The reason you should use the toolbar is that it will help you
instantly determine which templates are being used, so you know which
ones to edit.

Shawn

-- 
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 Populate A Dropdown List

2011-02-08 Thread SimpleDimple
I am new to django so not sure if I am of much help but let me try

the key is usually the ID field of your table.
for the value to display add a method __str___ in your model, here is
sample code from one of my project
read more on ___str___ and ___unicode___ methods


class Teacher(models.Model):
school= models.ForeignKey("School")
xclass= models.ForeignKey("Class", verbose_name='Class')
name  = models.CharField("Teacher Name",max_length=50)

def __str__(self):
   return self.name


On Feb 8, 9:03 pm, hank23  wrote:
> I have coded a form which will display some data in a dropdown
> selection box. The data is being populated from a a queryset that I
> have setup in the form's code. However the entries in the dropdown
> only display as objects of the table from which they're being
> retrieved, and don't display the actual field data that I was hoping
> to have it display. So how do I specify in the form which of the table
> fields is to be the display field and which is suppoed to be the
> underying key value to be passed when and entry is selected? Thanks
> for the help.

-- 
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: Filtering List based on a custom dropdown

2011-02-08 Thread SimpleDimple
can anyone help or point me to some simple django based app that I can
study to understand more ?

On Feb 8, 2:07 am, SimpleDimple  wrote:
> I can live w/o AJAX for now to keep it simple.
>
> What I am not clear is on how to do the postback from javascript ?  I
> mean on what URL and pass on which variables ? and thru GET or POST or
> shall i do form.submit()  ??
>
> On Feb 8, 1:45 am, Joel Goldstick  wrote:
>
> > On Mon, Feb 7, 2011 at 3:38 PM, SimpleDimple 
> > wrote:
>
> > > I am new to django and building a school system but am experience
> > > developer otherwise having firm grip over rails, php, .net and java.
>
> > > I have student table and in list I can see list of all students/
> > > records in student table(pasted below is my code)
>
> > > what I want here is a custom dropdown listing the classes in school
> > > from class table, and when you select/change the class the list of
> > > students should get filtered accordinglycan someone please give me
> > > hints or guide me a bit ?
>
> > > class StudentAdmin(admin.ModelAdmin):
> > >    fields        = ['xclass', 'name', 'reg_no' , 'roll_no' ]
> > >    list_display  = ['xclass', 'name', 'reg_no' , 'roll_no' ]
> > >    list_filter   = ['name', 'reg_no' , 'roll_no' ]
> > >    search_fields = ['name', 'reg_no' , 'roll_no' ]
>
> > >    form          =  StudentForm
>
> > >    def queryset(self, request):
> > >        school_id = request.session['school_id']
> > >        qs = self.model._default_manager.filter(school=school_id)
> > >        return qs
>
> > >    def save_model(self, request, obj, form, change):
> > >        school_id = request.session['school_id']
> > >        school = School.objects.get(id=school_id)
> > >        obj.school = school
> > >        obj.save()
>
> > > --
> > > 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.
>
> > This topic has come up recently under different specifics.  When you change
> > your filter (by selecting a specific class) you need to requery with that
> > condition.  This can be done by submitting the form to get a new dataset, or
> > by using AJAX style to have the data retrieved on the fly to repopulate your
> > form.
>
> > --
> > 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: default header template file

2011-02-08 Thread SimpleDimple
Thanks for the link but actually I am not looking for debugging, I
just want to add up my own stuff into the header coming from DBcan
you help me in that ?



On Feb 8, 2:08 am, Shawn Milochik  wrote:
> This will help you a lot:
>
> https://github.com/robhudson/django-debug-toolbar
>
> It shows you the templates being used and a bunch of other stuff.
>
> Shawn

-- 
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: Setting session variable at the time of login

2011-02-08 Thread SimpleDimple
Great Pointer - I think this is what I was looking for.

On Feb 8, 2:13 am, Shawn Milochik  wrote:
> 1. You'll have to create your own login view. You can look at Django's
> view and just copy it. You can use the built-in authentication and
> template and everything, plus whatever else you want to do.
>
> 2. Here's how you do 
> that:http://docs.djangoproject.com/en/1.2/topics/auth/#storing-additional-...

-- 
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: Sorting list view on based on field from joined table

2011-02-08 Thread SimpleDimple
I understand the model part, I am more concerned about

1) how and which event to capture on server side when header is
clicked
2) how to know which column's header was clicked

Can you please help.

On Feb 8, 2:36 am, Aryeh Leib Taurog  wrote:
> On Feb 7, 10:50 pm, SimpleDimple  wrote:
>
> > I am new to django and building a school system but am experience
> > developer otherwise having firm grip over rails, php, .net and java.
>
> > I can see the list and do sorting & search but only based on the
> > fields which are in the same table... what if I want to sort on or
> > search on field which is in another table ? something like
>
> > select class.* from class, session
> >    where class.session_id = session.id
> >    order by session.starting_date
>
> Class.objects.order_by(session__starting_date)
>
> see docs for order_by method of 
> QuerySethttp://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by

-- 
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: Getting value from session in ModelForm

2011-02-08 Thread SimpleDimple
I understand what you mean about the scope

Thanks for the sample code, very helpful, will try it out and let you
know.

Thanks,

On Feb 8, 2:45 pm, Daniel Roseman  wrote:
> On Monday, February 7, 2011 8:27:55 PM UTC, SimpleDimple wrote:
>
> > I am new to Django and building a school system but am an experienced
> > developer otherwise having firm grip over rails, .net, php & java.
>
> > I have the following class where on teacher add/edit form, I am trying
> > to filter values in class drop down based on school.  The value of
> > school_id is saved in session but as you can see below pulling value
> > from session fails in ModelForm, can someone please guide me on how to
> > get the value from session here ?
>
> > class TeacherForm(ModelForm):
> >     def __init__(self, *args, **kwargs):
> >         super(TeacherForm, self).__init__(*args, **kwargs)
> >         xclass = self.fields['xclass'].widget
>
> >         choices = []
>
> >         #school_id = request.session['school_id']     # since this
> > fails, I have hard coded the value 2 in line below for now
> >         school_id = 2
> >         xclasses = Class.objects.filter(school=school_id)
> >         for c in xclasses:
> >             choices.append((c.id,c.name))
> >         xclass.choices = choices
>
> It's fundamental to Python programming generally - and, I would have
> thought, Java and Ruby (although not PHP) - that if you want access to an
> object in a scope, you need to pass it into that scope. In order for you to
> access request.session within that __init__ method, you'll need to
> explicitly make the request object available there, which means passing it
> in when you initialise the form.
>
> I usually do it like this:
>
>     class MyForm(forms.ModelForm):
>         def __init__(self, *args, **kwargs):
>             request = kwargs.pop('request')
>             super(TeacherForm, self).__init__(*args, **kwargs)
>             ...etc...
>
> now initialise the form in your view:
>
>     form = MyForm(request=request)
>
> --
> DR.

-- 
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: imported tuples/variables don't get translated

2011-02-08 Thread Ivo Brodien
hey Marcos,

> Are you doing: from django.utils.translation import ugettext_lazy as _ ?
> or: from django.utils.translation import ugettext as _ ?
> 
> The first one shoud work.

Indeed I used ugettext instead of ugettext_lazy

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: Looking for IDE + FTP

2011-02-08 Thread Rodrigo
If you work in Windows I would recommend PyScripter. It is lightweight and
the fastest IDE I've tested so far (and I've used others like PyDev, Wing or
NetBeans)

It also features code completion, debugging, etc. I've used it to debug
several Django applications and it worked like a charm.

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Brian Bouterse
+1 for not editing code and uploading it.

I recommend vim or gVim

Brian

On Tue, Feb 8, 2011 at 4:57 PM, Austin Govella wrote:

> I use Textmate ($55?) for editing. Great color coding for html, ruby,
> php, javascript, css, and python. :-)
>
> I use Terminal (free) for Subversion and Git (version control). I'd
> highly recommend Git. It is easier to use and les of a hassle than
> Subversion.
>
> I use Cyberduck (free) for FTP and Mac's Finder (free) for browsing
> directories.
>
> It's not much of a difficulty to edit and save a file in my editor,
> switch to the finder window and then drag the changed file onto
> Cyberduck where it uploads it.
>
> The Git workflow is the same, except I switch to the Terminal instead
> of finder and type in a Git command instead of dragging a file to
> Cyberduck.
>
>
>
> Don't let all the version control peeps get you down. I edit files for
> live sites directly on the server all the time. Dangerous? Can be.
> Sure, but it really depends on what kind of site you're working on.
>
> I think a better bridge between your current process and version
> control is to have two versions of your sites hosted on your server:
> one for testing/staging, and the other one for production. You can
> make your edits and FTP them to your testing server, and if everything
> works, you can FTP the changes to the production server.
>
> Gets you the "testing before breaking" without having to learn a
> version control system.
>
>
>
> --
> Austin
>
> --
> 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.
>
>


-- 
Brian Bouterse
ITng Services

-- 
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: imported tuples/variables don't get translated

2011-02-08 Thread Marcos Moyano
Are you doing: from django.utils.translation import ugettext_lazy as _ ?
or: from django.utils.translation import ugettext as _ ?

The first one shoud work.

Rgds,
Marcos

On Tue, Feb 8, 2011 at 7:11 PM, Ivo Brodien  wrote:

> If I import some tuple which is used for choices in a forms.RadioSelect
> widget, then the choices don’t get translated
>
> models.py:
>
> BOOL_CHOICES = ((True, _(u'Yes')), (False, _(u'No')))
>
> forms.py:
>
> from models import BOOL_CHOICES
>
> 1) does work an translates the choices
> form.fields['accomdation'].widget = forms.RadioSelect(choices = ((True,
> _(u’Yes')), (False, _(u'No'
>
> 2) does not translate the choices
> form.fields['accomdation'].widget = forms.RadioSelect(choices =
> BOOL_CHOICES)
>
>
> something similar happens for a label
>
> STATIC = _(u”mystring”)
>
> ...label = STATIC does not work
> ...label = _(STATIC) does work
>
>
> Is this a bug or a desired behavior or am I missing something?
>
> --
> 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.
>
>


-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

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



imported tuples/variables don't get translated

2011-02-08 Thread Ivo Brodien
If I import some tuple which is used for choices in a forms.RadioSelect widget, 
then the choices don’t get translated

models.py:

BOOL_CHOICES = ((True, _(u'Yes')), (False, _(u'No')))

forms.py:

from models import BOOL_CHOICES

1) does work an translates the choices
form.fields['accomdation'].widget = forms.RadioSelect(choices = ((True, 
_(u’Yes')), (False, _(u'No'

2) does not translate the choices
form.fields['accomdation'].widget = forms.RadioSelect(choices = BOOL_CHOICES)


something similar happens for a label

STATIC = _(u”mystring”)

...label = STATIC does not work
...label = _(STATIC) does work


Is this a bug or a desired behavior or am I missing something?

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Austin Govella
I use Textmate ($55?) for editing. Great color coding for html, ruby,
php, javascript, css, and python. :-)

I use Terminal (free) for Subversion and Git (version control). I'd
highly recommend Git. It is easier to use and les of a hassle than
Subversion.

I use Cyberduck (free) for FTP and Mac's Finder (free) for browsing directories.

It's not much of a difficulty to edit and save a file in my editor,
switch to the finder window and then drag the changed file onto
Cyberduck where it uploads it.

The Git workflow is the same, except I switch to the Terminal instead
of finder and type in a Git command instead of dragging a file to
Cyberduck.



Don't let all the version control peeps get you down. I edit files for
live sites directly on the server all the time. Dangerous? Can be.
Sure, but it really depends on what kind of site you're working on.

I think a better bridge between your current process and version
control is to have two versions of your sites hosted on your server:
one for testing/staging, and the other one for production. You can
make your edits and FTP them to your testing server, and if everything
works, you can FTP the changes to the production server.

Gets you the "testing before breaking" without having to learn a
version control system.



--
Austin

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



testing: running something after the fixtures have been loaded

2011-02-08 Thread Bram de Jong
Hi,


we want to write some testing code, but our site uses Solr for
indexing. The test cases we are running are testing -among other
things- the searching.

problem is: we need to run some additional code to index the stuf the
fixtures just inserted into the DB.

as far as I read it the django unit tests run setUp before the
fixtures are loaded...
is that correct?


 - bram

-- 
http://www.samplesumo.com
http://www.freesound.org
http://www.smartelectronix.com
http://www.musicdsp.org

office: +32 (0) 9 335 59 25
mobile: +32 (0) 484 154 730

-- 
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: Calling out for Help!

2011-02-08 Thread Chris Hannam
I have found http://stackoverflow.com/questions/tagged/django to be an
awesome resource.

CH

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Marcos Moyano
On Tue, Feb 8, 2011 at 5:43 PM, Daniel Roseman wrote:

> On Tuesday, February 8, 2011 8:30:54 PM UTC, Karen McNeil wrote:
>>
>> I have three Django sites that I've been working on recently and I've
>> been doing most of the development work in Dreamweaver.  I don't use
>> any of the wysiwyg features (or, pretty much, any of the Dreamweaver
>> program features), but I like it because I can do all the the code
>> edits and the FTP transfers all in one program.  I like being able to
>> grab a remote file, make some code changes, save and upload all at
>> once, and view a nice graphical display of the file structure for the
>> local and remote sites.
>>
>> Problem is, Dreamweaver's code view is definitely not built for
>> Python, and it doesn't look like they have any plans to support it any
>> time in the foreseeable future.  Which means that I get no color-
>> coding of the code, and I'm constantly getting indentation errors.
>>
>> I've always had Dreamweaver on my computer (a Mac) and so have never
>> used a separate FTP program, and the only IDE I've ever used is IDLE.
>> I used IDLE when I was first learning Python, but now that I'm working
>> with the websites, I find it much more convenient to just open the
>> files from within DW.  Does anyone know of another, Python-friendly,
>> program that I could use for both code-editing and ftp?
>>
>> Thanks,
>> Karen
>
>
> Don't do this. Please. Really really really don't do this.
>
> It is an incredibly bad idea to edit code and upload it directly to the
> site. There are so many easy ways to break the site. You should be storing
> your code in a version control system, and exporting and deploying from
> there. FTPing code to the live server is a disaster waiting to happen.
>

+1


> --
> DR.
>
> --
> 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.
>



-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Daniel Roseman
On Tuesday, February 8, 2011 8:30:54 PM UTC, Karen McNeil wrote:
>
> I have three Django sites that I've been working on recently and I've 
> been doing most of the development work in Dreamweaver.  I don't use 
> any of the wysiwyg features (or, pretty much, any of the Dreamweaver 
> program features), but I like it because I can do all the the code 
> edits and the FTP transfers all in one program.  I like being able to 
> grab a remote file, make some code changes, save and upload all at 
> once, and view a nice graphical display of the file structure for the 
> local and remote sites. 
>
> Problem is, Dreamweaver's code view is definitely not built for 
> Python, and it doesn't look like they have any plans to support it any 
> time in the foreseeable future.  Which means that I get no color- 
> coding of the code, and I'm constantly getting indentation errors. 
>
> I've always had Dreamweaver on my computer (a Mac) and so have never 
> used a separate FTP program, and the only IDE I've ever used is IDLE. 
> I used IDLE when I was first learning Python, but now that I'm working 
> with the websites, I find it much more convenient to just open the 
> files from within DW.  Does anyone know of another, Python-friendly, 
> program that I could use for both code-editing and ftp? 
>
> Thanks, 
> Karen


Don't do this. Please. Really really really don't do this.

It is an incredibly bad idea to edit code and upload it directly to the 
site. There are so many easy ways to break the site. You should be storing 
your code in a version control system, and exporting and deploying from 
there. FTPing code to the live server is a disaster waiting to happen.
--
DR.

-- 
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: Looking for IDE + FTP

2011-02-08 Thread Sandro Dutra
I'm using PyCharm...

2011/2/8 Karen McNeil 

> I have three Django sites that I've been working on recently and I've
> been doing most of the development work in Dreamweaver.  I don't use
> any of the wysiwyg features (or, pretty much, any of the Dreamweaver
> program features), but I like it because I can do all the the code
> edits and the FTP transfers all in one program.  I like being able to
> grab a remote file, make some code changes, save and upload all at
> once, and view a nice graphical display of the file structure for the
> local and remote sites.
>
> Problem is, Dreamweaver's code view is definitely not built for
> Python, and it doesn't look like they have any plans to support it any
> time in the foreseeable future.  Which means that I get no color-
> coding of the code, and I'm constantly getting indentation errors.
>
> I've always had Dreamweaver on my computer (a Mac) and so have never
> used a separate FTP program, and the only IDE I've ever used is IDLE.
> I used IDLE when I was first learning Python, but now that I'm working
> with the websites, I find it much more convenient to just open the
> files from within DW.  Does anyone know of another, Python-friendly,
> program that I could use for both code-editing and ftp?
>
> Thanks,
> Karen
>
> --
> 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: Looking for IDE + FTP

2011-02-08 Thread Chris Hannam
I really enjoy Wing IDE, it has an excellent debugger. It won't do
your ftp stuff but it will make solving bugs a lot easier.

CH

-- 
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: Looking for IDE + FTP

2011-02-08 Thread galago
I use NetBeans and it's OK :)

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



Form Field Default Widgets

2011-02-08 Thread hank23
Is it possible to code something to cause the default widget of a
field to not be displayed on a screen and code the desired html
element manually instead?

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



Looking for IDE + FTP

2011-02-08 Thread Karen McNeil
I have three Django sites that I've been working on recently and I've
been doing most of the development work in Dreamweaver.  I don't use
any of the wysiwyg features (or, pretty much, any of the Dreamweaver
program features), but I like it because I can do all the the code
edits and the FTP transfers all in one program.  I like being able to
grab a remote file, make some code changes, save and upload all at
once, and view a nice graphical display of the file structure for the
local and remote sites.

Problem is, Dreamweaver's code view is definitely not built for
Python, and it doesn't look like they have any plans to support it any
time in the foreseeable future.  Which means that I get no color-
coding of the code, and I'm constantly getting indentation errors.

I've always had Dreamweaver on my computer (a Mac) and so have never
used a separate FTP program, and the only IDE I've ever used is IDLE.
I used IDLE when I was first learning Python, but now that I'm working
with the websites, I find it much more convenient to just open the
files from within DW.  Does anyone know of another, Python-friendly,
program that I could use for both code-editing and ftp?

Thanks,
Karen

-- 
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: Slow performance with Django when connected to Oracle

2011-02-08 Thread dw314159
Ian,

Thank you for the prompt reply!

I am observing the same behavior in the Django shell. Here the actual
query runtime is about the same between Oracle and PostgreSQL back-
ends, but the total turnaround time is about 18 times longer with
Oracle. I believe the following code demonstrates this case:

from django.db import connection
import minilims.log.models as log
import time
time_list = []
for n in range(0, 20):
 t1 = time.time()
 entries = log.Param.objects.filter(log = 6).order_by('stuff', 'id')
 entry = [x for x in entries]
 t2 = time.time()
 time_list.append(t2 - t1)
print len(connection.queries), 'queries ran.'
average_time = sum(time_list) / len(time_list)
# display minimum, average, and maximum turnaround time
print min(time_list), average_time, max(time_list)
# display average query time
print sum([float(x['time']) for x in connection.queries]) /
len(connection.queries)

The above code in the shell using a PostgreSQL backend reports:

>>> # display minimum, average, and maximum turnaround time
>>> print min(time_list), average_time, max(time_list)
0.203052997589 0.211852610111 0.234575033188
>>>
>>> # display average query time
>>> print sum([float(x['time']) for x in connection.queries]) / 
>>> len(connection.queries)
0.0557

However, running the same code with an Oracle back-end, after
restarting the shell, results in:

>>> # display minimum, average, and maximum turnaround time
>>> print min(time_list), average_time, max(time_list)
3.59030008316 3.64263659716 4.33223199844
>>>
>>> # display average query time
>>> print sum([float(x['time']) for x in connection.queries]) / 
>>> len(connection.queries)
0.05825

Any ideas?

Thanks!

DW


On Feb 8, 8:58 am, Ian  wrote:
> On Feb 7, 9:44 pm, dw314159  wrote:
>
>
>
> > Django gurus:
>
> > Hello, I am experiencing very slow performance with Django when
> > connected to an Oracle database. The exact same Django application
> > runs far faster with PostgreSQL and SQLite, with the same source data
> > loaded into each database. Looking at the information embedded in
> > “connection.queries” after making an Oracle query through Django, it
> > appears that the queries themselves run very quickly (runtimes are
> > comparable to those measured with PostgreSQL and SQLite), but the
> > whole turnaround time for a query in Oracle far exceeds the reported
> > query time.
>
> > I’ve tried the built-in Oracle backend engine and django-oraclepool
> > 0.7; neither improve performance. (With django-oraclepool, I also gave
> > sufficient time for the connections to pool before taking
> > measurements). Using cx_Oracle outside of Django on the same
> > workstation to connect to the same Oracle database, the query
> > turnaround time is very quick.
>
> > Is this problem connected to the fact that Django is reported to drop
> > the database connection between queries, and therefore must reconnect
> > to Oracle every time a query is executed? Or is there a Django
> > configuration option that must be specified to make the best use of
> > Oracle?
>
> Django actually closes the connection after each HTTP request, not
> each individual query.  This means that if you were running your
> timing tests in a request-less environment (i.e. through the Django
> shell), you would not expect to see any slowdown caused by this.  It
> also means that if you are running more than a few queries to serve
> each request, the overall effect may be less noticeable.
>
> Have you tried tracing the code during a request?  It would be helpful
> to have at least a general idea of where it's spending so much time.
>
> Cheers,
> Ian

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



The correct way to send messages

2011-02-08 Thread Daniele Procida
In the clean() of an admin form I want to give the user some warnings.
So this is what I do in the admin -

class SomeForm(forms.ModelForm):
class Meta:
model = SomeModel

def clean(self):
self.warnings = []

self.warnings.append("Warning: you seem to be confused.")

return self.cleaned_data


class SomeModelAdmin(admin.ModelAdmin):
form = SomeForm

def response_change(self, request, obj):
for warning in SomeForm.warnings:
messages.warning(request, warning)

return super(SomeModelAdmin, self).response_change(request, obj)

Is that the correct way to do it? It works, but is that how it is
supposed to be done?

Thanks,

Daniele

-- 
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: where is a mistake in radio buttons

2011-02-08 Thread Daniel Roseman
On Tuesday, February 8, 2011 7:18:59 PM UTC, gintare wrote:
>
>
> *.html 
>
>  
> {% csrf_token %} 
>  
>
> starts value="rstartsLkIn" 
> ends TD> 
> contains value="rcontainsLkIn" checked 
> equal value="requalLkIn" 
>
>  
> # 
> views.py 
>
> rstartsLkIn, rendsLkIn, rcontainsLkIn, requalLkIn = 
> request.POST.get('rstartsLkIn','')  , 
> request.POST.get('rendsLkIn','')  , 
> request.POST.get('rcontainsLkIn','')  , 
> request.POST.get('requalLkIn','') 
>
>  if (rcontainsLkIn)... gives none  although it is already preselected 
> initially. 
>
> How i should read value from radio buttons? 
> Check-boxes works perfectly. 
>
> regards, 
> gintare 
>

You're testing for the keys, instead of the values.

You have a single radio button, whose name is "rLkIn" (any reason you can't 
use readable names?). So that's the key in request.POST. The value will be 
the selected button:

if request.POST.get('rLKln') == 'rcontainsLkln'

However, you really really should learn Django forms, which does all this 
for you.
--
DR.

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



ModelAdmin.filter_horizontal in class without m2m relation declared

2011-02-08 Thread galago
To precise:
I have 2 models:

class Job(models.Model):
name = models.CharField(max_length=150, unique=True)
slug = models.SlugField(max_length=150, unique=True)
class JobType(models.Model):
name = models.CharField(max_length=150, unique=True)
slug = models.SlugField(max_length=150, unique=True)
job = models.ManyToManyField(Job, blank=True)

In admin.py I want to make some customizations:

class JobTypeAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('name',)}
filter_horizontal = ('job',)

 All is fine. Is it possible, to add filter_horizontal to Job model. What i 
mean: In Job edit want to have all job types displayed with nice 
filter_horizontal and with ability to manage it as it should?

Thanks in advance.

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



where is a mistake in radio buttons

2011-02-08 Thread gintare

*.html


{% csrf_token %}


starts
ends
contains
equal


#
views.py

rstartsLkIn, rendsLkIn, rcontainsLkIn, requalLkIn =
request.POST.get('rstartsLkIn','')  ,
request.POST.get('rendsLkIn','')  ,
request.POST.get('rcontainsLkIn','')  ,
request.POST.get('requalLkIn','')

 if (rcontainsLkIn)... gives none  although it is already preselected
initially.

How i should read value from radio buttons?
Check-boxes works perfectly.

regards,
gintare




-- 
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: Calling out for Help!

2011-02-08 Thread Andres Lucena
On Tue, Feb 8, 2011 at 6:11 PM, Tom Evans  wrote:
> On Tue, Feb 8, 2011 at 5:01 PM, Dev@CB  wrote:
>> Tom, why are you discouraging me?
>>
>
> My intention was not to discourage you; it was to encourage you to ask
> a sensible question in a legible manner. If you take slight at that,
> then I have no problem with not corresponding with you further.
>

I think that is always helpful this text:

http://www.catb.org/~esr/faqs/smart-questions.html

Specially the part:

1. Try to find an answer by searching the archives of the forum you
plan to post to.
2. Try to find an answer by searching the Web.
3. Try to find an answer by reading the manual.
4. Try to find an answer by reading a FAQ.
5. Try to find an answer by inspection or experimentation.
6. Try to find an answer by asking a skilled friend.
7. If you're a programmer, try to find an answer by reading the source code.

And the return key is your friend ;)

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



Specifying Field Data To Display in A DropDown

2011-02-08 Thread hank23
How do I specify which field of data to display in a dropdown box,
that is being populated by a queryset, in a form definition? And then
also how do I also specify the underlying non-dispalyed key data for
each entry in the same dropdown?

-- 
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: Calling out for Help!

2011-02-08 Thread Tom Evans
On Tue, Feb 8, 2011 at 5:01 PM, Dev@CB  wrote:
> Tom, why are you discouraging me?
>

My intention was not to discourage you; it was to encourage you to ask
a sensible question in a legible manner. If you take slight at that,
then I have no problem with not corresponding with you further.

Enjoy your lunch.

Tom

-- 
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: admin users permissions question

2011-02-08 Thread jean polo
On Feb 8, 5:33 pm, Andres Lucena  wrote:
> On Tue, Feb 8, 2011 at 5:00 PM, jean polo  wrote:
> > hi
>
> > I created some User Profile in my app.
> > Each user can add some posts and now I'd like one user to be able to
> > view/modify only his/her posts in the admin, and not the posts from
> > other users.
> > I have no idea about how to do this.
>
> > Any hint or link to a tutorial/doc would be very helpful, so far I can
> > only list all posts for all users (in the admin of course).
>
> Found this:
>
> http://www.alextreme.org/drupal/?q=node/600

that's exactly what I was looking for =)
thanks !

_j

-- 
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: Calling out for Help!

2011-02-08 Thread Dev@CB


Andres,

Thank you for your kind, helpful reply. Heading to lunch now, more
django later!

Thank you again,
Justin

-- 
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: Calling out for Help!

2011-02-08 Thread Dev@CB
Tom, why are you discouraging me?

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



Ordering/sort_by from a custom method

2011-02-08 Thread Andres Lucena
Dear Gurus,

I've made a custom method for getting the score (from django-voting)
for a giving Model:

class Link(models.Model):
episode = models.ForeignKey("Episode", related_name="links")
url = models.CharField(max_length=255, unique=True, db_index=True)

def __unicode__(self):
return self.url

def get_score(self):
return Vote.objects.get_score(self)['score']

Now I want to make a custom manager to getting the top-scored links
for the given episode. AFAIK, you can't sort by a custom method, so
I'm trying to apply the ordering through sorted(), like this links
says:

http://stackoverflow.com/questions/981375/using-a-django-custom-model-method-property-in-order-by
http://stackoverflow.com/questions/883575/custom-ordering-in-django

So, what I have now is this:

class LinkGetTopScores(models.Manager):
def get_top_score(self):
return sorted(self.filter(episode=self.episode), key=lambda n:
n.get_score)

class Link(models.Model):
episode = models.ForeignKey("Episode", related_name="links")
url = models.CharField(max_length=255, unique=True, db_index=True)
get_top_score = LinkGetTopScores()


So of course this isn't working because of the self.episode stuff...
But I've to filter somehow by episode (the ForeignKey), and I don't
know how. Is there anyway of doing this?? What I'm doing is right or
there would be an easier way of doing this?

Thank you,
Andres

-- 
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: Calling out for Help!

2011-02-08 Thread Tom Evans
On Tue, Feb 8, 2011 at 4:26 PM, Dev@CB  wrote:
> Hello. I hope someone is maybe having a slow day and can spend a
> little time with me. Here's the whole story: Several months ago, our
> company started a django project. This project was headed by one man.
> Well, as of early January, he is no longer with the company. Now, we,
> the survivors, have the task of completing the project. Oh, little
> more background: Everything was set up on an Amazon cloud server. I
> think originally the project seemed simple enough to be run on a
> “small cloud”. So, here is where we are at now:  This one report
> actually turned out to be a monster and took several hours to run.
> That’s not good; that report needs to run in a few minutes with more
> data being processed. So, I created a “large cloud” (with AutoScaling,
> a feature not available to small clouds), installed Apache, PHP,
> MySQL, Python, and Django. I used SCP to copy the data from one server
> to another. Now, I need to align the configuration files to make it
> all work on the new server. This is where I need help. The small
> server was a Ubuntu distro and the large is a SUSE Enterprise 64-bit
> version, and some default paths and different things are not the same.
> I mentioned I did all the setup myself to give you the idea that I’m
> linux-savvy, but in truth, that was all a learning experience. I’m
> learning fast, but my supervisor wants all this done last week. Can
> anyone help me? At least give me a good push in the right directions,
> so that I can take off on my own again. Please?
>

My first piece of advice is discover the return key on your keyboard.

The second is to ask a question.

Cheers

Tom

-- 
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: Calling out for Help!

2011-02-08 Thread Andres Lucena
On Tue, Feb 8, 2011 at 5:26 PM, Dev@CB  wrote:
> Hello. I hope someone is maybe having a slow day and can spend a
> little time with me. Here's the whole story: Several months ago, our
> company started a django project. This project was headed by one man.
> Well, as of early January, he is no longer with the company. Now, we,
> the survivors, have the task of completing the project. Oh, little
> more background: Everything was set up on an Amazon cloud server. I
> think originally the project seemed simple enough to be run on a
> “small cloud”. So, here is where we are at now:  This one report
> actually turned out to be a monster and took several hours to run.
> That’s not good; that report needs to run in a few minutes with more
> data being processed. So, I created a “large cloud” (with AutoScaling,
> a feature not available to small clouds), installed Apache, PHP,
> MySQL, Python, and Django. I used SCP to copy the data from one server
> to another. Now, I need to align the configuration files to make it
> all work on the new server. This is where I need help. The small
> server was a Ubuntu distro and the large is a SUSE Enterprise 64-bit
> version, and some default paths and different things are not the same.
> I mentioned I did all the setup myself to give you the idea that I’m
> linux-savvy, but in truth, that was all a learning experience. I’m
> learning fast, but my supervisor wants all this done last week. Can
> anyone help me? At least give me a good push in the right directions,
> so that I can take off on my own again. Please?
>

Well, the first thing to see when deploying a django project is the
settings.py file. Here you'll see the database information.

Then the second step will be testing it (with the command python
manage.py runserver, it should start the development server, NOT for
using in production).

The last thing will see the Apache configuration, and it'll depend if
you're using wsgi or fcgi... More information here:
http://docs.djangoproject.com/en/dev/howto/deployment/
http://www.djangobook.com/en/beta/chapter21/

Hope it isn't that difficult, you can see the configs from the old
server, right?

Good luck!
Andres

-- 
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: admin users permissions question

2011-02-08 Thread Andres Lucena
On Tue, Feb 8, 2011 at 5:00 PM, jean polo  wrote:
> hi
>
> I created some User Profile in my app.
> Each user can add some posts and now I'd like one user to be able to
> view/modify only his/her posts in the admin, and not the posts from
> other users.
> I have no idea about how to do this.
>
> Any hint or link to a tutorial/doc would be very helpful, so far I can
> only list all posts for all users (in the admin of course).
>

Found this:

http://www.alextreme.org/drupal/?q=node/600

Hope it'll help.

See you,
Andres

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



Calling out for Help!

2011-02-08 Thread Dev@CB
Hello. I hope someone is maybe having a slow day and can spend a
little time with me. Here's the whole story: Several months ago, our
company started a django project. This project was headed by one man.
Well, as of early January, he is no longer with the company. Now, we,
the survivors, have the task of completing the project. Oh, little
more background: Everything was set up on an Amazon cloud server. I
think originally the project seemed simple enough to be run on a
“small cloud”. So, here is where we are at now:  This one report
actually turned out to be a monster and took several hours to run.
That’s not good; that report needs to run in a few minutes with more
data being processed. So, I created a “large cloud” (with AutoScaling,
a feature not available to small clouds), installed Apache, PHP,
MySQL, Python, and Django. I used SCP to copy the data from one server
to another. Now, I need to align the configuration files to make it
all work on the new server. This is where I need help. The small
server was a Ubuntu distro and the large is a SUSE Enterprise 64-bit
version, and some default paths and different things are not the same.
I mentioned I did all the setup myself to give you the idea that I’m
linux-savvy, but in truth, that was all a learning experience. I’m
learning fast, but my supervisor wants all this done last week. Can
anyone help me? At least give me a good push in the right directions,
so that I can take off on my own again. Please?

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



Problem with 'resolve' in non-root Apache installations

2011-02-08 Thread Rodrigo
Hi.

I'm stuck with a problem concerning the 'resolve' and 'reverse'
functions.

urls.py:
urlpatterns = patterns('',
  (r'^points/', include ('points.urls')),
  (r^deliveries/, include ('deliveries.urls'))
)

points/urls.py
urlpatterns = patterns('points.views',
  (r'^(?P\d+)/$', 'point_dispatch')
)

deliveries/urls.py
urlpatterns = patterns('deliveries.views',
  (r'^(?P\d+)/confirmed/$',
'delivery_confirmed_conflicts_dispatch')
)

In one of the templates in the 'points' app I use the {% url %} tag to
generate the url of a Point.
Afterwards, that url is sent in a POST request to the 'deliveries' app
to confirm that the point is conflictive.

The problem arises when I run the application in a non-root
environment in Apache
(with 'WSGIScriptAplias /conflictsapp /path_to_my_django.wsgi')

Then, the '%{ url }%' tag and the 'reverse' function honor the
SCRIPT_NAME sent by mod_wsgi and return urls of the form '/
conflictsapp/points//

However, the 'resolve' function does not take into account
SCRIPT_NAME, and when I run 'resolve' against one of the mentioned
urls it throws a 404. So far I've solved it by stripping SCRIPT_NAME
before calling 'resolve' but I don't think that's optimal.

Is this a normal behavior, or am I misunderstunding reverse and
resolve?

Thanks in advance.

Kind regards,
Rodrigo.

-- 
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: error while submitting data in the form django

2011-02-08 Thread Tom Evans
On Tue, Feb 8, 2011 at 3:37 PM, sushanth Reddy  wrote:
> I am trying to insert data into db it throws below error,can any please fix
> this.

form.Fields normalize to a python value. That python value must be
assignable to the model field you are trying to update. You cannot
assign a string to a foreign key field, it expects an instance of the
object that it is a foreign key for.

The solution is to use field that normalizes to the correct value, in
this case a ModelChoiceField. If you don't want it to appear, you can
still use a HiddenInput widget, but it must be a ModelChoiceField if
you want to assign it to a foreign key field.

Cheers

Tom

-- 
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 Populate A Dropdown List

2011-02-08 Thread hank23
I have coded a form which will display some data in a dropdown
selection box. The data is being populated from a a queryset that I
have setup in the form's code. However the entries in the dropdown
only display as objects of the table from which they're being
retrieved, and don't display the actual field data that I was hoping
to have it display. So how do I specify in the form which of the table
fields is to be the display field and which is suppoed to be the
underying key value to be passed when and entry is selected? Thanks
for the help.

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



admin users permissions question

2011-02-08 Thread jean polo
hi

I created some User Profile in my app.
Each user can add some posts and now I'd like one user to be able to
view/modify only his/her posts in the admin, and not the posts from
other users.
I have no idea about how to do this.

Any hint or link to a tutorial/doc would be very helpful, so far I can
only list all posts for all users (in the admin of course).

thanks !
_j

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



error while submitting data in the form django

2011-02-08 Thread sushanth Reddy
I am trying to insert data into db it throws below error,can any please fix 
this.


model.py

from django.db import models

# Create your models here.

class Profile(models.Model):
 name = models.CharField(max_length=50, primary_key=True)
 assign = models.CharField(max_length=50)
 doj = models.DateField()

 class Meta:
db_table= 'profile'


 def __unicode__(self):

   return  u'%s' % (self.name)



class working(models.Model):
   w_name =models.ForeignKey(Profile, db_column='w_name')
   monday =  models.IntegerField(null=True, db_column='monday', blank=True)
   tuesday =  models.IntegerField(null=True, db_column='tuesday', blank=True)
   wednesday =  models.IntegerField(null=True, db_column='wednesday', 
blank=True)

   class Meta:
db_table = 'working'



   def __unicode__(self):
  return  u'%s ' % ( self.w_name)

forms.py

from models import *
from django import forms

class WorkingForm(forms.ModelForm):

  def __init__(self,  *args, **kwargs):
super(WorkingForm, self).__init__(*args, **kwargs)
self.fields['w_name'] 
=forms.CharField(initial='x',widget=forms.HiddenInput())

  class Meta:
model = working
exclude = ('id')

view.py

# Create your views here.
from forms import *
from django import http
from django.shortcuts import render_to_response, get_object_or_404


def index(request):
  if request.method == "POST":
  form = WorkingForm(request.POST)
  if form.is_valid():
form.save()
return http.HttpResponse('Added')
  else:  
form = WorkingForm()
  return render_to_response('add_workingdays.html',locals())

Error Message:

ValueError at /

Cannot assign "u'x'": "working.w_name" must be a "Profile" instance.

Request Method: POST
Request URL:http://127.0.0.1:8000/
Django Version: 1.2.4
Exception Type: ValueError
Exception Value:

Cannot assign "u'x'": "working.w_name" must be a "Profile" instance.

Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/
Django Version: 1.2.4
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'check']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.4-py2.6.egg/django/core/handlers/base.py"
 in get_response
  100. response = callback(request, *callback_args, 
**callback_kwargs)
File "/home/xyz/newapp/../newapp/check/views.py" in index
  10.   if form.is_valid():
File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.4-py2.6.egg/django/forms/forms.py"
 in is_valid
  121. return self.is_bound and not bool(self.errors)
File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.4-py2.6.egg/django/forms/forms.py"
 in _get_errors
  112. self.full_clean()
File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.4-py2.6.egg/django/forms/forms.py"
 in full_clean
  269. self._post_clean()
File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.4-py2.6.egg/django/forms/models.py"
 in _post_clean
  320. self.instance = construct_instance(self, self.instance, 
opts.fields, opts.exclude)
File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.4-py2.6.egg/django/forms/models.py"
 in construct_instance
  51. f.save_form_data(instance, cleaned_data[f.name])
File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.4-py2.6.egg/django/db/models/fields/__init__.py"
 in save_form_data
  416. setattr(instance, self.name, data)
File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.4-py2.6.egg/django/db/models/fields/related.py"
 in __set__
  318.  self.field.name, 
self.field.rel.to._meta.object_name))

Exception Type: ValueError at /
Exception Value: Cannot assign "u'x'": "working.w_name" must be a "Profile" 
instance.


I did a foreign key relation between two tables and i am trying to insert 
the data to working table it get Cannot assign "u'x'": "working.w_name" must 
be a "Profile" instance.

if remove def *init*(self, *args, **kwargs): super(WorkingForm, 
self).*init*(*args, 
**kwargs) self.fields['w_name'] 
=forms.CharField(initial='x',widget=forms.HiddenInput())

it works normally,but i want to enter the username as hidden,but it throwing 
foreign key error



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



Class-based views & authentication

2011-02-08 Thread Pascal Germroth
Hi,

I'm new to Django, but since this project will take a while I'm already
using 1.3 alpha since it will probably be released when I'm done…

As I understand it, the preferred method now are class-based views. But
I seem to be missing some kind of AuthenticationMixin… right now, have
to override `dispatch`, add the authentication decorator as one would
for function views, and call super.

To make things a bit easier, I'm about to write my own mixin for that so
I only have to provide a method that checks if credentials are OK.


Or am I doing this completely wrong?

-- 
Pascal Germroth

-- 
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: E-commerce site

2011-02-08 Thread Arun K.Rajeevan
Well, thank you for plata pointer, I never heard about it.
Going to try that.

-- 
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: E-commerce site

2011-02-08 Thread Arun K.Rajeevan
By support I only mean the support we usually get from forums, but a bit
faster response time.
Which I think is expectable over here.

Arun.K.R

On 8 February 2011 20:47, Shawn Milochik  wrote:

> Oops, hit 'send' by mistake on that last e-mail.
>
> As I was saying, Satchmo is likely the way go to. However, don't
> expect us to support your paying customers.
>
> If you're not competent to support your customers in Django, use
> another tool. Learn Django and implement a Satchmo store to teach
> yourself, then when you know what you're doing you can offer to
> maintain Django sites for your customers.
>
> Shawn
>
> --
> 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: E-commerce site

2011-02-08 Thread Shawn Milochik
Oops, hit 'send' by mistake on that last e-mail.

As I was saying, Satchmo is likely the way go to. However, don't
expect us to support your paying customers.

If you're not competent to support your customers in Django, use
another tool. Learn Django and implement a Satchmo store to teach
yourself, then when you know what you're doing you can offer to
maintain Django sites for your customers.

Shawn

-- 
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: E-commerce site

2011-02-08 Thread Matthias Kestenholz
On Tue, Feb 8, 2011 at 2:53 PM, Arun K.Rajeevan  wrote:
> Hi all,
> I was a java programmer before I started to code in python.
> For the last 1yr I use python and loves it.

Great, a warm welcome to you!


> I'm new to django, but tried django tutorial and used web2py before for a
> few websites.
> Now, I had a bid for an e-commerce site.
> I don't want to go for magneto or the like, because I don't know PHP nor do
> I like to use that language.
> The one e-commerce solution I found and looks promising is Stachmo
>  http://www.satchmoproject.com/
> which is django based.
> How stable that project is? Or do you recommend the use of it?
> Is there any other python  based solutions?
> If I choose to go for stachmo, I'm most likely sure that I'll end up with
> lots of problems because I'm not that familiar with django, can I hope to
> get some good support from you guys (I heard a lot about django-users group
> is very supportive) so that I will not end up in bad customer reputations?
> !!

Satchmo is a mature (nearly) out-of-the-box shop solution which is
well suited to many shops. It has a history of being a bit hard to
install, but I hear that has changed in the last months. Its community
is helpful too.

Nevertheless, its sheer size might be a bit too much for a beginner,
and if you do not need everything Satchmo offers you might be happier
with a simpler app such as Plata:

http://readthedocs.org/docs/plata-django-shop/en/latest/index.html
https://github.com/matthiask/plata/

(Yay, promoting my own projects. I eat my own dogfood, though)


> I need:
> * an e-commerce site (not complex, we may have a max of 20 different
> products),
> * a forum with support, downloads/updates, product registration, Personal
> account page/shipping details/preferences/etc,
> * a blog

You'll find a lot of blog applications around. Some only allow posting
entries, others offer full trackback integration etc but lose a bit on
the reusable-app side.


> * social media integration

You might want to take a look at django-social-auth or
django-registration-facebook.


> Please suggest a starting point, and django applications that can be
> integrated to create this product in a rapid manner.
> Also, if you suggest the use of an ide, please mention which one. currently
> I'm happy with geany (a text editor + some more)

Whatever suits you. IDEs are a topic for religious wars, I won't give
advice here.


> Don't worry about the fact I'm new to django, I'm fast to adapt.
>


HTH
Matthias


-- 
Matthias Kestenholz - Dipl. Umwelt-Natw. ETH - Konzept & Programmierung
FEINHEIT GmbH - Molkenstrasse 21 - CH-8004 Zürich
Django CMS building toolkit: http://www.feinheit.ch/labs/feincms-django-cms/

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



AW: problem with tutorial

2011-02-08 Thread Szabo, Patrick (LNG-VIE)
Youre right...kinda mixed up the version there..
Thanks !



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Dienstag, 08. Februar 2011 16:05
An: django-users@googlegroups.com
Betreff: Re: problem with tutorial

On Tue, Feb 8, 2011 at 2:43 PM, Szabo, Patrick (LNG-VIE)
 wrote:
>  Hi,
>
> I startet exploring django today and I'm currently stuck.
> Right now I'm doing the 3 part of the tutorial, where it says Design
> your URLs.
>
> I editet the urls.py so it looks like this:
>
> from django.conf.urls.defaults import *
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>(r'^polls/$', 'polls.views.index'),
>(r'^polls/(?P\d+)/$', 'polls.views.detail'),
>(r'^polls/(?P\d+)/results/$', 'polls.views.results'),
>(r'^polls/(?P\d+)/vote/$', 'polls.views.vote'),
>(r'^admin/', include(admin.site.urls)),
> )
>
> Now if i go tho http://localhost:8000/polls/ i get the following error:
>
>
> AttributeError: 'AdminSite' object has no attribute 'urls'
>
> Can anyone tell me what i did wrong ?!
>
> Kind regards
>

I think you have installed Django 1.0 and are following the tutorial
for Django 1.2.

Can you check? Follow this example:


> $ python manage.py shell
Python 2.6.6 (r266:84292, Oct 20 2010, 10:09:04)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import django
>>> django.VERSION
(1, 2, 3, 'final', 0)


Cheers

Tom

-- 
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: E-commerce site

2011-02-08 Thread Shawn Milochik
Satchmo is the "big name" in the Django community for online shops.

-- 
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: problem with tutorial

2011-02-08 Thread Tom Evans
On Tue, Feb 8, 2011 at 2:43 PM, Szabo, Patrick (LNG-VIE)
 wrote:
>  Hi,
>
> I startet exploring django today and I'm currently stuck.
> Right now I'm doing the 3 part of the tutorial, where it says Design
> your URLs.
>
> I editet the urls.py so it looks like this:
>
> from django.conf.urls.defaults import *
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>    (r'^polls/$', 'polls.views.index'),
>    (r'^polls/(?P\d+)/$', 'polls.views.detail'),
>    (r'^polls/(?P\d+)/results/$', 'polls.views.results'),
>    (r'^polls/(?P\d+)/vote/$', 'polls.views.vote'),
>    (r'^admin/', include(admin.site.urls)),
> )
>
> Now if i go tho http://localhost:8000/polls/ i get the following error:
>
>
> AttributeError: 'AdminSite' object has no attribute 'urls'
>
> Can anyone tell me what i did wrong ?!
>
> Kind regards
>

I think you have installed Django 1.0 and are following the tutorial
for Django 1.2.

Can you check? Follow this example:


> $ python manage.py shell
Python 2.6.6 (r266:84292, Oct 20 2010, 10:09:04)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import django
>>> django.VERSION
(1, 2, 3, 'final', 0)


Cheers

Tom

-- 
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: Including apps for inherited models in INSTALLED_APPS

2011-02-08 Thread Shawn Milochik
On Tue, Feb 8, 2011 at 9:39 AM, Ian Stokes-Rees
 wrote:
> I'm (reasonably) happy to include base models in INSTALLED_APPS, but
> this argument:
>
> On 2/8/11 4:32 AM, Tom Evans wrote:
>> Explicit is better than implicit. If you want models from app 'base'
>> installed on your system, you add the 'base' app to INSTALLED_APPS.
>> Otherwise, its a series of $MAGIC working out what apps/DB tables are
>> required, and $MAGIC is never good - might as well be using rails.
>
> feels fairly arbitrary -- the whole point of a web framework like Django
> is that "magic happens", and stuff "just works".
>
> Ian
>

As someone for whom performing magic is a hobby, I'm compelled to
point out this secret all magicians know:

There's no such thing as magic.

Therefore, if you want the appearance of magic you must be
well-prepared. If you "look at the other hand" when Django's magic
happens with model inheritance, you'll see contenttypes doing its
dirty work.

Shawn

-- 
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: Slow performance with Django when connected to Oracle

2011-02-08 Thread Ian
On Feb 7, 9:44 pm, dw314159  wrote:
> Django gurus:
>
> Hello, I am experiencing very slow performance with Django when
> connected to an Oracle database. The exact same Django application
> runs far faster with PostgreSQL and SQLite, with the same source data
> loaded into each database. Looking at the information embedded in
> “connection.queries” after making an Oracle query through Django, it
> appears that the queries themselves run very quickly (runtimes are
> comparable to those measured with PostgreSQL and SQLite), but the
> whole turnaround time for a query in Oracle far exceeds the reported
> query time.
>
> I’ve tried the built-in Oracle backend engine and django-oraclepool
> 0.7; neither improve performance. (With django-oraclepool, I also gave
> sufficient time for the connections to pool before taking
> measurements). Using cx_Oracle outside of Django on the same
> workstation to connect to the same Oracle database, the query
> turnaround time is very quick.
>
> Is this problem connected to the fact that Django is reported to drop
> the database connection between queries, and therefore must reconnect
> to Oracle every time a query is executed? Or is there a Django
> configuration option that must be specified to make the best use of
> Oracle?

Django actually closes the connection after each HTTP request, not
each individual query.  This means that if you were running your
timing tests in a request-less environment (i.e. through the Django
shell), you would not expect to see any slowdown caused by this.  It
also means that if you are running more than a few queries to serve
each request, the overall effect may be less noticeable.

Have you tried tracing the code during a request?  It would be helpful
to have at least a general idea of where it's spending so much time.

Cheers,
Ian

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



problem with tutorial

2011-02-08 Thread Szabo, Patrick (LNG-VIE)
 Hi, 

I startet exploring django today and I'm currently stuck.
Right now I'm doing the 3 part of the tutorial, where it says Design
your URLs.

I editet the urls.py so it looks like this:

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^polls/$', 'polls.views.index'),
(r'^polls/(?P\d+)/$', 'polls.views.detail'),
(r'^polls/(?P\d+)/results/$', 'polls.views.results'),
(r'^polls/(?P\d+)/vote/$', 'polls.views.vote'),
(r'^admin/', include(admin.site.urls)),
)

Now if i go tho http://localhost:8000/polls/ i get the following error:


AttributeError: 'AdminSite' object has no attribute 'urls'

Can anyone tell me what i did wrong ?!

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



E-commerce site

2011-02-08 Thread Arun K.Rajeevan
Hi all,
I was a java programmer before I started to code in python.
For the last 1yr I use python and loves it.

I'm new to django, but tried django tutorial and used web2py before for a 
few websites.
Now, I had a bid for an e-commerce site.

I don't want to go for magneto or the like, because I don't know PHP nor do 
I like to use that language.
The one e-commerce solution I found and looks promising is Stachmo 
 http://www.satchmoproject.com/
which is django based.

How stable that project is? Or do you recommend the use of it?
Is there any other python  based solutions?

If I choose to go for stachmo, I'm most likely sure that I'll end up with 
lots of problems because I'm not that familiar with django, can I hope to 
get some good support from you guys (I heard a lot about django-users group 
is very supportive) so that I will not end up in bad customer reputations? 
!!

I need:
* an e-commerce site (not complex, we may have a max of 20 different 
products), 
* a forum with support, downloads/updates, product registration, Personal 
account page/shipping details/preferences/etc, 
* a blog
* social media integration

Please suggest a starting point, and django applications that can be 
integrated to create this product in a rapid manner.
Also, if you suggest the use of an ide, please mention which one. currently 
I'm happy with geany (a text editor + some more)
Don't worry about the fact I'm new to django, I'm fast to adapt.

-- 
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: Including apps for inherited models in INSTALLED_APPS

2011-02-08 Thread Ian Stokes-Rees
I'm (reasonably) happy to include base models in INSTALLED_APPS, but
this argument:

On 2/8/11 4:32 AM, Tom Evans wrote:
> Explicit is better than implicit. If you want models from app 'base'
> installed on your system, you add the 'base' app to INSTALLED_APPS.
> Otherwise, its a series of $MAGIC working out what apps/DB tables are
> required, and $MAGIC is never good - might as well be using rails.

feels fairly arbitrary -- the whole point of a web framework like Django
is that "magic happens", and stuff "just works".

Ian

-- 
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: Questions about documentation management

2011-02-08 Thread Aryeh Leib Taurog
I forgot to mention: Python itself, as of 2.6 I believe, uses Sphinx

http://docs.python.org/release/2.6/documenting/index.html

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



Looking for reusable adressbook/contacts apps

2011-02-08 Thread Christian Gagneraud

Hi there,

Trying not to reivent the wheel, I'm looking for some contact 
management django app in a professional context (clients, manufaturer, 
...).
I'm looking for something providing a company, office, employee, and 
allowing to manage international addresses, phone, fax, email, IM, 
websites.
I'm looking for something simple. Of course I could roll my own, it 
doesn't seem complicated, but as all these "doesn't seem complicated" 
things, I'm sure I'll have to spend some time especially regarding the 
international address support.


So far I've found:
http://code.google.com/p/django-contactinfo
https://github.com/mthornhill/django-postal
http://docs.djangoproject.com/en/dev/ref/contrib/localflavor
https://github.com/myles/django-contacts
https://bitbucket.org/jdriscoll/django-addressbook

Does anyone have any feedback on any of these?
django-addressbook seems the most promising to me.

Thanks,
Chris

--
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: Process 'MultipleModelChoiceField' in 'view'

2011-02-08 Thread Tom Evans
On Tue, Feb 8, 2011 at 12:32 PM, NavaTux  wrote:
> Thanks Tom
> mjob=Job.objects.create(name=name,city=city,tags=tag)
>
> Here i shouldn't use to create a object for foreign key and many_to_many
> field; we have to get it from it's id right? because the key property
> violates then,
> city=City.objects.get(id=city_id)
> tag=Tag.objects.get(id=tag_id)
> mjob=Job.objects.create(name=name,city=city,tags=tag)
>
> it seems also problem!!

If you refer to the documentation I linked to[1]

"""
add(obj1[, obj2, ...])¶
Adds the specified model objects to the related object set.

Example:

>>> b = Blog.objects.get(id=1)
>>> e = Entry.objects.get(id=234)
>>> b.entry_set.add(e) # Associates Entry e with Blog b.
"""

Please go read the documentation. You do not create M2M links by
passing them to the object constructor, you add them to the object
post construction.

Cheers

Tom

[1] http://docs.djangoproject.com/en/1.2/ref/models/relations/

-- 
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: Process 'MultipleModelChoiceField' in 'view'

2011-02-08 Thread NavaTux
Thanks Tom 

mjob=Job.objects.create(name=name,*city=city,tags=tag*)

Here i shouldn't use to create a object for foreign key and many_to_many 
field; we have to get it from it's id right? because the key property 
violates then,

city=City.objects.get(id=city_id)  
tag=Tag.objects.get(id=tag_id)
mjob=Job.objects.create(name=name,*city=city,tags=tag*)

it seems also problem!!

-- 
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: Process 'MultipleModelChoiceField' in 'view'

2011-02-08 Thread Tom Evans
On Tue, Feb 8, 2011 at 10:21 AM, NavaTux  wrote:
> Hi Django Users,
>                   I had done the custom form with some fields which
> includes(charfield,foreignkey(ModelChoiceField),many_to_many
> field(MultiplemodelChoiceField) ),I had created a formset for my form then i
> need to process and pass the formset datas into my template
> this is my form:
> class JobPostingForm(forms.Form):
>             name = forms.CharField(max_length=250)
>            city = forms.ModelChoiceField(queryset=City.objects.all())
>           tag = forms.ModelMultipleChoiceField(queryset=Tag.objects.all())
> (Formset)
> MJobFormSet=formset_factory(JobPostingForm, max_num=5, extra=2)
>
> view function
> def view_post_multiple_jobs(request,post_mjobs_template):
>            if request.method == 'POST':
>                          mjob_form_set = MJobFormSet(request.POST)
>                          if mjob_form_set .is_valid():
>                                     form_set_data =
> mjob_form_set.cleaned_data
>
>                          def _save_job(job):
>                                  name=job['name']
>                                   city=__
>                                   tag=__
>
>    mjob=Job.objects.create(name=name,city=city,tags=tag)
>                             return mjob
>                     map(_save_job, [job for job in form_set_data if job]
>   return (template)
> Here I don't know that how to process the city,tag objects in _save_job()
> because city is foreign key object and tag is many_tomany object retirned
> from formset
> could you please point it even i have tried in times
>

1) Use a ModelForm, which would do this for you. [1]
2) M2Ms aren't created when you create the initial instance of an
object, you must first create the object, and then relate it.
Semantically, creating an M2M link between two objects is creating a
row in a links table between them, with the row containing the primary
key of one object and the primary key of the other object. Therefore,
both objects must exist in the database before you can link them, and
your question is simply "How do I create an M2M link between two
objects", which is well answered in the docs [2].

Cheers

Tom

[1] http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/
[2] http://docs.djangoproject.com/en/1.2/ref/models/relations/

-- 
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: cleaned_data not behaving how I expect it to. (newbie confusion)

2011-02-08 Thread Ion Ray Studios

Thanks for the "heads up".

I actually was aware of this. When I'm trying to figure this kind of 
thing out, I start with the simplest problem and then add complications 
once I understand the fundamentals -- even if that means doing it the 
wrong way initially.  Perhaps not the best approach...


Thanks again!

On 08/02/11 09:21, Tom Evans wrote:

On Mon, Feb 7, 2011 at 11:54 PM, Ben Dembroski  wrote:

My apologies to the list.

I just noticed the commas at the end of the lines in the views.py
file.

Once I got rid of those, all was much better.




Glad to hear it. BTW, you are expressly going against how django
suggests you validate two fields that depend upon each other. [1]

Cheers

Tom

[1] 
http://docs.djangoproject.com/en/1.2/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other



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



Process 'MultipleModelChoiceField' in 'view'

2011-02-08 Thread NavaTux
Hi Django Users,

  I had done the custom form with some fields which 
includes(charfield,foreignkey(ModelChoiceField),many_to_many 
field(MultiplemodelChoiceField) ),I had created a formset for my form then i 
need to process and pass the formset datas into my template

*this is my form:*

*class JobPostingForm(forms.Form):*
name = forms.CharField(max_length=250)
   city = forms.ModelChoiceField(queryset=City.objects.all())
  tag = forms.ModelMultipleChoiceField(queryset=Tag.objects.all())

(Formset)
MJobFormSet=formset_factory(JobPostingForm, max_num=5, extra=2)

*view function* 

*def view_post_multiple_jobs(request,post_mjobs_template):*
   if request.method == 'POST':
 mjob_form_set = MJobFormSet(request.POST)
 if mjob_form_set .is_valid():
form_set_data = 
mjob_form_set.cleaned_data
 
 def _save_job(job):
 name=job['name']
  *city=__*
  *tag=__*
  mjob=Job.objects.create(name=name,*
city=city,tags=tag*)
return mjob
map(_save_job, [job for job in form_set_data if job]

  return (template)

Here I don't know that how to process the city,tag objects in _save_job() 
because city is foreign key object and tag is many_tomany object retirned 
from formset

could you please point it even i have tried in times

-- 
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: Getting value from session in ModelForm

2011-02-08 Thread Daniel Roseman
On Monday, February 7, 2011 8:27:55 PM UTC, SimpleDimple wrote:
>
> I am new to Django and building a school system but am an experienced 
> developer otherwise having firm grip over rails, .net, php & java. 
>
> I have the following class where on teacher add/edit form, I am trying 
> to filter values in class drop down based on school.  The value of 
> school_id is saved in session but as you can see below pulling value 
> from session fails in ModelForm, can someone please guide me on how to 
> get the value from session here ? 
>
>
> class TeacherForm(ModelForm): 
> def __init__(self, *args, **kwargs): 
> super(TeacherForm, self).__init__(*args, **kwargs) 
> xclass = self.fields['xclass'].widget 
>
> choices = [] 
>
> #school_id = request.session['school_id'] # since this 
> fails, I have hard coded the value 2 in line below for now 
> school_id = 2 
> xclasses = Class.objects.filter(school=school_id) 
> for c in xclasses: 
> choices.append((c.id,c.name)) 
> xclass.choices = choices


It's fundamental to Python programming generally - and, I would have 
thought, Java and Ruby (although not PHP) - that if you want access to an 
object in a scope, you need to pass it into that scope. In order for you to 
access request.session within that __init__ method, you'll need to 
explicitly make the request object available there, which means passing it 
in when you initialise the form.

I usually do it like this:

class MyForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
request = kwargs.pop('request')
super(TeacherForm, self).__init__(*args, **kwargs)
...etc...

now initialise the form in your view:

form = MyForm(request=request)

--
DR.

-- 
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: Including apps for inherited models in INSTALLED_APPS

2011-02-08 Thread Tom Evans
On Mon, Feb 7, 2011 at 8:28 PM, Ian Stokes-Rees
 wrote:
> Does it make sense that inherited models also need their apps included in
> INSTALLED_APPS?  Right now if I have:
>
> base/models.py:
>
> class MyBaseModel(django.db.models.Model):
>    stuff
>
> and then elsewhere:
>
> derived/models.py:
>
> class MyDerivedModel(base.MyBaseModel):
>    stuff
>
> I need to include both "derived" and "base" in my INSTALLED_APPS list in
> settings.py, otherwise the table for the MyBaseModel content is never
> created.  It seems to me that "syncdb" should be able to "see" that
> MyDerivedModel has MyBaseModel as a super class in the chain to
> django.db.models.Model and consequently create the necessary tables for
> MyBaseModel.
>
> Or have I just misunderstood why it was necessary for me to include "base"
> in order to get the tables created properly by "manage.py syncdb"?
>
> TIA, Ian Stokes-Rees
>

Explicit is better than implicit. If you want models from app 'base'
installed on your system, you add the 'base' app to INSTALLED_APPS.
Otherwise, its a series of $MAGIC working out what apps/DB tables are
required, and $MAGIC is never good - might as well be using rails.

Cheers

Tom

-- 
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: cleaned_data not behaving how I expect it to. (newbie confusion)

2011-02-08 Thread Tom Evans
On Mon, Feb 7, 2011 at 11:54 PM, Ben Dembroski  wrote:
> My apologies to the list.
>
> I just noticed the commas at the end of the lines in the views.py
> file.
>
> Once I got rid of those, all was much better.
>
>
>

Glad to hear it. BTW, you are expressly going against how django
suggests you validate two fields that depend upon each other. [1]

Cheers

Tom

[1] 
http://docs.djangoproject.com/en/1.2/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other

-- 
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: cannot login to admin site using admin credentials

2011-02-08 Thread xpanta
I tried deleting auth_user in order to force manage.py to create a new
one and see what happens (just in case there was some problem with the
database table)

I gave a manage.py syncdb (after deleting auth_user) and it created
the table. It also asked me to create a new superuser. I gave the
details and this is what happened.

(hope the following give a clue of what is going on)
http://dpaste.com/hold/397353/

This is my settings.py
http://dpaste.com/hold/397354/

and this is my CustomUserModel implementation
http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/







On 8 Φεβ, 08:54, xpanta  wrote:
> I have tried this already. I still can't login.
>
> :-(
>
> On 7 Φεβ, 15:48, Chris Lawlor  wrote:
>
> > Try running 'python manage.py createsuperuser' on your production
> > server to create a new superuser account. You should have full
> > privileges to log in to the admin and make changes using this account.
>
> > On Feb 7, 8:15 am, xpanta  wrote:
>
> > > Hi,
>
> > > it seems that my problem is a bit complicated. I have tried much but
> > > to no avail. So, please help me!
>
> > > Some time ago I migrated to postgresql from mysql. I don't know if I
> > > did something wrong. Anyway, my webapp works "almost" flawlessly.
>
> > > Since then I never needed to login using admin rights (either using
> > > the admin panel or my web site). Some weeks ago I tried and I noticed
> > > that I can't login (to both admin site and web page) using admin
> > > credentials.
>
> > > I have tried dozens of various tricks but I still can't login.
>
> > > I tried adding user.set_password()  to my views.py in order to replace
> > > admin password with a new simpler one ('123') but nothing. I even
> > > registered a new user from my web page and changed its fields directly
> > > in the DB (is_staff, is_active, is_superuser) to 'True'. This let me
> > > login to the admin site but gave me no permission to change anything.
> > > I even tried to create various admin users with the help of django
> > > shell but none of them gives me a login. Interestingly whenever I do
> > > something to change admin password, I always see a different hashed
> > > password value in my DB. This means that all my approaches succeed in
> > > changing the admin password. However I can't login.
>
> > > Normal users work fine. Problem appears only when the user is an
> > > administrator.
>
> > > Any help would be greatly appreciated.

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