Django gives little information about custom raised exceptions

2009-06-15 Thread Nick Fishman
Hey everyone, I'm writing a project that does some communication with proprietary devices on a non-standard protocol, so I've written a custom exception class that extends Exception and has some additional useful parameters. However, when I raise an exception instantiated from my class, the

Re: querystring redirect

2009-06-15 Thread Rama Vadakattu
This can be done with javascript as follows : 1) View/middleware (depends on your needs) detects the redirection url 2) put down the redirection url in the context and redirect to template say abc.html 3) in abc.html a) put the message "your are leaving our site" b) write javascript

Re: How to preset a value to a field on a ModelForm

2009-06-15 Thread Rama Vadakattu
else: form = FooForm() foo.date = request.session['date']# we know request.session ['date'] has a value form = FooForm(instance=foo) ... You don't need this line==>

Re: Sometimes datetime sometimes date?

2009-06-15 Thread Streamweaver
sqlite3 I changed the method and it seems to be working now. The code I'm using is: def all_last_updated(self): d = [self.last_updated, self.activity_set.latest ().last_updated] d.sort() d.reverse() return d[0] There seemed to be some problem when chaining

Re: AttributeError when implementing Django Tutorial

2009-06-15 Thread Alex Gaynor
On Mon, Jun 15, 2009 at 8:34 PM, ebbnormal wrote: > > Hello, > > I have been following along the Django tutorial, and as I was editing > the urlpatterns in my urls module, i got the following error > when I tried to run the mysite server: > >AttributeError at / >

Re: Sometimes datetime sometimes date?

2009-06-15 Thread Ramiro Morales
On Mon, Jun 15, 2009 at 10:34 PM, Streamweaver wrote: > > I ran into what I think might be a bug and wanted to check here before > possibly posting it. > > Essentially what seems to be happening is that Django seems to return > datetime.datetime or datetime.date from

AttributeError when implementing Django Tutorial

2009-06-15 Thread ebbnormal
Hello, I have been following along the Django tutorial, and as I was editing the urlpatterns in my urls module, i got the following error when I tried to run the mysite server: AttributeError at / 'AdminSite' object has no attribute 'urls' Request Method: GET Request URL:

Sometimes datetime sometimes date?

2009-06-15 Thread Streamweaver
I ran into what I think might be a bug and wanted to check here before possibly posting it. Essentially what seems to be happening is that Django seems to return datetime.datetime or datetime.date from DateFields in models and I can't figure out why it returns one type at one time and another

ModelForm, foreignkey, and hidden fields is null

2009-06-15 Thread k-dj
I'm just starting to use django and have run into a problem I have not been able to solve. I have a model Item which stores, among other things, user_id. Then I have a ModelForm. I want user_id to be a hidden field. After searching around the web, I found out how to create a hidden field. The

Memcached, out of sockets

2009-06-15 Thread Miles
I've been running the python memcached connector for a while, without much trouble. But just today during a stress test of one of the feeds (read: many many requests expected), I've ran into an out of sockets situation. After every single request, the cache backend forces a disconnect from all

How to preset a value to a field on a ModelForm

2009-06-15 Thread adelaide_mike
Hi Newbie trying to preset a field on a form where the object is to be inserted. The snippet below does not do it. class FooForm(ModelForm): class Meta: model = Foo if request.method == 'GET': if foo_id > '0':

Re: Relative imports in custom template tag collections seem to look in the wrong place.

2009-06-15 Thread greatlemer
On Jun 15, 10:47 pm, Alex Gaynor wrote: > On Mon, Jun 15, 2009 at 4:39 PM, greatlemer wrote: > > > > > > > Hi everyone, > > > I was creating some custom template tags and attempted to import my > > models through the following import at the top

Re: Relative imports in custom template tag collections seem to look in the wrong place.

2009-06-15 Thread Alex Gaynor
On Mon, Jun 15, 2009 at 4:39 PM, greatlemer wrote: > > Hi everyone, > > I was creating some custom template tags and attempted to import my > models through the following import at the top of the file: > > from ..models import * > > Unfortunately this seems to be

