Re: increase integer

2009-02-22 Thread rajeesh
If what you mean is just to hide it from the user, try adding a hidden input to the form and set its value as number. Now there is no need of that number argument in the count's signature. Instead get number as number = request.POST['number']. --~--~-~--~~~---~--~~

Re: How to populate a custom ModelForm?

2009-02-22 Thread rajeesh
Sorry for not including the code before. I've dpasted it now: http://dpaste.com/123850/ . Problem can be summarized as this: I've a model M with certain fields and some foreign keys. I don't want the user to add/edit the FK directly from M's ModelForm. Instead we'll do that in code from certain

Table locking

2009-02-22 Thread XtraGreen
I'm working with a table of objects where all the objects have a unique rank value. When I add an object I need to query the table to get the last object in the rank index, then apply an incremented value to the new object to effectively put it last in the rank order. I need to eliminate the p

Re: model inheritance without a new database table

2009-02-22 Thread Ryan Kelly
> There's a ticket open in Trac (my internet connection is terrible at the > moment, so I'm not going to hunt it out) that is to add an option to the > Meta class saying "this model is not to be managed by Django". Thanks Malcolm, I'll definitely take a look and see if I can help out on the ticket

Re: model inheritance without a new database table

2009-02-22 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 17:11 +1100, Malcolm Tredinnick wrote: [...] > There's a ticket open in Trac (my internet connection is terrible at the > moment, so I'm not going to hunt it out) that is to add an option to the > Meta class saying "this model is not to be managed by Django". > Primarily, tha

Re: model inheritance without a new database table

2009-02-22 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 16:54 +1100, Ryan Kelly wrote: > Hi All, > > > I'm currently working on an authentication backend that adds some > functionality to the standard one, and as part of this I want to modify > the behaviour of the User class. I've been subclassing auth.models.User > using st

model inheritance without a new database table

2009-02-22 Thread Ryan Kelly
Hi All, I'm currently working on an authentication backend that adds some functionality to the standard one, and as part of this I want to modify the behaviour of the User class. I've been subclassing auth.models.User using standard model inheritance and it seems to be working fine. Howeve

Re: 'tuple' object has no attribute 'has_header'

2009-02-22 Thread Margie
You are awesome, Alex. That was exactly it. Many thanks! Margie On Feb 22, 9:08 pm, Alex Gaynor wrote: > On Mon, Feb 23, 2009 at 12:05 AM, Margie wrote: > > > Anyone know what might be causing this error?  It occurs when I fill > > in one of my forms (ie, from the use interface).  I seem to

Re: 'tuple' object has no attribute 'has_header'

2009-02-22 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 12:05 AM, Margie wrote: > > Anyone know what might be causing this error? It occurs when I fill > in one of my forms (ie, from the use interface). I seem to never even > get to the view.py function that processes the POST. > > Traceback (most recent call last): > File "

'tuple' object has no attribute 'has_header'

2009-02-22 Thread Margie
Anyone know what might be causing this error? It occurs when I fill in one of my forms (ie, from the use interface). I seem to never even get to the view.py function that processes the POST. Traceback (most recent call last): File "/tools/aticad/1.0/external/python-2.5.1/lib/python2.5/site- p

Re: Conditional Logic in Template Loop

2009-02-22 Thread Margie
My experience is that using the the various conditional templatetags is painful. I can never seem to do what I want, either because I'm too much of a newbie or there is some gotcha such as "filters don't work inside if" (I seem to remember something like that, but again, it might just be my own p

Re: Conditional Logic in Template Loop

2009-02-22 Thread Malcolm Tredinnick
On Sun, 2009-02-22 at 19:54 -0800, Chris wrote: > Sorry, not sure how that happened. My browser wasn't even opened when > those were sent. > > Anyways, thanks for the suggestion. However, nested if statements (why > doesn't Django support elif?!) Using "elif" wouldn't make things much simpler.

Re: Conditional Logic in Template Loop

2009-02-22 Thread Chris
Sorry, not sure how that happened. My browser wasn't even opened when those were sent. Anyways, thanks for the suggestion. However, nested if statements (why doesn't Django support elif?!) and multiple includes still seems very awkward. I think I'll try using simple_tag to encapsulate my permissi

