Re: Help me- with the Database

2010-05-13 Thread francisgan9
Hi Shawn, Thank you very much for replying. I got it. --executed. 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-us...@googlegroups.com. To unsubscribe from this group, send email to

Re: Shows indendation error

2010-05-13 Thread ravi krishna
thank a lot everyoneit was really helpful...:) On Thu, May 13, 2010 at 7:33 PM, Karen Tracey wrote: > On Thu, May 13, 2010 at 2:53 AM, ravi krishna wrote: > >> Hi,,This is my url.py file, when i run this it shows indendation error at >> line 25. But

Re: TEMPLATE_DIRS

2010-05-13 Thread carrerasrodrigo
the template dir must be of this form TEMPLATE_DIRS = ( '/dir/to/templates' ) note that, there is no '/' in the ends. roy On May 13, 6:11 am, Michele Iannotta wrote: > Hello, I need help..a putting "on-line" a django application. I have > problem setting the

Re: Is it ok to super/save() twice in model.save()?

2010-05-13 Thread Richard Colley
Exactly as you had described ... I wanted to upload images to paths with the model instance's id in it. Seemed easier for a human to relate to that way (in case of maintenance outside of django). However, the uuid approach or similar may be the way forward. On May 13, 10:58 pm, zinckiwi

Django Project & App Structure

2010-05-13 Thread ryan west
So, I apologize for another topic focused on Django project and app structure, but every resource I've found is either outdated or incomplete. What I am trying to accomplish is the creation & incorporation of pluggable django applications that are NOT dependent in ANY way on the project that uses

Re: RSS Aggregator

2010-05-13 Thread beetlecube
Your project looks pretty kick-ass. Thanks for pointing me out to that. I may just seek out this code while working on my site. On May 13, 3:28 pm, Michael Elsdörfer wrote: > I'm working on a Universal Feed Parser-based library to create > aggregators. The idea is that

Re: Update Query

2010-05-13 Thread Bill Freeman
Or you could be right. I'm still not clear on the OP's intent. On Thu, May 13, 2010 at 4:21 PM, zinckiwi wrote: > Quite right, I was confusing it with QuerySet's update(), as > demonstrated in the docs: > > # Update all the headlines with pub_date in 2007. >

Re: RSS Aggregator

2010-05-13 Thread Michael Elsdörfer
I'm working on a Universal Feed Parser-based library to create aggregators. The idea is that the process of parsing a feed and syncing it's items with a database can be customized by various addins: http://github.com/miracle2k/feedplatform It mostly works already, though it lacks the

manager.raw returning Capitalized field names

2010-05-13 Thread geraldcor
Hello, Some background first. I am working with a legacy database that is not only legacy, it is legacy Microsoft access so there is some hacking going on. I am accessing a MySQL backend and my models are set up to use the existing tables/field names. When I use regular old ORM queries,

Using extra() to add table alias

2010-05-13 Thread Austin Gabel
I am trying to use the ORM to build the following query: """SELECT * FROM category AS node, category AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt""" I am attempting to create the table aliases using .extra() but I'm having a bit of difficulty. I have left out the where statements

Re: Update Query

2010-05-13 Thread zinckiwi
Quite right, I was confusing it with QuerySet's update(), as demonstrated in the docs: # Update all the headlines with pub_date in 2007. Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same') Regards Scott On May 13, 3:14 pm, Bill Freeman wrote:

Simple Site Admin Question

2010-05-13 Thread beetlecube
I tried searching for: "copy site-packages directory server" but didn't find what I was looking for. My question is simply: Running dev server on an XP Windows machine. My live server is a Webfaction account. I just did an update to 1.1 on my Dev Server by untarring the tar and running

Re: OneToOneField usage

2010-05-13 Thread TallFurryMan
Thanks for this insight. I was using OneToOneField in the same way as ForeignKey. | class Person( Model ): | pass | | class Pet( Model ): | owner = ForeignKey( Person ) | | # Assuming "joe" exists as a Person | >>> kitty = joe.pet_set.get_or_create() Yes, in that situation "joe.pet_set"

Re: Generic web-dev question: Best way to do a processing page?

2010-05-13 Thread robotmurder
Usually when I do this for an upload, etc... it means that a user just did something that resulted in an row being created in the db. I usually keep a boolean field in the table for processing. Then when I load the next page I can just query that value right before I choose the template to see if

Re: Update Query

