Re: Pass the user from one view to another one

2009-06-10 Thread Rama Vadakattu
Once user has logged in you can access user in every view by means of request as below def view2(request): user = request.user On Jun 11, 6:55 am, ariest wrote: > I have two views and I want to pass the user variable from login view > to parent1 view but I dont

Re: Processing Forms in HTML docs

2009-06-10 Thread Rama Vadakattu
1. just put down the appropriate view url for the action attribute of your form. On Jun 11, 8:56 am, Abhishek Nanda wrote: > Hi > > I wanted some help about processing forms in an html document returned > as the result of a given query. I am developing an

Re: I think my filter problem should be a common one...

2009-06-10 Thread Ramiro Morales
On Wed, Jun 10, 2009 at 9:35 PM, ssc wrote: > > [...] > > class Story(models.Model): >    # fields like headline, content, etc. not shown here >    # Google groups seems to word-wrap at 75 characters... >    classifications = models.ManyToManyField(Classification, \

Re: Related Managers and use_for_related_fields strangeness

2009-06-10 Thread Ramiro Morales
On Sun, Jun 7, 2009 at 12:44 AM, Streamweaver wrote: > > I'll have to look harder at the documentation then as I'm a bit > confuesed. > > What I thought was happening was that I would get a Project object (p) > by filtering. > > I thought p.release_set returned a query set

Processing Forms in HTML docs

2009-06-10 Thread Abhishek Nanda
Hi I wanted some help about processing forms in an html document returned as the result of a given query. I am developing an opac system . now once a user searches fr a book he is directed to an html document which contains all the results. now in this page i need to embed the search form so

Reusing fields in forms

2009-06-10 Thread Andy McKay
I've got a bunch of fields in a bunch of forms. Some of those fields repeat themselves. So rather than copy and paste them around, I defined the fields in a module and then imported them. Then pulled them into my forms. All well and good. The problem is that the fields are coming out in the

I think my filter problem should be a common one...

2009-06-10 Thread ssc
Hello, we publish stories on our website. Every story belongs to one or more classification (i.e. category), e.g. Travel, Food, Family (and of course the mighty important Hot Gossip ;-). A story can be published multiple times, possibly in different classifications. The relevant bits of the

Imposing a negative constraint on related objects

2009-06-10 Thread Rowan
Hi, I'm having problems fitting a certain query I want to do into the ORM framework and I find myself having to resort to raw SQL. This doesn't seem like such an uncommon type of query to do so I'm wondering if someone knows of a better way to phrase it. What I want to do is join through a

Pass the user from one view to another one

2009-06-10 Thread ariest
I have two views and I want to pass the user variable from login view to parent1 view but I dont know how to do that. Can anyone help me please? def login(request): username = request.POST.get('username', '') password = request.POST.get('password', '') user =

Re: Displaying select box data back to the same form - with correct value already selected.

2009-06-10 Thread NealWalters
Yes, I am using Django forms. This is a variation of the question I posted on the checkboxes. My interim solution is to have a list of objects, set the Selected value in Python, then put a for/loop in the Django form. Neal --~--~-~--~~~---~--~~ You received this

Re: django-registration using a different registration form

2009-06-10 Thread creecode
Hello Paddy, You can do the later. Put your url above the include for registration and you should be good to go. On Jun 10, 3:26 pm, Paddy Joy wrote: > I have been reading the django-registration docs and have learned I > can change the registration form by using the

Re: Add request.user.message_set for Anonymous user

2009-06-10 Thread Joshua Partogi
On Jun 11, 2:22 am, soniiic wrote: > use session_messageshttp://code.google.com/p/django-session-messages/ > > I'm using it myself at yourxisity.com and it works fine :) Thanks. This is sufficient enough. Cheers. --~--~-~--~~~---~--~~ You

Recursive model optimization