Re: User logged in by default??

2009-06-15 Thread Joakim Hove
Hello, thank you for answering. > Did you log yourself in in the admin without thinking about it?  That's > usually how I end up logged in without realizing it. I had thought of that - and did a fresh start of the browser without any success. But, prompted by your suggestion I continued to

Relative imports in custom template tag collections seem to look in the wrong place.

2009-06-15 Thread greatlemer
Hi everyone, I was creating some custom template tags and attempted to import my models through the following import at the top of the file: from ..models import * Unfortunately this seems to be attempting to import from django.models (which doesn't exist) rather than myapp.models and

Re: User logged in by default??

2009-06-15 Thread Alex Gaynor
On Mon, Jun 15, 2009 at 4:35 PM, Joakim Hove wrote: > > Hello, > > I have just started experimenting with the Django user authentication > system, I am currently only running with the Python testserver (if > that matters). In my url.py file I have the following view

User logged in by default??

2009-06-15 Thread Joakim Hove
Hello, I have just started experimenting with the Django user authentication system, I am currently only running with the Python testserver (if that matters). In my url.py file I have the following view mapping: ... (r'^agent/$' , 'Sleipner.model.views.agent'), . This view looks like

Re: Change AuthenticationForm error message

2009-06-15 Thread Vitaly Babiy
Yeah I think that is what I am going to do. Thanks Vitaly Babiy On Mon, Jun 15, 2009 at 4:58 PM, TiNo wrote: > On Sun, Jun 14, 2009 at 14:45, Vitaly Babiy wrote: > >> Hey Everyone, >> I need to change the inactive account error message on the >>

Re: Change AuthenticationForm error message

2009-06-15 Thread TiNo
On Sun, Jun 14, 2009 at 14:45, Vitaly Babiy wrote: > Hey Everyone, > I need to change the inactive account error message on the > AuthenticationForm, one thing I have is to replace the clean method on the > form with my own custom clean method the problem with this is django

querystring redirect

2009-06-15 Thread Bobby Roberts
hi all... is it possible to do the following? let's say the user types in the following url into their browser: mysite.com/redirect/?http://www.newsiteout.com/whatever.asp Is it possible to snag the redirect url after the ? in the url and then use it to do a redirect? I've run into a

Re: Query Help: "Get Blogs where last Entry.title='foo'"

2009-06-15 Thread Streamweaver
A custom method in the model could work fine. If you set a 'get_latest_by' in the Entry Model -> http://www.djangoproject.com/documentation/models/get_latest/ Then in the Blog Model define something like: def last_is_foo(self): if Entry.objects.latest().title == 'foo' return True

Re: Query Help: "Get Blogs where last Entry.title='foo'"

2009-06-15 Thread Jason
Close. That returns all entrys that have title foo. I need all blogs *where the last entry* has title foo. I think I need to leverage .extra(where=something) but not having much luck. On Jun 15, 2:36 pm, Streamweaver wrote: > If I understand your question right there

Re: Getting a distinct list of Users from two related Models

2009-06-15 Thread Streamweaver
awesome. Thanks for that. I put that in the comments in my code so if I ever get back to it after an update I can streamline it a bit. Thanks again. On Jun 11, 10:44 am, Karen Tracey wrote: > On Wed, Jun 10, 2009 at 3:24 PM, Streamweaver wrote: > >

Re: Modifying Django's User Model

2009-06-15 Thread LeeRisq
Thanks for the info. I'll check it out. On Jun 12, 11:06 am, Rajesh D wrote: > On Jun 12, 9:29 am, LeeRisq wrote: > > > I am interested in changing the primary key of the User model to email > > and also use that as the username. > > > I would like

Re: Query Help: "Get Blogs where last Entry.title='foo'"

2009-06-15 Thread Streamweaver
If I understand your question right there is an example that covers this exact situation that may help at http://docs.djangoproject.com/en/dev/topics/db/queries/#lookups-that-span-relationships I believe it could come out to something like this: e = Entry.objects.filter(title__exact='foo')

Query Help: "Get Blogs where last Entry.title='foo'"

2009-06-15 Thread Jason
I'm new to django and attempting to leverage the query functionality. I'm not sure if what I'm attempting requires custom sql or if I"m just missing something. I'm spending alot of time with the docs but haven't found guidance for this issue. Just using blogs as an easy example, assume the

Date of last update across Relationships

2009-06-15 Thread Streamweaver
What I want to do is get the date of the last update across relationships to figure out when the last update in an entire series of related objects happened. I'm pasting the relevant code of my models below but for example, I want to be able to call a series_updated method on project that

subdomain vs. prefix

2009-06-15 Thread eric.frederich
Hello, I have been running a django site on apache using the following alias... WSGIScriptAlias /apps /path/to/django_application/apache/django.wsgi In doing this I was pleasantly surprised to see that most of the URLs worked fine. The only thing I needed to change was LOGIN_URL='/apps/

Re: Django + Apache + mod_wsgi + Oracle -> threading problems?

2009-06-15 Thread Ian Kelly
On Jun 15, 11:11 am, Miles wrote: > Connections aren't thread safe - you have to ensure every thread gets > its own connection. You can create a new connection every request or > use a thread-local to cache connections. The latter is what Django does, although it's very easy

Re: Problem to deploy on production server

2009-06-15 Thread Francis
Also, if I set the SITE_ID to be equal in both config, When I save a model entry, I got an error from django: ERROR: canceling statement due to statement timeout Francis On Jun 15, 10:40 am, Thomas Guettler wrote: > Hi, > > do you use the cache module? Be sure, that both

Re: Problem to deploy on production server

2009-06-15 Thread Francis
Cache is planned for the non secure site, but not configured at this point. SESSION_COOKIE_NAME makes no diffrence. When I log to https://mysite.com/myadmin it redirect to http after succesful login, I need to manually enter https. Saving an entry generate a 502 BAD GATEWAY - The proxy server

Re: can you have a flatpage with url of "/" when Debug=True?

2009-06-15 Thread Michael
On Mon, Jun 15, 2009 at 2:00 PM, Joseph Brown wrote: > Well I'm flummoxed. After reading your post I retested on my dev site, and > the problem has vanished. Then I tried on production and same thing, it's > gone! > > I do have custom 404 and 500 templates. All I can figure

Re: can you have a flatpage with url of "/" when Debug=True?

2009-06-15 Thread Joseph Brown
Well I'm flummoxed. After reading your post I retested on my dev site, and the problem has vanished. Then I tried on production and same thing, it's gone! I do have custom 404 and 500 templates. All I can figure that might have changed is the file ownership - I'm using subversion and might have

Re: Developing on Apache w/ mod_python

2009-06-15 Thread Gabriel .
Hi, This a test conf with mod_python: ServerName py.banshee.lnx DocumentRoot "/home/www/python" ErrorLog /var/log/apache2/cash-error_log CustomLog /var/log/apache2/cash-out_log combined SetHandler mod_python PythonHandler django.core.handlers.modpython

Re: Django + Apache + mod_wsgi + Oracle -> threading problems?

2009-06-15 Thread James Gregory
> Connections aren't thread safe - you have to ensure every thread gets > its own connection. You can create a new connection every request or > use a thread-local to cache connections. > Ok, thanks for the explanation/confirmation James --~--~-~--~~~---~--~~

Developing on Apache w/ mod_python

2009-06-15 Thread gte351s
Hello, I'm very new to Django and trying to configure apache to work with the tutorial application. I installed mod_python and configured httpd.conf to look like this: # mod python LoadModule python_module /usr/lib/apache2/modules/mod_python.so NameVirtualHost *:80 ServerName

Re: Django + Apache + mod_wsgi + Oracle -> threading problems?

2009-06-15 Thread Miles
On Jun 15, 6:18 pm, James Gregory wrote: > I am creating a web app with Django. I use a local MySQL database to > store users etc, but also connect to a remote Oracle database to pull > in some information to display. > > Due to Django's lack of multiple database support I

Django + Apache + mod_wsgi + Oracle -> threading problems?

2009-06-15 Thread James Gregory
I am creating a web app with Django. I use a local MySQL database to store users etc, but also connect to a remote Oracle database to pull in some information to display. Due to Django's lack of multiple database support I have written my own very smalI Oracle wrapper, using cx_Oracle. In an

Re: is there a form building pluggable?

2009-06-15 Thread Alex Gaynor
On Mon, Jun 15, 2009 at 10:51 AM, Viktor wrote: > > Hi, > > do you know about an existing application that would allow someone to > add (more-or-less) arbitrary forms to an object? > > basically, I'm creating a conference management application, and when > you register for

is there a form building pluggable?

2009-06-15 Thread Viktor
Hi, do you know about an existing application that would allow someone to add (more-or-less) arbitrary forms to an object? basically, I'm creating a conference management application, and when you register for a conference different questions might be asked which might not even be known today

Re: form instance to update an object

2009-06-15 Thread Genis Pujol Hamelink
yes, but what if it's a new object and not an existing one? How do I test this? The request method will be POST, so form will be form = MyForm(request.POST)... so if form.pk exists in the db how do I tell it's editing an existing object? if request.method == 'POST': form =

Re: Deploy with mod_python on Apache2 server

2009-06-15 Thread Karen Tracey
On Mon, Jun 15, 2009 at 11:01 AM, kiwi wrote: > > Hi, > > I try to deploy my web application written with django on Apache2 with > mod_python, but when I try to load my homepage using apache at > http://localhost/myproject/ my template does not load although the >

Deploy with mod_python on Apache2 server

2009-06-15 Thread kiwi
Hi, I try to deploy my web application written with django on Apache2 with mod_python, but when I try to load my homepage using apache at http://localhost/myproject/ my template does not load although the TEMPLATE_DIR in django settings is correct, why? My Apache2 http.conf file is correct

Re: Change AuthenticationForm error message

2009-06-15 Thread Vitaly Babiy
That seem likes to much overhead to make every request to go through. Vitaly Babiy On Mon, Jun 15, 2009 at 1:31 AM, Rama Vadakattu wrote: > > one simple idea ( it may or may not be feasible ) that you can use is > 1) write down a middleware > 2) examine the context

