reqquest.user is not defined

2011-07-21 Thread bahare hoseini
hi there, i've installed *AuthenticationMiddleWare *& *SessionMidleWare *in MIDDLEWARE_CLASSES in setting.py, but wherever i use (request.user) my web page such as log_in page,is loaded as if it doesn't know request.user => there is no limit to access pages!! could you please tell me why?

Re: reqquest.user is not defined

2011-07-21 Thread vikalp sahni
If There is no user request.user holds. AnonymousUser Object. if you user request.user.is_authenticated() it should give False in case user if not logged_in, and you can load your page accordingly. Regards, //Vikalp On Thu, Jul 21, 2011 at 11:52 AM, bahare hoseini wrote:

Re: reqquest.user is not defined

2011-07-21 Thread nicolas HERSOG
Few things, can you retrieve all the user data in your pages ? If not you should look to httpRequestContext https://docs.djangoproject.com/en/1.3/topics/http/shortcuts/ and use render_to_response On Thu, Jul 21, 2011 at 9:15 AM, vikalp sahni wrote: > If There is no user

Re: problem with BooleanField form

2011-07-21 Thread Daniel Roseman
On Thursday, July 21, 2011 4:00:55 AM UTC+1, ed wrote: > > I'm using the following javascript, so I can't check the HTML, can I? > How would I go about debugging this? > > function bookmark_save() { > var item = $(this).parent(); > var data = { > url: item.find("#id_url").val(), > title:

Re: Is there a way to insert data from a csv file into my database?

2011-07-21 Thread Shawn Milochik
Please search the archive of this list. This exact thing has been addressed in detail. -- 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

django-admin inspectdb does not detect NULL columns for PostgreSQL database

2011-07-21 Thread Ricardo L. Dani
Hi everyone, I have the same problem of this ticket from django trac: https://code.djangoproject.com/ticket/7783 The PostgreSQL database introspection does not detect NULL columns, cursor.description does not return the null_ok field, so database introspection does not add null=True to column

Re: Manually ordering items in relation to siblings

2011-07-21 Thread Andre Terra
Shameless bump. Althought the original post is long, I assure you it's easy to understand. Any suggestions? Cheers, André Terra On Tue, Jul 19, 2011 at 2:58 PM, Andre Terra wrote: > Hello, everyone > > Assume the following models (dpaste.com [1]): > > class

Re: Manually ordering items in relation to siblings

2011-07-21 Thread Daniel Roseman
> > On Tue, Jul 19, 2011 at 2:58 PM, Andre Terra wrote: > >> Hello, everyone >> >> Assume the following models (dpaste.com [1]): >> >> class Account(models.Model): >> """ >> Account model for categorizing entries from each SAP import, >> and eventually sorting,

Re: Manually ordering items in relation to siblings

2011-07-21 Thread Andre Terra
django-mptt looks great, I totally forgot it existed. It seems I visited the project's website ages ago, but I honestly don't recall it. As for django-treebeard, I didn't like the API, docs and examples. Actually, the examples don't even work, so I was a little worried about using it. I'll give

Problem with relationships in models

2011-07-21 Thread Oliver Schmidt
I'm trying to write my first django app, so maybe my problem is stupid. But I have problems in using relationships in my models. My models.py looks like this: # -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User import datetime class

Re: import django models without runing the server

2011-07-21 Thread Malcolm Box
On 18 July 2011 15:41, Shawn Milochik wrote: > On Mon, Jul 18, 2011 at 10:33 AM, bruno desthuilliers > wrote: > > On Jul 18, 3:33 pm, Alexander Crössmann > > wrote: > >> Hi Malcom, > >> > >> I am not sure the

Aw: Problem with relationships in models

2011-07-21 Thread Schmidtchen Schleicher
Something went wrong with posting the model, it should be: # -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User import datetime class Kalender(models.Model): name = models.CharField("Kalendername", max_length=100) description =

Re: Problem with relationships in models

2011-07-21 Thread Malcolm Box
A guess, but are you sure syncdb created the tables? Ie have you checked using mysql, or manage.py dbshell that the tables are really there? Syncdb only creates tables for a model the first time it is run - after that it won't track updates. So if you ran it, then added the relationship, then ran

django.contrib.auth.view.login reuse

2011-07-21 Thread Jonas Geiregat
Hello, I would like to add login fields to each page. But I want to keep it as DRY as possible. I'm pretty satisfied until now about using django.contrib.auth.views.login ,but that's just one specific view in my case host.com/login. With a urls.py line as: (r'^/login/$',

Re: import django models without runing the server

2011-07-21 Thread Valder Gallo
Alexander, Try use this #test.py import os, sys sys.path.append('../') os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' myproject/test.py On 07/18/2011 09:34 AM, Alexander Crössmann wrote: Hi, I want to write a python script that works with django models without runing the

Re: import django models without runing the server

2011-07-21 Thread Jonas Geiregat
> Alexander, > > Try use this > > #test.py > import os, sys > sys.path.append('../') > os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' > > myproject/test.py > This is a good read on the subject , it presents an elegant solution.

Re: django.contrib.auth.view.login reuse

2011-07-21 Thread Jonas Geiregat
> Hello, > > I would like to add login fields to each page. But I want to keep it as DRY > as possible. > I'm pretty satisfied until now about using django.contrib.auth.views.login > ,but that's just one specific view in my case host.com/login. With a urls.py > line as: > (r'^/login/$',

Aw: Re: Problem with relationships in models

2011-07-21 Thread Schmidtchen Schleicher
You were right! I resetted the app and now it works +1 THX -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/dfsjUI6oH7IJ. To post to this group, send

__init__ got unexpected argument

2011-07-21 Thread shakthi
while executing the following model i got the error message __init() got an unexpected keyword argument 'maxlength' from django.db import models class Author(models.Model): name=models.CharField(maxlength=20) city=models.CharField(maxlength=10) -- You received this message because you

Re: import django models without runing the server

2011-07-21 Thread bruno desthuilliers
On Jul 21, 4:45 pm, Valder Gallo wrote: > Alexander, > > Try use this > > #test.py > import os, sys > sys.path.append('../') This is relative to whatever the current working directory is whenever the script is called. Very bad idea, will obviously break one day or another.

Re: __init__ got unexpected argument

2011-07-21 Thread Alex Hall
The word you want is max_length, not maxlength (note the underscore). Try changing to max_length and it should run. On 7/21/11, shakthi wrote: > while executing the following model i got the error message > __init() got an unexpected keyword argument 'maxlength' > > > from

Re: import django models without runing the server

2011-07-21 Thread bruno desthuilliers
On Jul 21, 4:53 pm, Jonas Geiregat wrote: > > This is a good read on the subject , it presents an elegant solution. > > http://superjared.com/entry/django-and-crontab-best-friends/ With the problem that it will use the first module named "settings" in sys.path, which may *or

Re: __init__ got unexpected argument

2011-07-21 Thread sakthi vel
Thank you! On Thu, Jul 21, 2011 at 8:52 PM, Alex Hall wrote: > The word you want is max_length, not maxlength (note the underscore). > Try changing to max_length and it should run. > > On 7/21/11, shakthi wrote: > > while executing the following model i

Re: import django models without runing the server

2011-07-21 Thread Javier Guerra Giraldez
On Thu, Jul 21, 2011 at 10:27 AM, bruno desthuilliers wrote: > I maintain, from experience, that custom commands are the simplest, > safest and most flexible solution. same here -- Javier -- You received this message because you are subscribed to the Google

Re: import django models without runing the server

2011-07-21 Thread Andre Terra
> > On Jul 21, 4:53 pm, Jonas Geiregat wrote: > > > > This is a good read on the subject , it presents an elegant solution. > > > > http://superjared.com/entry/django-and-crontab-best-friends/ > > > With the problem that it will use the first module named "settings" in >

Re: import django models without runing the server

2011-07-21 Thread Andre Terra
Nevermind, I thought you were referring to the previously sys.path.append() method. Regards, AT On Thu, Jul 21, 2011 at 1:13 PM, Andre Terra wrote: > On Jul 21, 4:53 pm, Jonas Geiregat wrote: >> > >> > This is a good read on the subject , it presents

Database Design Question

2011-07-21 Thread newtodjango
Hi. I have a question about writing normalized models. I began writing an app that has non-normalized tables, and would like to rewrite it with a normalized design. I have non-normalized legacy tables like this without foreign keys or many-to-many relationships, which I would like to have.

changing how, or if, model fields display

2011-07-21 Thread Alex Hall
Hi all, I have an articles model and I have a few questions. 1. Each article can have only one author. However, the admin site shows a dropdown list of all authors. What I want to happen is for the "author" field to be auto-filled by the id of the author currently logged in and creating the

Re: Database Design Question

2011-07-21 Thread newtodjango
Sorry about formatting. Also the there is a mistake. "I'd like to define the Product model..." should be "I'd like to define the Contract model... Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Is there a way to insert data from a csv file into my database?

2011-07-21 Thread lokesh
hi, you can use python script to upload from csv file to database. if u r using mysql u can http://sourceforge.net/projects/mysql-python/ download and install this package and use csv reader to read from file and write it on to tables. Guide(http://www.kitebird.com/articles/ pydbapi.html). if

Re: problem with BooleanField form

2011-07-21 Thread ed
You mean like this: var data = { url: item.find("#id_url").val(), title: item.find("#id_title").val(), tags: item.find("#id_tags").val(), share: item.find("#id_share").val() }; Tried it. 'share' is still showing up

Re: Database Design Question

2011-07-21 Thread Jani Tiainen
Hi, So you want to tie Contract with Product(s) with rebate_pct? You then need custom intermediary m2m table say "ContractProduct" https://docs.djangoproject.com/en/1.3/topics/db/models/#intermediary-manytomany> for more. So in the end your models would probably look a alike following: class

Re: Database Design Question

2011-07-21 Thread nixlists
On Thu, Jul 21, 2011 at 2:17 PM, Jani Tiainen wrote: > Hi, > So you want to tie Contract with Product(s) with rebate_pct? You then need > custom intermediary m2m table say "ContractProduct" >

Re: Database Design Question

2011-07-21 Thread Jani Tiainen
On Thu, Jul 21, 2011 at 10:50 PM, nixlists wrote: > On Thu, Jul 21, 2011 at 2:17 PM, Jani Tiainen wrote: > > Hi, > > So you want to tie Contract with Product(s) with rebate_pct? You then > need > > custom intermediary m2m table say "ContractProduct" > >

Re: Database Design Question

2011-07-21 Thread nixlists
On Thu, Jul 21, 2011 at 4:30 PM, Jani Tiainen wrote: > ContractProduct.objects.all() > Following might work also (not sure, but is easy to test in shell for > example): > for c in Contract.objects.all(): >     for cp in c.contractproduct_set.all(): >         print c,

Re: Database Design Question

2011-07-21 Thread Marc Aymerich
On Thu, Jul 21, 2011 at 11:11 PM, nixlists wrote: > On Thu, Jul 21, 2011 at 4:30 PM, Jani Tiainen wrote: > > ContractProduct.objects.all() > > Following might work also (not sure, but is easy to test in shell for > > example): > > for c in

Re: Database Design Question

2011-07-21 Thread Marc Aymerich
On Thu, Jul 21, 2011 at 11:33 PM, Marc Aymerich wrote: > > > On Thu, Jul 21, 2011 at 11:11 PM, nixlists wrote: > >> On Thu, Jul 21, 2011 at 4:30 PM, Jani Tiainen wrote: >> > ContractProduct.objects.all() >> > Following might work

Recommendations for load testing/profiling a django site server?

2011-07-21 Thread br
I am running on a Linode 768 VPS and may have some stuff going live before too long. I'm wondering what the best way to guage whether I have enough bandwidth/CPU/memory to handle a significant amount of traffic is and/or to get an idea of the types of loads the site can handle before i need to

Some thoughts on a 'backwards incompatible change' (bug!!) found in latest DDT.. wtf?

2011-07-21 Thread Cal Leeming [Simplicity Media Ltd]
https://github.com/django-debug-toolbar/django-debug-toolbar/issues/186 Does anyone else agree with my comments on that ticket, or have I missed something? :X Cal -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Some thoughts on a 'backwards incompatible change' (bug!!) found in latest DDT.. wtf?

2011-07-21 Thread Andre Terra
Totally agreed. I expect DDT to only be displayed for INTERNAL_IPS and only during DEBUG mode, it shouldn't be an OR clause. But why not go ahead and fork it? ;) Cheers, AT On Thu, Jul 21, 2011 at 8:01 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: >

Re: Some thoughts on a 'backwards incompatible change' (bug!!) found in latest DDT.. wtf?

2011-07-21 Thread Cal Leeming [Simplicity Media Ltd]
On Fri, Jul 22, 2011 at 12:22 AM, Andre Terra wrote: > Totally agreed. > > I expect DDT to only be displayed for INTERNAL_IPS and only during DEBUG > mode, it shouldn't be an OR clause. > > But why not go ahead and fork it? ;) > Yeah, someone else just suggested that too.

Re: https / nginx / uwsgi / django problems with authentification

2011-07-21 Thread Gelonida N
Hi Robert, Thanks a lot. This is working :-) I just added uwsgi_param UWSGI_SCHEME https; as you suggested. On 07/21/2011 06:38 AM, Roberto De Ioris wrote: > >> Hi, >> >> I'm not sure whether I have to change my django configuration or my >> nginx cofiguration. >> (Thus posted to

Re: import django models without runing the server

2011-07-21 Thread Gelonida N
On 07/18/2011 04:33 PM, bruno desthuilliers wrote: > On Jul 18, 3:33 pm, Alexander Crössmann > wrote: >> Hi Malcom, >> >> I am not sure the management commands are what I want > > Strange enough, it seems that everyone starts by saying this and ends > up writing

Re: import django models without runing the server

2011-07-21 Thread Kevin Anthony
I found the best way to do this is python manage.py < script.py On Jul 21, 2011 8:00 PM, "Gelonida N" wrote: > On 07/18/2011 04:33 PM, bruno desthuilliers wrote: >> On Jul 18, 3:33 pm, Alexander Crössmann >> wrote: >>> Hi Malcom, >>> >>> I am

django setup environment

2011-07-21 Thread Gelonida N
http://superjared.com/entry/django-and-crontab-best-friends/ -- 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

Re: Some thoughts on a 'backwards incompatible change' (bug!!) found in latest DDT.. wtf?

2011-07-21 Thread Mike Dewhirst
On 22/07/2011 9:25am, Cal Leeming [Simplicity Media Ltd] wrote: On Fri, Jul 22, 2011 at 12:22 AM, Andre Terra > wrote: Totally agreed. I expect DDT to only be displayed for INTERNAL_IPS and only during DEBUG mode, it shouldn't

Setting LOGIN_URL dynamically, for different users, based on app?

2011-07-21 Thread dpapathanasiou
I'd like to be able to support two different types of authenticated users within a single django project site. The idea is that Type A users will work in the /dashboard app, and Type B users will work in the /console app. Since each app has its own set of models and views, I can do this at the

Re: Setting LOGIN_URL dynamically, for different users, based on app?

2011-07-21 Thread Andre Terra
Why not make custom user profiles and write permission checks on your views? Cheers, AT On Thu, Jul 21, 2011 at 10:15 PM, dpapathanasiou < denis.papathanas...@gmail.com> wrote: > I'd like to be able to support two different types of authenticated > users within a single django project site. > >

Re: Setting LOGIN_URL dynamically, for different users, based on app?

2011-07-21 Thread dpapathanasiou
How can I do that in the context of the built-in django auth API? Are there examples or tutorials of that? On Jul 21, 9:23 pm, Andre Terra wrote: > Why not make custom user profiles and write permission checks on your views? > > Cheers, > AT > > On Thu, Jul 21, 2011 at

Re: Setting LOGIN_URL dynamically, for different users, based on app?

2011-07-21 Thread Shawn Milochik
On 07/21/2011 10:15 PM, dpapathanasiou wrote: How can I do that in the context of the built-in django auth API? Are there examples or tutorials of that? https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users -- You received this message because you are