2009-06-10 Thread Kedare
Hi all, I use in my web application a recursive model like that : class Category(models.Model): title = models.CharField(verbose_name=_("title"), unique=True, db_index=True, max_length=255) slug = models.SlugField(verbose_name=_("slug"),

Re: Running django app on apache server

2009-06-10 Thread Dhruv Adhia
So I finished editing httpd.conf file as mentioned here http://docs.djangoproject.com/en/dev/howto/deployment/modpython/ I also have web sharing turned on from system preferences. I have django project called myPollsApp and I would like to now see it on apache server. How do I proceed further? On

Re: IFEQUAL takes two arguments error on Django 0.91

2009-06-10 Thread Michael
On Wed, Jun 10, 2009 at 5:43 PM, Frank Peterson wrote: > > I'm on Django 0.91 (unfortunately we are stuck with that and cannot > upgrade). > > We have a variable - object.caption and lets say that it equals > "Bling: whatever" (without the quotes) > > I am doing a hack

django-registration using a different registration form

2009-06-10 Thread Paddy Joy
I have been reading the django-registration docs and have learned I can change the registration form by using the 'form_class' keyword argument. http://bitbucket.org/ubernostrum/django-registration/src/b360801eae96/docs/views.txt To make this work do I need to rewrite the included urls with my

Re: Update an object with a dictionary

2009-06-10 Thread Alex Gaynor
On Wed, Jun 10, 2009 at 4:56 PM, Kevin Teague wrote: > > __dict__ is an attribute of every Python object. It's typically only > an internal detail, and generally not accessed directly. One area > where __dict__ modification would differ from attribute access is with > an attribute

Re: Update an object with a dictionary

2009-06-10 Thread Kevin Teague
__dict__ is an attribute of every Python object. It's typically only an internal detail, and generally not accessed directly. One area where __dict__ modification would differ from attribute access is with an attribute that's a property. Modifying the __dict__ would ignore the property

creating a composite primary key, for a field that isn't in the database...

2009-06-10 Thread tonemcd
Hi all, We have a situation where; 1. we have a database that has several tables that use composite primary keys 2. the database *cannot* be munged to add an auto increment integer field (sadly, otherwise this would be a very short post) 3. we don't need to write back to the database 4. we don't

Re: Running django app on apache server

2009-06-10 Thread Dhruv Adhia
ok found it! On Wed, Jun 10, 2009 at 2:35 PM, Dhruv Adhia wrote: > I have installed mod_python and I on my way to edit httpd.conf but could > not find the file. May I know where can I find it? > > Thanks, > > > On Wed, Jun 10, 2009 at 1:20 PM, Dhruv Adhia

IFEQUAL takes two arguments error on Django 0.91

2009-06-10 Thread Frank Peterson
I'm on Django 0.91 (unfortunately we are stuck with that and cannot upgrade). We have a variable - object.caption and lets say that it equals "Bling: whatever" (without the quotes) I am doing a hack in the templates (dont have access to anything else, and need to output "IT WORKED!" (without

Re: Running django app on apache server

2009-06-10 Thread Dhruv Adhia
I have installed mod_python and I on my way to edit httpd.conf but could not find the file. May I know where can I find it? Thanks, On Wed, Jun 10, 2009 at 1:20 PM, Dhruv Adhia wrote: > Thanks Alex. > > > On Wed, Jun 10, 2009 at 1:15 PM, Alex Gaynor

New to Django - question about AUTHENTICATION_BACKENDS and syncdb

2009-06-10 Thread spacelab
I tried to follow the following tutorial http://agileweb.wordpress.com/2009/04/28/step-by-step-guide-to-use-sign-in-with-twitter-with-django/#comment-67 however I failed to get it to work properly. To eleminate one hypothsis, I was trying to find out if there is an issue with one of of the

view - code reuse problem ({% block %} or {include})

2009-06-10 Thread Filipe Silvestrim
Hey people! I'm trying to reuse this part of code (that have template language) into my view (html): {% image item 200 200 %} {{name}} Edit

Python/Django job - every other Fri off, 3 weeks vacation, 11 holidays, 12 sick days, etc.

2009-06-10 Thread Helen
1 year position for Python/Perl/Django Developer Outstanding work environment, salary and benefits Every other Friday off throughout the entire summer 3 weeks paid vacation 11 Paid Holidays 12 Paid Sick days 1 Paid Volunteer Day 3 health plans to choose from Tuition

Re: Update an object with a dictionary

2009-06-10 Thread Paolo Corti
> > .save() is only for persisting the object to disk, not for modifying > objects. To update any Python object from a dictionary is as easy as: > > for k,v in d.items(): setattr(myobject, k, v) this is also what i came to. But curious to try the Daniel's approach, will let you know best

Re: {% url %} in conjunction with context variable

2009-06-10 Thread Margie
Or really, I guess the problem is not exactly that I can't access a context variable inside of {% url %}. I can do that in general. But in this case I am trying create the url name string on the fly by concatenating "list_" with {{app_name}}. Since there is no space before 'app_name', there's

Re: {% url %} in conjunction with context variable

2009-06-10 Thread Margie
Yes, I've used the {% url %} tag lots of times, but in this case I am trying to figure out how to incorporate a context variable into it. As I mentioned in my example, app_name is in my context. It will contain a string such as "task" or "product".In my urls I have a url whose name is set to

django versions and wsgi - 'module' object has no attribute 'site'

2009-06-10 Thread El Marto
Hi all! I m trying to run my django app using wsgi, The default django installed in the server is 0.97-pre-SVN-6978 and I want to use the development one. I inserted the development django path in the wsgi file: -- import os, sys import django.core.handlers.wsgi sys.path.insert(0,

Re: Running django app on apache server

2009-06-10 Thread Dhruv Adhia
Thanks Alex. On Wed, Jun 10, 2009 at 1:15 PM, Alex Gaynor wrote: > > > On Wed, Jun 10, 2009 at 3:13 PM, Dhruv Adhia wrote: > >> >> Hello, >> >> Can anybody explain me how would I run django app on apache server >> other than development server? >> >>

Re: {% url %} in conjunction with context variable

2009-06-10 Thread Dhruv Adhia
url Returns an absolute URL matching given view with its parameters. Documentation for using url tag This is a way to define links that aren't tied to a particular URL configuration: {% url path.to.some_view arg1,arg2,name1=value1 %} The first argument is a path to a view. It can be an

Re: Running django app on apache server

2009-06-10 Thread Alex Gaynor
On Wed, Jun 10, 2009 at 3:13 PM, Dhruv Adhia wrote: > > Hello, > > Can anybody explain me how would I run django app on apache server > other than development server? > > Thank you, > Dhruv > > > I suggest you read the documentation on how to deploy django:

Running django app on apache server

2009-06-10 Thread Dhruv Adhia
Hello, Can anybody explain me how would I run django app on apache server other than development server? Thank you, Dhruv --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Seeing form validation errors

2009-06-10 Thread zayatzz
Nice... it worked... If i use form.as_p it gives me output of all form errors before the form, just as i want, but form as paragraph does not look very nice and i rather use my own template for it which looks like this: {% for field in form %}

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

2009-06-10 Thread Streamweaver
Thanks so much for the reply. Oddly the method you suggests throws an error but I'm not sure why. The solution I came up with is as follows: User.objects.order_by('username').filter (project__owner__isnull=False).distinct() | User.objects.filter (release__owner__isnull=False).distinct() I

Re: Update an object with a dictionary

2009-06-10 Thread Kevin Teague
On Jun 10, 9:27 am, Paolo Corti wrote: > Hi > is it possible to update an object with a dictionary? > > I tried something like this: > myobject.save(force_update=True, **my_dict) > > getting an error, though: > TypeError at ... > save() got an unexpected keyword argument

Re: Update an object with a dictionary

2009-06-10 Thread Daniel Roseman
On Jun 10, 5:27 pm, Paolo Corti wrote: > Hi > is it possible to update an object with a dictionary? > > I tried something like this: > myobject.save(force_update=True, **my_dict) > > getting an error, though: > TypeError at ... > save() got an unexpected keyword argument

{% url %} in conjunction with context variable

2009-06-10 Thread Margie
I'm trying to figure out how to use the {% url %} tag in conjunction with a context variable. For example, I have the context variable 'app_name' available in my template, and I'd like to do something like this: List {{app_name}} Anyone know how to do this? Margie

error using ChoiceField

2009-06-10 Thread newbie
Hi, I have created a form which contains a ChoiceField. But in the class of the form, I havent given any choices to the ChoiceField. I'm creating the choices dynamically using ajax and adding it on the client side using javascript. I'm also using is_valid function to check whether the

Re: problem using ajax in django

2009-06-10 Thread newbie
@DR: Yeah...you are right and that is why even i was confused with the error. Finally i phrased out the problem and it was because i did not restart the server after making changes to the view. In development environment, it automatically done but when we deploy it on apache server, its not. So

Re: Displaying a checkbox/list from database back onto a Django form

2009-06-10 Thread NealWalters
Your correct, I'm so close to my issue, I assumed everybody would see it. A user fills out a form to request us to build a website for them. We ask them what languages the would like - and we give them a list, such as English, Spanish, Portuguese, etc... The flag images are there just for looks.

Re: jquery ajax form problem--Can't render template variables

2009-06-10 Thread Malcolm MacKinnon
Thanks Alex. I'll give it a try. I appreciate your comments. On Wed, Jun 10, 2009 at 5:49 AM, Alex Robbins wrote: > > I haven't used that form plugin before, but from the documentation it > looks like the problem is this line: > target:"#new", >

Update an object with a dictionary

2009-06-10 Thread Paolo Corti
Hi is it possible to update an object with a dictionary? I tried something like this: myobject.save(force_update=True, **my_dict) getting an error, though: TypeError at ... save() got an unexpected keyword argument 'myfieldname' I wouldn't like to iterate the dictionary, neither to delete and

Re: Add request.user.message_set for Anonymous user

2009-06-10 Thread Alex Gaynor
On Wed, Jun 10, 2009 at 11:22 AM, soniiic wrote: > > use session_messages http://code.google.com/p/django-session-messages/ > > I'm using it myself at yourxisity.com and it works fine :) > > > This is the topic of ticket 4604: http://code.djangoproject.com/ticket/4604.

Re: Add request.user.message_set for Anonymous user

2009-06-10 Thread soniiic
use session_messages http://code.google.com/p/django-session-messages/ I'm using it myself at yourxisity.com and it works fine :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Deleting objects in Admin - Circular References

2009-06-10 Thread ben
If I have two models that contain foreign keys to each other, e.g. class Quiz(models.Model): current_question = models.ForeignKey('Question') class Question(models.Model): quiz = models.ForeignKey('Quiz') , where there are multiple questions in each quiz, but only one is current. When

Re: Displaying select box data back to the same form - with correct value already selected.

2009-06-10 Thread Jashugan
Have you tried using Django forms? (http://docs.djangoproject.com/en/ dev/topics/forms/) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Add request.user.message_set for Anonymous user

2009-06-10 Thread Jashugan
On Jun 10, 6:09 am, Joshua Partogi wrote: > How do we add request.user.message_set for Anonymous user? I would imagine that you would play with session data instead to store that information (see http://docs.djangoproject.com/en/dev/topics/http/sessions/).

Re: Displaying a checkbox/list from database back onto a Django form

2009-06-10 Thread Jashugan
On Jun 10, 7:59 am, NealWalters wrote: > Can someone advice if this is the optimal solution? It's a hard to help you find a solution when you don't try to state your problem. Just reading your code, it seems if you want to set a single image depending on what

Re: Displaying a checkbox/list from database back onto a Django form

2009-06-10 Thread NealWalters
Here's the last chunk of code. Before I display the template, I have to reset the array with the languages stored in the database. I now default every .Selected variable to False, and this code resets the ones to True based on the database. for dblanguage in session.languages: for

Re: Displaying a checkbox/list from database back onto a Django form

2009-06-10 Thread NealWalters
Can someone advice if this is the optimal solution? I didn't get any feedback yesterday - and must get this working. I've been doing Python a short time, so not always sure the best Pythonic approach... I built an array of objects like this: class Language(db.Model): #this is never stored in

Re: problem with password reset

2009-06-10 Thread Kenneth Gonsalves
On Wednesday 10 June 2009 18:00:29 Daniel Roseman wrote: > > this shows the 'from' user as 'None', so where is it picking up the > > 'webmas...@localhost' from? Is this a bug (unlikely) or am I missing > > something? > > -- > > regards > > kghttp://lawgon.livejournal.com > > Have you tried

Re: Accessing dictionaries in templates in a sorted manner

2009-06-10 Thread Adrian Rogers
On Jun 9, 11:09 am, Tom Evans wrote: > Hi all > > I was struggling to turn a typical template dictionary iteration use > case into a sorted dictionary iteration, and struggling to find any way > of managing it. > > Eg: > > {% for key, val in tdict.items %}{% endfor

Add request.user.message_set for Anonymous user

2009-06-10 Thread Joshua Partogi
Dear all, How do we add request.user.message_set for Anonymous user? The point is I want to display a successful message after submitting form for Anonymous user. Thanks for the hint. Best regards, -- Join Scrum8.com. http://scrum8.com/member/jpartogi/ http://scrum8.com/blog/jpartogi/

Re: jquery ajax form problem--Can't render template variables

2009-06-10 Thread Alex Robbins
I haven't used that form plugin before, but from the documentation it looks like the problem is this line: target:"#new", http://malsup.com/jquery/form/#options-object You are asking jQuery to jam the whole response in, just like you are seeing. What happens if you take that line out? It looks

Re: Problem with deployment in apache

2009-06-10 Thread Graham Dumpleton
On Jun 10, 10:12 pm, newbie wrote: >  Hi, >          I deployed my django project in apache. But its working, If i > keep it in /var/www/html. Its not working if  I keep my project in the > Home directory. Its giving the error permission denied. ny idea?? Read:

Re: problem with password reset

2009-06-10 Thread Daniel Roseman
On Jun 10, 1:22 pm, Kenneth Gonsalves wrote: > hi, > > [django trunk rev 10413] > > I am having a problem with password_reset. I get the message saying that a > mail has been sent, but I do not receive the mail. A check with my mail log > shows the mail is being sent from

Re: is my DateTimeField in the past?

2009-06-10 Thread Daniel Roseman
On Jun 7, 10:46 pm, Mozey wrote: > Here is my two attempts at trying to test if my DateTimeField is in > the past or the future. > > # first attempt > def past(self): >         return self.scheduled_time < datetime.now() > > # It complained that i cannot compare a datetime to

problem with password reset

2009-06-10 Thread Kenneth Gonsalves
hi, [django trunk rev 10413] I am having a problem with password_reset. I get the message saying that a mail has been sent, but I do not receive the mail. A check with my mail log shows the mail is being sent from 'webmas...@localhost' and being rejected as that is an unknown username to my

Re: is my DateTimeField in the past?

2009-06-10 Thread ankit
use lte ,see docs for comparison. On Jun 8, 2:46 am, Mozey wrote: > Here is my two attempts at trying to test if my DateTimeField is in > the past or the future. > > # first attempt > def past(self): >         return self.scheduled_time < datetime.now() > > # It complained

Problem with deployment in apache

2009-06-10 Thread newbie
Hi, I deployed my django project in apache. But its working, If i keep it in /var/www/html. Its not working if I keep my project in the Home directory. Its giving the error permission denied. ny idea?? Hanuma. --~--~-~--~~~---~--~~ You received this

viesw on site

2009-06-10 Thread ankit
Hi, I am using def get_absolute_url in my models.Its shows 'view on site' which redirects to some wrong page i.e http://admin/r/3/ is there a way to disable view on site or atleast it should take user to correct page --~--~-~--~~~---~--~~ You received this

Re: Mail queue

2009-06-10 Thread ankit
you can store all the entries in a table or a queue.Use a cron which will send emails automatically while user is offline.rather then sending emails via django send it via cron use simple python script On Jun 8, 2:44 pm, phred78 wrote: > Hello everyone, > > Besides

Re: PostgreSQL full text engine support

2009-06-10 Thread Adrián Ribao
I'm sorry! This messages was suppose to go to the haystack.org list. Please, dismiss this message. On 10 jun, 13:57, Adrián Ribao wrote: > I'd like to suggest the fulltext search engine of PostgreSQL as a > backend. > > PostgreSQL is the favourite ddbb of the django

PostgreSQL full text engine support

2009-06-10 Thread Adrián Ribao
I'd like to suggest the fulltext search engine of PostgreSQL as a backend. PostgreSQL is the favourite ddbb of the django developers, and it includes full text search engine. http://www.postgresql.org/docs/8.3/static/textsearch.html It doesn't require extra software installation and it works

Re: problem using ajax in django

2009-06-10 Thread Daniel Roseman
On Jun 10, 10:50 am, newbie wrote: > Hi, > >          I have written a small javascript ajax code in my django > application. Its working fine in the development environment. But when > i use the same code in the same django application running on apache > and also on  a

Re: problem using ajax in django

2009-06-10 Thread Adam Stein
Don't know if this will help, but when I use AJAX, I don't set the mimetype in HttpResponse(), I just pass simplejson.dumps() to HttpResponse(): return HttpResponse(simplejson.dumps(response)) This approach works with Firefox, IE6, & IE7. On Wed, 2009-06-10 at 02:50 -0700, newbie

problem using ajax in django

2009-06-10 Thread newbie
Hi, I have written a small javascript ajax code in my django application. Its working fine in the development environment. But when i use the same code in the same django application running on apache and also on a different url(if it matters), it is not working. I have tried using

Re: Problem during deployment

2009-06-10 Thread Kenneth Gonsalves
On Wednesday 10 June 2009 13:10:00 Шигапов Ринат wrote: > Here is my part of apache2 conf for mod_python: > >         SetHandler python-program >         PythonHandler django.core.handlers.modpython >         SetEnv DJANGO_SETTINGS_MODULE settings >         PythonDebug On >         PythonPath

Problem during deployment

2009-06-10 Thread Шигапов Ринат
Hello! I'm trying to deploy my web project on production server. I tried mod_fcgid, mod_wsgi, mod_python. In each case I got errors like "TemplateDoesNotExist: 500.html" on web-project root and "ImportError: No module named urls" on admin site. I have no idea what i'm doing wrong because it's