New with Python and Django

2009-06-15 Thread Asinox
Hi guy's, im new with Python and Django, well im learning Python using Django... im php user and CodeIgniter Framework, so i want to know something about admin generator... What i need to make a User Panel (user will write article, upload pictures, etc) ? or the samen Admin Generator will help

Re: form instance to update an object

2009-06-15 Thread Daniel Roseman
On Jun 15, 3:20 pm, Genis Pujol Hamelink wrote: > Hi list, > > I am trying to create a view to update objects in the db: > > http://dpaste.com/55546/ > > but when posting the data, form.is_valid() fails because the object already > exists in the db. Is there a way to

Re: Problem to deploy on production server

2009-06-15 Thread Thomas Guettler
Hi, do you use the cache module? Be sure, that both projects use different ones. Maybe you need to set SESSION_COOKIE_NAME if the domain name is the same. Do you use one database or two? (Is settings.DATABASE_NAME the same?) Thomas Francis schrieb: > Hi, > > I have completed one web site

How to make the authorized cross-domain AJAX-requests with Django as AJAX-server backend?

2009-06-15 Thread Valery
Hi all, the question is in subject. Details: I have a server running my Django project. I'd like to add support for authorized AJAX-queries to my site. That is, user opens a page on the http://some-3rd-party-site.tld If HTML of the page will contain a published by me JavaScript AJAX-snippet