2010-05-13 Thread Bill Freeman
Update still takes exactly one argument: self. I'm still not completely clear on what the OP is trying to do so I'll guess that for a given User object (id == 11) you want to adjust a set of attributes not known apriori, but available as key - value pairs from an itterator I'll call 'd.items()':

ModelAdmin list_filter questions

2010-05-13 Thread manishgv
I am using the latest Django 1.2 release. Can someone please confirm if the ModelAdmin's list_filter supports these capabilities: 1) Multi-Value-Select: How to allow multiple values to be selected for the SAME filter field - i.e. I want to display all records with a "status" field of : "Active"

Re: HttpResponseRedirect(request.path) after request.POST issue

2010-05-13 Thread marty3d
That's what I also figured. I began trying to pass content_type and object_id as hidden fields to the view. This didn't work (see code below), so I'm going to try to use the content_type as a part of the url. But perhaps you can explain why I can't use it in the form object? views.vote: def

Re: OneToOneField usage

2010-05-13 Thread Daniel Roseman
On May 13, 5:35 pm, Peter Herndon wrote: > On May 13, 2010, at 10:29 AM, TallFurryMan wrote: > > > Hello Django users, > > > Is there a particular reason why using a related OneToOneField raises > > DoesNotExist instead of returning None? > > Any query you make that is

Re: HttpResponseRedirect(request.path) after request.POST issue

2010-05-13 Thread Daniel Roseman
On May 13, 6:11 pm, marty3d wrote: > Thanks, that's a shame... > So I'm now trying to do the request.POST stuff in a view instead. > Since the idea is to have the voting app as decoupled as possible, is > there a slick way to pass, perhaps the whole object in this

Re: Update Query

2010-05-13 Thread zinckiwi
> What if field_name and value coming from loop? > I have around 50 field and values in loop. > Can I do this? I know this is silly way to do but please guide how can > I do this? > > for key, value in users: >    user."%s" = "%s" % (key, value) > > user.save() Ah, I see. In that case you will

Re: Update Query

2010-05-13 Thread sim
Scott, Thank you very much for your reply and giving me very nice and simpler idea but I have one question: What if field_name and value coming from loop? I have around 50 field and values in loop. Can I do this? I know this is silly way to do but please guide how can I do this? for key, value

Re: RSS Aggregator

2010-05-13 Thread beetlecube
Scott, Ofri, thanks. I realized early this morning, I will need to just use the Universal Parser un-adorned, because of the customized ways I have to do things. On May 13, 8:57 am, Scot Hacker wrote: > On May 12, 11:06 am, beetlecube wrote: > > >

Re: Update Query

2010-05-13 Thread zinckiwi
> I am little confused about it. I am not sure django allow this or not. > Please correct me. > > string = last_name = 'Riaz edit',  first_name = 'Asim edit', > nationality  = 'se' > User.objects.filter(id=11).update(string) > > I am using this and its giving me this error: > > update() takes

Re: HttpResponseRedirect(request.path) after request.POST issue

2010-05-13 Thread marty3d
Thanks, that's a shame... So I'm now trying to do the request.POST stuff in a view instead. Since the idea is to have the voting app as decoupled as possible, is there a slick way to pass, perhaps the whole object in this case, but at least the name of the model or similar together with the post?

Update Query

2010-05-13 Thread sim
Hello All, I am little confused about it. I am not sure django allow this or not. Please correct me. string = last_name = 'Riaz edit', first_name = 'Asim edit', nationality = 'se' User.objects.filter(id=11).update(string) I am using this and its giving me this error: update() takes exactly 1

Re: OneToOneField usage

2010-05-13 Thread Peter Herndon
On May 13, 2010, at 10:29 AM, TallFurryMan wrote: > Hello Django users, > > Is there a particular reason why using a related OneToOneField raises > DoesNotExist instead of returning None? Any query you make that is supposed to return one or more instances, that instead cannot find any

Re: ValueError on deleting a model object with an ImageField through Admin Interface

2010-05-13 Thread ryan west
I found the solution to my own problem. When the page was reloading, I am guessing that the actual entity had not been deleted yet, and the method __unicode__(self) was being called, requesting access of self.image (which did not exist, because that HAD been deleted). A simple modification to

Re: Form Validation question

2010-05-13 Thread Daniel Roseman
On May 13, 5:17 pm, zweb wrote: > I am doing this > >  form = ContactForm(request.POST) # A form bound to the POST data >  if form.is_valid(): # All validation rules pass > > As clean is called by is_valid() and at this point form in bound to > POST data, I cannot use