Re: Django CMS and template tags (is it a problem with pagination mechanism?)

2009-02-22 Thread Theme Park Photo, LLC
No! It was the fact that you really need all the stuff that's on the sample template On Feb 22, 2:29 pm, Donn wrote: > On Sunday, 22 February 2009 21:00:24 Theme Park Photo, LLC wrote: > > {% block content %} > > Hello > > {% end block %} > > It's not this extra space between end and block i

Re: Conditional Logic in Template Loop

2009-02-22 Thread Alex Gaynor
On Sun, Feb 22, 2009 at 10:27 PM, Chris wrote: > > I'm displaying a list of records in a template. I want to > conditionally display controls for each record if the current user is > admin, or the user owns the given record (indicated by record.user == > request.user). > > What's the best way to

Conditional Logic in Template Loop

2009-02-22 Thread Chris
I'm displaying a list of records in a template. I want to conditionally display controls for each record if the current user is admin, or the user owns the given record (indicated by record.user == request.user). What's the best way to do this? Logically, all I want to do is {% if request.user.is

Re: Conditional Logic in Template Loop

2009-02-22 Thread Alex Gaynor
On Sun, Feb 22, 2009 at 10:13 PM, Chris wrote: > > I'm displaying a list of records in a template. I want to > conditionally display controls for each record if the current user is > admin, or the user owns the given record (indicated by record.user == > request.user). > > What's the best way to

Conditional Logic in Template Loop

2009-02-22 Thread Chris
I'm displaying a list of records in a template. I want to conditionally display controls for each record if the current user is admin, or the user owns the given record (indicated by record.user == request.user). What's the best way to do this? Logically, all I want to do is {% if request.user.is

Conditional Logic in Template Loop

2009-02-22 Thread Chris
I'm displaying a list of records in a template. I want to conditionally display controls for each record if the current user is admin, or the user owns the given record (indicated by record.user == request.user). What's the best way to do this? Logically, all I want to do is {% if request.user.is

Re: Two Dimentional Form Data Arrays

2009-02-22 Thread Malcolm Tredinnick
On Sun, 2009-02-22 at 18:54 -0800, ajt111 wrote: > In my above example > It returns a dict with the key as "search[{{result.NAME}}] and the > value as "{{result.CODE}}". This does not allow me to refer the the > data that I want as "search". Does "it" here mean the template that is rendered? Or

Re: Two Dimentional Form Data Arrays

2009-02-22 Thread ajt111
In my above example It returns a dict with the key as "search[{{result.NAME}}] and the value as "{{result.CODE}}". This does not allow me to refer the the data that I want as "search". What I want to end with is a form element that when submitted, will produce a two dimentional dictionary object

Re: get_absolute_url help

2009-02-22 Thread nixon66
Malcolm, Thanks. Will give it a shot. On Feb 22, 7:05 pm, Malcolm Tredinnick wrote: > On Sun, 2009-02-22 at 15:18 -0800, nixon66 wrote: > > not sure I'm understanding how get_absolute_url  to work. > > > in my model I created this > > > class State(models.Model): > >     name = models.CharField

Re: trying to get whether image is wider or deeper in templatetag

2009-02-22 Thread Malcolm Tredinnick
On Sun, 2009-02-22 at 16:23 -0800, David MacDougall wrote: > Hi Malcolm > You are right about the essence of the problem. > The value of photoobj is > "'homepage.get_piece_dict.lead_story.get_lead_photo" and I am trying > to get it to be an integer, the id of the photo I am trying to > measure.

Re: trying to get whether image is wider or deeper in templatetag

2009-02-22 Thread David MacDougall
Hi Malcolm You are right about the essence of the problem. The value of photoobj is "'homepage.get_piece_dict.lead_story.get_lead_photo" and I am trying to get it to be an integer, the id of the photo I am trying to measure. I am wondering if I am losing the "homepage" dict by the time I get t

Re: Passing variables from Django to Javascript after page load

2009-02-22 Thread Alex Gaynor
On Sun, Feb 22, 2009 at 7:07 PM, CALdan wrote: > > Hi! > > I want to pass data from Django to populate javascript variables > dynamically after page load. I'm using ajax.updater to call url's > from Django to update div's within my pages but in some instances it > would be of great use to pass j

Passing variables from Django to Javascript after page load

2009-02-22 Thread CALdan
Hi! I want to pass data from Django to populate javascript variables dynamically after page load. I'm using ajax.updater to call url's from Django to update div's within my pages but in some instances it would be of great use to pass just a variable instead of HTML code. Is there a way of doing

Re: get_absolute_url help

2009-02-22 Thread Malcolm Tredinnick
On Sun, 2009-02-22 at 15:18 -0800, nixon66 wrote: > not sure I'm understanding how get_absolute_url to work. > > in my model I created this > > > class State(models.Model): > name = models.CharField(max_length=80) > slug = models.CharField(max_length=80) > > def __unicode__(self):

Re: Lookup across relations

2009-02-22 Thread Malcolm Tredinnick
On Sun, 2009-02-22 at 22:56 +0700, Reza Muhammad wrote: [...] > > Doesn't work either. This one returns no results, just like chaining > > filters. > > > I think the above was just a clue, if you need "OR" condition instead > of "AND", you need to use "|" not "&" so: > > Project.objects.filter

Announcing django-modeltranslation-0.1

2009-02-22 Thread peschler
I am glad to announce the first release of django-modeltranslation, a Django app which can be used to translate dynamic content of existing models to an arbitrary number of languages without having to change the original model classes. It uses a registration approach (comparable to Django’s admin

Re: Two Dimentional Form Data Arrays

2009-02-22 Thread Malcolm Tredinnick
On Sat, 2009-02-21 at 21:58 -0800, ajt111 wrote: > I want to create a multi-dimentional arry in a form element and > convert that to a list of dicts. > > My form element looks like this: > > If this as part of a loop? What is result? Does it have CODE and NAME attributes or methods or keys? >

Re: How to populate a custom ModelForm?

2009-02-22 Thread Malcolm Tredinnick
On Sat, 2009-02-21 at 20:38 -0800, rajeesh wrote: > > Well, Let me re-phrase that question: I'm currently using the > following line of code to populate text_input fields in the custom > form: > form.base_fields['r_date'].widget.attrs['value'] = > obj.transaction.trans_date > But is this acceptab

Re: passing arguments in HttpResponseRedirect(reverse())

2009-02-22 Thread Malcolm Tredinnick
On Sat, 2009-02-21 at 15:37 -0800, Guri wrote: > Hi, > I need help in solving two small problems. > > 1. A form submitted, after validation calls HttpResponseRedirect > (reverse('view.get_links',args=(request.POST['data']))) > > In url pattern > (r'^links/(?P.*)/',get_links), > > I a

get_absolute_url help

2009-02-22 Thread nixon66
not sure I'm understanding how get_absolute_url to work. in my model I created this class State(models.Model): name = models.CharField(max_length=80) slug = models.CharField(max_length=80) def __unicode__(self): return self.name def get_absolute_url(self): ret

Re: trying to get whether image is wider or deeper in templatetag

2009-02-22 Thread Malcolm Tredinnick
On Fri, 2009-02-20 at 22:03 -0800, David MacDougall wrote: > Hi Malcolm, > Thanks for your patient guidance. I took your advice on a better name > for the variable. Now it should return true if the image_is_vertical. > I am getting a lot closer, but I think I am losing the photo's ID > when I get

Re: Django CMS and template tags (is it a problem with pagination mechanism?)

2009-02-22 Thread Donn
On Sunday, 22 February 2009 21:00:24 Theme Park Photo, LLC wrote: > {% block content %} > Hello > {% end block %} It's not this extra space between end and block is it? \d -- Where I web: http://otherwise.relics.co.za/ Comics, tutorials, software and sundry --~--~-~--~~

Re: Django processes under Apache

2009-02-22 Thread Graham Dumpleton
On Feb 23, 1:29 am, stevedegrace wrote: > I don't think I'm understanding this very well. By doing some > inspection, I see that Apache is running under two PIDs, which makes > sense because ServerLimit right now is set to 2. What I'm wondering > is, does each of those processes have a persiste

Re: Django processes under Apache

2009-02-22 Thread Ryan Kelly
> Based on my experiments, it does seem like each Apache process > maintains a live Django object which it reuses request after request > and which maintains state such as global variables in modules between > requests. Does that mean that a Django instance has some kind of loop > in it that waits

Re: Bookmark URL with form data

2009-02-22 Thread Daniel Roseman
On Feb 22, 4:53 pm, Brian wrote: > My experience level: basic. I'm not a developer by trade and do it as > a hobby. I'm pretty familiar with basic web development--HTML, CSS and > js. I have explored PHP and other technologies to improve my > development. Now I've started developing using Django+

Re: Django processes under Apache

2009-02-22 Thread Stephen DeGrace
Based on my experiments, it does seem like each Apache process maintains a live Django object which it reuses request after request and which maintains state such as global variables in modules between requests. Does that mean that a Django instance has some kind of loop in it that waits for reques

Django CMS and template tags (is it a problem with pagination mechanism?)

2009-02-22 Thread Theme Park Photo, LLC
I can't seem to get django-cms to work with template tags If I specify as my default template something like (stripped to bare essentials here) FOO {% block content %} {% endblock %} and enter in the body of my content for a page to be rendered with this template (in the admin tool) {% block

Re: Default email value for django.contrib.comments?

2009-02-22 Thread peschler
This only happens when you're logged in. The comments app adds the e-mail of the currently logged in user if no other e-mail is given. Even if your site does not allow users to login, you might be logged into the admin which is the same. Logout from the admin, try the comment form again and the

Bookmark URL with form data

2009-02-22 Thread Brian
My experience level: basic. I'm not a developer by trade and do it as a hobby. I'm pretty familiar with basic web development--HTML, CSS and js. I have explored PHP and other technologies to improve my development. Now I've started developing using Django+App Engine Datastore. I've got an applicat

Re: Lookup across relations

2009-02-22 Thread Reza Muhammad
On Feb 22, 2009, at 5:44 PM, 3xM <3...@detfalskested.dk> wrote: > > > > On Feb 21, 10:33 pm, Daniel Roseman > wrote: > >> No need for custom SQL here. This might work: >> Project.objects.filter(persons=person_a, persons=person_b) > > Nope. It just returns projects including person_b. > > >>

Re: ordering of related models in inline admin

2009-02-22 Thread wolfram w
Ok, I finally achieved this by overriding the inline formset, here is all the code that I needed (in admin.py): class WorkSeriesImagesFormset(BaseInlineFormSet): def get_queryset(self): return super(WorkSeriesImagesFormset, self).get_queryset().order_by ('series_order')

Re: Filebrowser No thumbnail generation

2009-02-22 Thread leau2001
I think you right iv got a config problem, but i don't know what it is ? ANother probleme. I used an FIleBrowserField on my model image= FileBrowseField(max_length=200, initial_directory="/ photo_du_jour/", extensions_allowed=['.jpg', '.jpeg', '.gif','.png','.tif','.tiff'], blank=False, null=Fal

Re: send_mail / mail_admins to qmail server

2009-02-22 Thread Reza Muhammad
On Feb 21, 2009, at 12:03 AM, Karen Tracey wrote: > ... > And you don't specify anything like secure sockets or STARTTLS > required for the mail client? > > Lacking source to the mail client (which I'm assuming you don't > have?) to compare what it does with what Django does, I'd > probably t

Django processes under Apache

2009-02-22 Thread stevedegrace
I don't think I'm understanding this very well. By doing some inspection, I see that Apache is running under two PIDs, which makes sense because ServerLimit right now is set to 2. What I'm wondering is, does each of those processes have a persistent instance of Django in its own python process wai

Re: Custom django-admin commands help?

2009-02-22 Thread phyl.jack...@gmail.com
Thanks Daniel, your guess was correct Id left out the handle stuff competely. It appears to be working perfectly now! Phil On 22 Feb, 13:21, Daniel Roseman wrote: > On Feb 22, 1:00 pm, "phyl.jack...@gmail.com" > wrote: > > > > > I have a little custom script that changes some database stuff and

Re: Custom django-admin commands help?

2009-02-22 Thread Daniel Roseman
On Feb 22, 1:00 pm, "phyl.jack...@gmail.com" wrote: > I have a little custom script that changes some database stuff and > sends an email - I want to set it to run on a cron job. > > So Ive been trying to set it up as a custom django-admin command, Ive > been trying to use this little bit of info

Custom django-admin commands help?

2009-02-22 Thread phyl.jack...@gmail.com
I have a little custom script that changes some database stuff and sends an email - I want to set it to run on a cron job. So Ive been trying to set it up as a custom django-admin command, Ive been trying to use this little bit of info- http://docs.djangoproject.com/en/dev/howto/custom-managemen

Re: Filebrowser No thumbnail generation

2009-02-22 Thread leau2001
Ok thx My browser project is on my_project_directory my_project_directory/filebrowser/local my_project_directory/filebrowser/templates my media uploads are : my_project_directory/media/uploads here my config file : my fb_settings.py :http://www.friendpaste.com/475iqfK57DsDWTYklXTlTs my proje

Re: Instantiate a resource once, use in all requests for that server process?

2009-02-22 Thread Jarkko Laiho
Answering my own question: yes, it appears that it works, as long as each view function that uses the client variable says "global client". This brings up another question, concerning concurrency. I haven't yet decided on whether the app will use processes or threads (probably have to test both a

ordering of related models in inline admin

2009-02-22 Thread wolfram w
Hello, sorry if I missed the obvious answer - however I haven't found one in the last hour. I have an image model that has both series and year models as foreign keys - i.e. it belongs to both a series and a year and can be sorted differently within either. For ease of use in the admin I would l

Re: Lookup across relations

2009-02-22 Thread 3xM
On Feb 21, 10:33 pm, Daniel Roseman wrote: > No need for custom SQL here. This might work: > Project.objects.filter(persons=person_a, persons=person_b) Nope. It just returns projects including person_b. > Or you could probably do it with Q objects: > Project.objects.filter(Q(persons=person_

Instantiate a resource once, use in all requests for that server process?

2009-02-22 Thread Jarkko Laiho
Regarding compiling URLconf regexps in the documentation: "This is blazingly fast, because the regular expressions are compiled at load time." If I'm reading that correctly, that means that the compiled regexps are available to all requests, without recompilation, for the lifetime of that particu

Re: MetaWeblog API vs. Atom Publishing Protocol support

2009-02-22 Thread Gour
> "Malcolm" == Malcolm Tredinnick writes: Malcolm> Atom sydnication and Atom publishing are standardised protocols Malcolm> that have gone through the IETF process and are used in lots of Malcolm> situations, weblogging being only one example. Right. Malcolm> The Metaweblog API has not had

Re: increase integer

2009-02-22 Thread eenp...@gmail.com
thanks for the answer, it works and you are right: the render_to_response line contains a typo. Is there also another way to collect the number, so it isn't shown to the user? I was trying to use a QueryDict, something like : nb = request.GET.__getitem__('number') but number is a string and not

Re: Use model of non-installed app

2009-02-22 Thread cheeming
There is a hacky way, which is not good practice and can probably mess with your 3rd party photologue stuff: from myproject1.photologue.models import PhotoSize PhotoSize._meta.abstract = True BR Chee Ming On Feb 22, 12:35 am, TiNo wrote: > On Sat, Feb 21, 2009 at 16:04, Alex Gaynor wrote: >

Re: how to save a file from a remote server?

2009-02-22 Thread ondrey
On Feb 20, 5:12 pm, Jacob Kaplan-Moss wrote: > On Fri, Feb 20, 2009 at 9:25 AM, ondrey wrote: > > In my view I need to save locally a file (image) from a different > > server so I can further process it. But I can't figure out how to do > > it. Can someone help me with that? > > http://docs.pyth

Re: Filebrowser No thumbnail generation

2009-02-22 Thread patrickk
there has never an issue/ticket posted about this (on the google-code page of the filebrowser), so I guess there´s something wrong with your configuration/setup ... you could try to debug by using print- statements within the image-generator function. On Feb 22, 8:02 am, leau2001 wrote: > Patr