form instance to update an object

2009-06-15 Thread Genis Pujol Hamelink
Hi list, I am trying to create a view to update objects in the db: http://dpaste.com/55546/ but when posting the data, form.is_valid() fails because the object already exists in the db. Is there a way to validate a form using an existing object and then save it? regards, -- Genís

Problem to deploy on production server

2009-06-15 Thread Francis
Hi, I have completed one web site and I am now ready to deploy it in production, but I have serious issues where I can't find any information/clue on the django web site, in the book or on IRC. I have no idea how I can solve my problem What I want to achieve is the following: 1 site under http

Re: get all the comments from a user

2009-06-15 Thread Bastien
I was searching in the included template tags but obviously doing a database search works very well: Comment.objects.filter(user_name='myname') thanks, Bastien On Jun 15, 3:09 pm, Bastien wrote: > Hi, > > with the django comments app how can I get all the comments

get all the comments from a user

2009-06-15 Thread Bastien
Hi, with the django comments app how can I get all the comments form a given user? thanks, Bastien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Error loading MySQLdb module: libmysqlclient_r.so.16 - Help please

2009-06-15 Thread Adam Stein
LD_LIBRARY_PATH variable is the correct one to use when running from your account (not to go into the discussion as to why some people think LD_LIBRARY_PATH is evil), as evidenced when you run python on the command line. In the case of Django running through a web server, the web server is not