How to reload an object's member field?

2010-05-13 Thread Chia Hao Lo
I have a model Foo. If I've got a model instance foo, and I know that foo.value may be changed after I got it. How can I reload foo.value? For example, this way works: foo = Foo.objects.get(foo.id) Is this the only solution? In case that I'm in a member method of Foo. It would looks like

ValueError on deleting a model object with an ImageField through Admin Interface

2010-05-13 Thread ryan west
I'm having a silly issue with the admin interface and an ImageField in one of my models. A simple model I have contains an ImageField, and many objects of this model are related to some other model (Project, not shown). I can add/view images just fine, but when I try to delete an image, I get a

OneToOneField usage

2010-05-13 Thread TallFurryMan
Hello Django users, Is there a particular reason why using a related OneToOneField raises DoesNotExist instead of returning None? | class Person( Model ): |pass | | class Pet( Model ): |owner = OneToOneField( Person ) | | # Assuming "joe" exists as a Person | >>> kitty = joe.pet |

Re: Form Validation question

2010-05-13 Thread zweb
I am doing this form = ContactForm(request.POST) # A form bound to the POST data if form.is_valid(): # All validation rules pass As clean is called by is_valid() and at this point form in bound to POST data, I cannot use self.instance unless I do this form =

Re: RSS Aggregator

2010-05-13 Thread Scot Hacker
On May 12, 11:06 am, beetlecube wrote: > Hello, >  Just wondering if there are alternatives to the feedjack RSS > aggregator that anyone has used. It doesn't have to be "Django-ized" > like feedjack is. > > Just any Python library that you've had good luck with, parsing a

Re: Multiple Database Simple Example

2010-05-13 Thread GRoby
Russ Magee, Thanks for the quick response, your message explained what I was not understanding and I was able to get my code working. :) Gregory Roby On May 13, 10:44 am, Russell Keith-Magee wrote: > On Thu, May 13, 2010 at 10:27 PM, GRoby

Re: Shows indendation error

2010-05-13 Thread Bill Freeman
I've found that a particularly nasty place for this to happen is on the deployment server, when, as is common, it is a *nix where the convenient editor to use over ssh is vim (or vi). The typical installation is either unaware of python at all as a file type, or handles it poorly. Things will be

Re: Form Validation question

2010-05-13 Thread Jeff Green
I have used sessions to store the initial db record so that when I go into my form I retrieve the value such as stationrec = request.session['stationrec'] On Thu, May 13, 2010 at 9:36 AM, zweb wrote: > I am using a model form to edit (change) an exisiting row in db. > >

Re: Form Validation question

2010-05-13 Thread Shawn Milochik
"Also, a model form instance bound to a model object will contain a self.instance attribute that gives model form methods access to that specific model instance." From: http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/ So you can refer to self.instance in your validation code,

Re: Help me- with the Database

2010-05-13 Thread Shawn Milochik
On May 13, 2010, at 4:43 AM, francisgan9 wrote: > Hi, > I need help how to get pass the installation of the database part. - > tutorial 1 > trying to use sqlite > >self.connection = Database.connect(**kwargs) > pysqlite2.dbapi2.OperationalError: unable to open database file Evidently it

Re: Multiple Database Simple Example

2010-05-13 Thread Russell Keith-Magee
On Thu, May 13, 2010 at 10:27 PM, GRoby wrote: > Hello, > > I am using Django 1.2 RC 1 and have setup multiple databases.  I have > everything working if I manually specify .using, for example: > > SomeObjects = ModelInDefaultDatabase.objects.all()  #This Works > >

Form Validation question

2010-05-13 Thread zweb
I am using a model form to edit (change) an exisiting row in db. in clean_xxx() method I want to compare the old (existing) value versus new value. I can get new value from cleaned_data. How do I get the old (existing) value? If I do a db query to get the existing row from DB how do I get the

Multiple Database Simple Example

2010-05-13 Thread GRoby
Hello, I am using Django 1.2 RC 1 and have setup multiple databases. I have everything working if I manually specify .using, for example: SomeObjects = ModelInDefaultDatabase.objects.all() #This Works SomeObjects = ModelInDatabase2Name.objects.using('Database2').all() #This also Works How

Re: Shows indendation error

2010-05-13 Thread Jirka Vejrazka
Ravi, the "default" lines where you just uncommented existing lines (like the "include admin") start with spaces, the lines you've created start with Tab characters. Mixing tabs and spaces is not a good practice (generally, it's recommended to use spaces only). If you swich your editor to

