model.save() lifecycle

2009-03-21 Thread chefsmart
The Django tutorial says in Part 1: [_Begin Quote_] # Create a new Poll. >>> import datetime >>> p = Poll(question="What's up?", pub_date=datetime.datetime.now()) # Save the object into the database. You have to call save() explicitly. >>> p.save() # Now it has an ID. Note that this might say "

Re: Count filtered by status

2009-03-21 Thread Jamie Pittock
Malcolm, thanks very much for this. I don't have time to properly look at this until Monday but I wanted to at least acknowledge before then my appreciation of your replies. I'll no doubt be back with either more thanks or more questions. On Mar 21, 4:55 am, Malcolm Tredinnick wrote: > On Sat

Re: [Newbie] how to output value like this?

2009-03-21 Thread Malcolm Tredinnick
On Fri, 2009-03-20 at 23:53 -0700, andrew wrote: > Hi ,all > >I encounter a issue lasting 3 days, any help will be highly > appreciate. > > view: > market_volumn={} > for m in marketTypeList: > market_volumn[m]=MarketVolumn.objects.filter > (marketType=m).order_by('week')

Re: model.save() lifecycle

2009-03-21 Thread Malcolm Tredinnick
On Sat, 2009-03-21 at 00:17 -0700, chefsmart wrote: [...] > After calling save() on the model, we see that "Now it has an ID". > > So Django is doing an SQL select query, something like last_insert_id, > if I'm not wrong? That's correct. It varies for each database backend as to which SQL we exe

Re: model.save() lifecycle

2009-03-21 Thread chefsmart
> Does that answer your question? Yes Malcolm, thanks. I was trying to follow the call path to where Django asks the DB for the id. I'm new to Python, so I guess that's how I got lost. Thanks for the help. Regards. On Mar 21, 2:32 pm, Malcolm Tredinnick wrote: > On Sat, 2009-03-21 at 00:17 -0

Re: Django web site upload problem

2009-03-21 Thread Daniel Roseman
On Mar 20, 7:34 pm, YuDe wrote: > Hi, > I have been browsing the documentation, but I could not find obvious > link to instructions of uploading the file that created through > tutorials. > > I have a server and use winSCP to upload htmls. Is there a page that > instruct us how to publish webpage

Re: how to output value like this?

2009-03-21 Thread andrew
Thanks you for your detailed solution. I just didn't know the existence of market_volumn.ITEMS so I didn't know how to output the "volumn", shame on me of poor python knowledge . Anyway ,problem solved! applauds! On Mar 21, 5:22 pm, Malcolm Tredinnick wrote: > On Fri, 2009-03-20 at 23:53 -0700,

Re: Poll system (polldaddy) ?.

2009-03-21 Thread rdgmor...@gmail.com
Can somebody 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 django-users@googlegroups.com To unsubscribe from this group, send email to django-use

django-cms error "VariableDoesNotExist: Failed lookup for key [page] in u"