Unable to perform Search operation with the combination of two fields

2009-06-15 Thread diti
Hi, I am Creating an application called 'Defect Tracking System'. My models.py contain the three fields namely- Defect ID, Defect Status and Defect Reported By. I have to perform search operation based on these three fields. ie if I specify the Defect ID it should give me the details of that

Re: Possible memory leak moving to Django 1.1 from 1.0.2 in mixed use test.

2009-06-15 Thread proteusguy
After working through this I feel I need to follow through and clarify what actually happened. As you say, Russ, there does not seem to be any memory leak. However it is a lot fatter in it's memory usage. I'm guessing this is due primarily to database caching. We will be doing some capacity

Looking for Django/Pinax developers to help finish project

2009-06-15 Thread Ole
Hi We are a small open source company situated in Copenhagen, Denmark. We are working on a web portal for an organisation for volunteers working with young people with problems related to loneliness etc. The portal is based on Pinax, Django and MySQL. We have established the portal on this

Re: What is available IN Django compared to other frameworks?

2009-06-15 Thread Olav
On Jun 14, 11:43 pm, Olav wrote: > On Jun 8, 5:37 pm, Necmettin Begiter > wrote:> On Mon, Jun 8, 2009 at 16:39, Olav wrote: > I also objects objects like articles, comments, posts are Django shoud be: I also THINK Anyway,

Re: GHRML Documentation

2009-06-15 Thread gte351s
> It's a generic templating language, it's not particularly geared toward HTML. > It's no HAML (you'll still get to write all the HTML yourself), but writing > custom tags is much easier than with Django. Also, it compiles templates to > Python code, which makes it reaaally fast. fast is always

Re: can django add custom permission without module association?

2009-06-15 Thread andybak
I spotted this the other day: http://www.djangosnippets.org/snippets/334/ On Jun 15, 5:42 am, victor wrote: > can django add custom permission without module association? > if can,how to? > thx a lot. --~--~-~--~~~---~--~~ You received this

How to access a form subfield? form design?

2009-06-15 Thread Bastien
Hi, I have a multi choice field to choose 1 or many months in checkboxes: in forms.py: months_open = forms.MultipleChoiceField(choices = MONTH_LIST, widget=forms.CheckboxSelectMultiple) then in my template I use {{ form.months_open }} to make the list appear. Now that works but the list

Re: imported models

2009-06-15 Thread Luc Saffre
On 13.06.2009 21:19, Luc Saffre wrote: > Can somebody explain what's going wrong there? Okay, I now looked into Django's code and understood a few things: I imagined that Django finds out the models of a project by looking into the "models" module of each application. That's wrong.

Re: URL rewriting Middleware

2009-06-15 Thread JF Simon
OK, I found, I have to write the path in request.path_info !!! It works ! --~--~-~--~~~---~--~~ 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