Re: Shows indendation error

2010-05-13 Thread Karen Tracey
On Thu, May 13, 2010 at 2:53 AM, ravi krishna wrote: > Hi,,This is my url.py file, when i run this it shows indendation error at > line 25. But i dont see an indendation error. Can somebody help me. I am > just a beginner with Django. > > It would help people help you if

Re: RSS Aggregator

2010-05-13 Thread Michele
I add the following line 'django.contrib.admin', in INSTALLED_APPS and the following line in urls.py .. from django.contrib import admin admin.autodiscover() (r'^admin/', include(admin.site.urls)), but i give an error to access to admin page. Why? -- You received this message

TEMPLATE_DIRS

2010-05-13 Thread Michele Iannotta
Hello, I need help..a putting "on-line" a django application. I have problem setting the "TEMPLATE_DIRS" in setting.py. Someone can help me? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Help me- with the Database

2010-05-13 Thread francisgan9
Hi, I need help how to get pass the installation of the database part. - tutorial 1 trying to use sqlite Ubuntu-Linux-desktop latest version install the latest version for Django The error at the terminal *

Re: RSS Aggregator

2010-05-13 Thread ofri
Try Django-planet: http://github.com/matagus/django-planet On May 12, 9:06 pm, beetlecube wrote: > Hello, >  Just wondering if there are alternatives to the feedjack RSS > aggregator that anyone has used. It doesn't have to be "Django-ized" > like feedjack is. > > Just

Re: Is it ok to super/save() twice in model.save()?

2010-05-13 Thread zinckiwi
> I have overriden the save method on my model, and want to use the id > field (default autoincrementing pk) to set one of the other fields. > > Is this ok: > >   class MyModel(models.Model): >     ... >     def save(self, *args, **kwargs): >       super(MyModel, self).save(*args, **kwargs) >      

Re: HttpResponseRedirect(request.path) after request.POST issue

2010-05-13 Thread Daniel Roseman
On May 13, 1:21 pm, marty3d wrote: > Hi! > > I'm making this small generic voting application and have stumbled > across a strange issue. > My idea is that the user comes to a page, like /news/slug where I'm > having an inclusion tag showing up/down voting controls.

HttpResponseRedirect(request.path) after request.POST issue

2010-05-13 Thread marty3d
Hi! I'm making this small generic voting application and have stumbled across a strange issue. My idea is that the user comes to a page, like /news/slug where I'm having an inclusion tag showing up/down voting controls. Select your choice in the vote form and submit. The inclusion tag then takes

Form validation strange behavior

2010-05-13 Thread Thomas Gautier
Hello, I have the following code in a ModelForm to ensure that the date the user inputs does not exceed 99 years, the strange behavior is that this validation works unless I spam the input button on my form webpage. def clean(self): cleaned_data = self.cleaned_data

Re: Generic web-dev question: Best way to do a processing page?

2010-05-13 Thread derek
On May 1, 4:39 pm, Javier Guerra Giraldez wrote: > On Sat, May 1, 2010 at 7:22 AM, Joshua Russo wrote: > > This is mainly just curiosity at the moment. How do you create a > > "processing" intermediate page, like you see on travel sites when they are >

Is it ok to super/save() twice in model.save()?

2010-05-13 Thread Richard Colley
I have overriden the save method on my model, and want to use the id field (default autoincrementing pk) to set one of the other fields. Is this ok: class MyModel(models.Model): ... def save(self, *args, **kwargs): super(MyModel, self).save(*args, **kwargs)

Re: Shows indendation error

2010-05-13 Thread Kenneth Gonsalves
On Thursday 13 May 2010 12:31:53 ravi krishna wrote: > > (r'^admin/',include('admin.site.urls')), > this line is wrongly indented (that is line 25) -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups

Re: Shows indendation error

2010-05-13 Thread ravi krishna
On Thu, May 13, 2010 at 12:23 PM, ravi krishna wrote: > Hi,,This is my url.py file, when i run this it shows indendation error at > line 25. But i dont see an indendation error. Can somebody help me. I am > just a beginner with Django. > > > from django.conf.urls.defaults

Shows indendation error

2010-05-13 Thread ravi krishna
Hi,,This is my url.py file, when i run this it shows indendation error at line 25. But i dont see an indendation error. Can somebody help me. I am just a beginner with Django. from django.conf.urls.defaults import * from django.conf import settings # Uncomment the next two lines to enable the