2009-03-21 Thread Muslu Yüksektepe
i am trying to django-cms. i have a model photoalbum when i link this url it says error Caught an exception while rendering: Failed lookup for key [page] in u"[{}, {}, {}, {}, {}, {'son_fotoalbumler': []}]" 99 {% cms_subpages page as subpages %} 100 {% if subpages %} 101 {% trans "

Re: Django versioning and backup best practice

2009-03-21 Thread Philippe Raoult
Hi, I started my project with a similar workflow but I soon ran into troubles so I adopted the following one: - svn repository has a production branch and a trunk - my dev is done on trunk, on various machines (desktop, laptop, test server) - whenever I want to push something to the production s

Multiple ModelAdmins for a single Model

2009-03-21 Thread Dan Ward
Hello, I have a table, which contains three types of page. Each page has its own type of information. Up to now, all possible fields from the table have been displayed on an admin form and a drop down box provides the option to determine the type of page (page_type). Validation is carried out pe

Re: [Newbie] how to output value like this?

2009-03-21 Thread tofergus
On 20.03-23:53, andrew wrote: [ ... ] >I encounter a issue lasting 3 days, any help will be highly > appreciate. your question is too vauge (to me) to be "assistable". i can only ask if you've done the tutorials (which are pretty good) and if so then suggest you try including more complete c

hi

2009-03-21 Thread Amit Upadhyay
Hey, Checkout www.RemindMeSam.com . -- Amit Upadhyay Via - www.remindmesam.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@googlegroup

[Newbie] Problem with startproject

2009-03-21 Thread Alnain
Hi! I'm new in Django, and I have a little problem with the starting. I tried to create a new project, using django-admin.py startproject mysite, but it raises an error: "ImportError: no module named django.core". I know that it means that there isn't a required file, but I don't konw why it isn'

Re: Django versioning and backup best practice

2009-03-21 Thread dalore
I wouldn't keep the database files in svn. If you want to save the data in source control I recommend looking at dumping the data into a json or yaml file. Then save that into source control. My workflow I use sqlite when running locally for dev purposes, but on production it uses mysql. I have

Error 32: The process cannot access the file because it is being used by another process

2009-03-21 Thread Alexandre
Hi, I'm trying to apply this snippet http://www.djangosnippets.org/snippets/1129/ but i have this error: "Error 32: The process cannot access the file because it is being used by another process". I'm working with Windows XP the error lines are ,.. field.storage.delete(final_name) ,.. field.stor

GenericRelation in admin interface

2009-03-21 Thread Psihonavt
Good evening, i have three models, for example: class tProduct(models.Model): name = models.CharField(_("Name"), max_length=20, blank=True) category = models.ManyToManyField(tCategory, blank=True, verbose_name=_("Category")) objects = tProductManager() content_type = models.Forei

A confusing output

2009-03-21 Thread koranthala
Hi, Using Django 1.1 I have the following filter p = DB.filter( value_in = values, name__in = names).select_related() I am facing 2 issues in here. 1. Unexpected DB queries I did p = list(p) The total queries was 1 I then did p = list(p) for a in p: pass Now, the total queries is comi

Installing Django for rapidsms

2009-03-21 Thread dbbarua
Hi , I am trying to use Django for rapidsms , i get the following error when i run r...@portable:/usr/local/rapidsms-dev/rapidsms/rapidsms# python manage.py syncdb raceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/usr/lib/python2.5/site-

Re: Installing Django for rapidsms

2009-03-21 Thread James Bennett
On Sat, Mar 21, 2009 at 2:07 PM, dbbarua wrote: > Hi , >    I am trying to use Django for rapidsms , i get the following error > when i run > r...@portable:/usr/local/rapidsms-dev/rapidsms/rapidsms# python > manage.py syncdb ...snip... > TypeError: __init__() got an unexpected keyword argument

Re: Installing Django for rapidsms

2009-03-21 Thread Alex Gaynor
On Sat, Mar 21, 2009 at 3:07 PM, dbbarua wrote: > > Hi , >I am trying to use Django for rapidsms , i get the following error > when i run > r...@portable:/usr/local/rapidsms-dev/rapidsms/rapidsms# python > manage.py syncdb > > raceback (most recent call last): > File "manage.py", line 11, in

Aggrevate and offsets

2009-03-21 Thread Filip Gruszczyński
I have a following question. I started using 1.1 alpha and encountered such an issue. Should I consider it a bug or is it working properly? If it is not, is there any workaround, that would get me an average for a certain number of elements. >>> Salary.objects.all().aggregate(Avg('value')) {'valu

Re: Aggrevate and offsets

2009-03-21 Thread Alex Gaynor
2009/3/21 Filip Gruszczyński > > I have a following question. I started using 1.1 alpha and encountered > such an issue. Should I consider it a bug or is it working properly? > If it is not, is there any workaround, that would get me an average > for a certain number of elements. > > >>> Salary.o

Filmaster -- a free film buff community, based on django and Pinax

2009-03-21 Thread mic...@jakilinux.org
Hello everyone! I've got a small announcement. We've just rolled out a private beta version of Filmaster, an open-source project implemented in django that uses a lot of pinax modules to make it work Filmaster is a social network for film buffs with personalized recommendations. All the code is

Re: Multiple ModelAdmins for a single Model

2009-03-21 Thread Malcolm Tredinnick
On Sat, 2009-03-21 at 03:31 -0700, Dan Ward wrote: [...] > What I'd like to do, to simplify the interface for end users, is > provide three separate ModelAdmins for each page type, so in the > Django admin site I'd like to have "Web Site Pages", "Video Pages", > "Message Pages", as apposed to the

Re: Multiple ModelAdmins for a single Model

2009-03-21 Thread Alex Gaynor
On Sat, Mar 21, 2009 at 5:58 PM, Malcolm Tredinnick < malc...@pointy-stick.com> wrote: > > On Sat, 2009-03-21 at 03:31 -0700, Dan Ward wrote: > [...] > > What I'd like to do, to simplify the interface for end users, is > > provide three separate ModelAdmins for each page type, so in the > > Django

Re: A confusing output

2009-03-21 Thread Malcolm Tredinnick
On Sat, 2009-03-21 at 11:46 -0700, koranthala wrote: > Hi, >Using Django 1.1 >I have the following filter > p = DB.filter( value_in = values, name__in = names).select_related() If you're asking us to work out what's going on with respect to database queries, it's going to be very importan

Re: Multiple ModelAdmins for a single Model

2009-03-21 Thread Malcolm Tredinnick
On Sat, 2009-03-21 at 18:01 -0400, Alex Gaynor wrote: [...] > In the development version there's actually a more clever solution to > this. You can create pure python subclasses(proxy classes) that use > the same DB table and fields and everything, but have their own class. > So you could create

Not executing all middlewares/context processors?

2009-03-21 Thread chachra
Hi, Sorry if this is a common question, my searches didn't lead to an answer! I developed an application, using context_processors, middlewares etc. Now I am trying to run a few other domains based on app config, say xyz.com. But I don't want all my app specific middlewares and context_processor

Re: [Newbie] Problem with startproject

2009-03-21 Thread André Santos
Try this: python -c "import django" If it returns one error, than django wasnt installed correctly. 2009/3/21 Alnain : > > Hi! > > I'm new in Django, and I have a little problem with the starting. I > tried to create a new project, using django-admin.py startproject > mysite, but it raises an err

Re: Aggrevate and offsets

2009-03-21 Thread Filip Gruszczyński
That explains everything. Thanks. 2009/3/21 Alex Gaynor : > > > 2009/3/21 Filip Gruszczyński >> >> I have a following question. I started using 1.1 alpha and encountered >> such an issue. Should I consider it a bug or is it working properly? >> If it is not, is there any workaround, that would g

problem with sorl-thumbnail invalid image

2009-03-21 Thread Nate Reed
I have a model that uses sorl-thumbnail.ImageWithThumbnailsField: class Vendor(models.Model): url = models.URLField() logo = ImageWithThumbnailsField( blank = True, null = True, upload_to = 'logos', thumbnail={'size': (80, 80)} ) When I try to create a

Re: problem with sorl-thumbnail invalid image

2009-03-21 Thread Nate Reed
More info: >>> im = Image.open('my_logo.png') >>> outfile = 'my_logo.jpg' >>> im.save(outfile) Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 1272, in save self.load() File "/usr/lib/python2.4/site-packages/PIL/ImageFil

Re: problem with sorl-thumbnail invalid image

2009-03-21 Thread Malcolm Tredinnick
On Sat, 2009-03-21 at 17:33 -0700, Nate Reed wrote: [...] > Is there some way I can work with interlaced PNG's in PIL? Typing "PIL interlaced PNG" into Google suggests not. That's one of those problems that will be fixed by somebody with sufficient motivation to write a patch for PIL, I suspect.

navigation in base.html from categories model?

2009-03-21 Thread tdelam
Hi Guys, I have a categories model, I need to generate a nav based on this model. Categories get added through the Django admin. I have a slug field that is prepopulated from the title. How can I generate this nav in base.html and still be able to pull up all the items related to that category wh

Re: problem with sorl-thumbnail invalid image

2009-03-21 Thread Nate Reed
As a workaround I used Gimp to convert this image to a compatible format before uploading it. Hopefully my users won't mind this limitation. It does seem a rather glaring omission from PIL, though, doesn't it? Nate On Sat, Mar 21, 2009 at 5:38 PM, Malcolm Tredinnick < malc...@pointy-stick.com>

internationalization django app

2009-03-21 Thread Akhmat Safrudin
Helo, is it available internationalize django app with the language not listed under : django/conf/global_settings.py ? and just add the app/myapp/locale/mylang/LC_MESSAGES/django.po ? thank's. --~--~-~--~~~---~--~~ You received this message because you are subsc

auth.views.logout has pointless code

2009-03-21 Thread Ross Dakin
It looks like the " or request.path" does no good in the last line, since we're always going to have a next_page if we branch to that statement: def logout(request, next_page=None, template_name='registration/ logged_out.html'): "Logs out the user and displays 'You are logged out' message."

Re: internationalization django app

2009-03-21 Thread Malcolm Tredinnick
On Sun, 2009-03-22 at 12:13 +0700, Akhmat Safrudin wrote: > Helo, > is it available internationalize django app with the language not listed > under : django/conf/global_settings.py ? > and just add the app/myapp/locale/mylang/LC_MESSAGES/django.po ? No. This is documented here: http://docs.djan