Re: keep html

2008-12-07 Thread David Zhou
On Sun, Dec 7, 2008 at 12:12 AM, Karen Tracey <[EMAIL PROTECTED]> wrote: > On Sat, Dec 6, 2008 at 9:17 PM, Patricio Palma <[EMAIL PROTECTED]> > wrote: >> >> Is possible to get the html code from an administration page? >> >> >> I mean, my browser is interpreting a html generated by templates and >

Re: Removing accents from strings

2008-12-07 Thread Dave Dash
Sorry Karen my mistake for leaving that out, that reTagnormalizer just filtered everything that wasn't alphanumeric, the full code is below. Also here's the error from manage.py test File "/restaurant/models.py", line 33, in mealadvisor.restaurant.models.normalize Failed example: normalize(u

Best way to create a for a subset of a model

2008-12-07 Thread Peter
Say I have model with many fields but I want to present a form to edit just a subset of these. The ModelForm class makes preparing a form for a whole model v. easy - somehow it seems there will be a neat way for doing this but I have not been able to find one. Is there such? Thanks, --~--~-

Re: Best way to create a for a subset of a model

2008-12-07 Thread Valts Mazurs
Hello, Please take a closer look at ModelForm documentation: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form Best regards, -- Valts On Sun, Dec 7, 2008 at 15:46, Peter <[EMAIL PROTECTED]> wrote: > > Say I have model with many fields but I want

Re: non-model permissions

2008-12-07 Thread Chris Moffitt
I wrote about this a bit in a blog post here - http://www.satchmoproject.com/blog/2008/nov/28/using-django-permissions/ It's really easy to create any permissions using meta then access them in your views. While the permission is created in the models Meta section, you can certainly use it anywher

Re: Best way to create a for a subset of a model

2008-12-07 Thread Peter
On Dec 7, 1:53 pm, "Valts Mazurs" <[EMAIL PROTECTED]> wrote: > Hello, > > Please take a closer look at ModelForm > documentation:http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a... > > Best regards, > -- > Valts Thanks a lot - that works. I tried it before but it didn't, b

Two different django version on the same server?

2008-12-07 Thread Pablo Ruiz Múzquiz
Hi all, I'm afraid I googled and googled with no success. Django official docs or my django book weren't of any help either. I've got a "legacy" django project which was developed using 0.97svn a year ago and a brand new SVN one, sharing the same server. Django 097 lives at /srv/whatever/django0

DateField format with a ModelForm: populating the form from a model instance

2008-12-07 Thread alex_t
Hi, I've written my own view to create / edit model instances my project, and part of what I wanted to do was to accept dates only in the format dd-mm- (%d-%m-%Y). I searched around a bit and came accross this post: http://groups.google.com/group/django-users/browse_thread/thread/9f84d1b920e

Re: Removing accents from strings

2008-12-07 Thread Karen Tracey
On Sun, Dec 7, 2008 at 4:58 AM, Dave Dash <[EMAIL PROTECTED]> wrote: > > Sorry Karen my mistake for leaving that out, that reTagnormalizer just > filtered everything that wasn't alphanumeric, the full code is below. > Actually I think it worked for me last night because I tested it using an iso88

Complex lookups and SelectMultiple widget

2008-12-07 Thread issya
I am working on a search form that has a SelectMultiple widget. What would be the best way to make a complex lookup with the SelectMultiple widget? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: keep html

2008-12-07 Thread Patricio Palma
On Sun, Dec 7, 2008 at 2:12 AM, Karen Tracey <[EMAIL PROTECTED]> wrote: > > > Something like View->Page Source from the browser menu? (That's what > Firefox calls it -- I'd guess most browsers have some such way to see the > raw html for a page.) Or am I misunderstanding your question? > > Karen

Re: Two different django version on the same server?

2008-12-07 Thread Adi Sieker
Hi, On 07.12.2008, at 16:56, Pablo Ruiz Múzquiz wrote: > Hi all, > > I'm afraid I googled and googled with no success. Django official docs > or my django book weren't of any help either. > > I've got a "legacy" django project which was developed using 0.97svn a > year ago and a brand new SVN on

Looking up a field's values against another model

2008-12-07 Thread eldonp2
In one of my models, I have defined a field as follows: business = models.ManyToManyField('Business', choices=Business.objects.all()) How do i get the choices to be read from the Business model? I get the following errors in the admin console... Request Method: GET Request URL:ht

Writing SOAP Server in Django

2008-12-07 Thread danlester
There are some posts on this list from a year or two ago suggesting that there is a contrib module allowing a SOAP server to be built in Django easily. It certainly isn't part of Django 1.0.2... Has anyone built a SOAP server using Django recently? I've been able to get something going using soa

Re: Looking up a field's values against another model

2008-12-07 Thread Dj Gilcrease
my_choices = [(bo.id, bo.name) for bo in Business.objects.all()] business = models.ManyToManyField('Business', choices=my_choices) But can I ask why you are trying to set the choices value on a ManyToMany relationship? The admin will already automaticly only let you select from the Business model

fields in object.values()

2008-12-07 Thread sotiris.kazakis
hello, I search a lot about the use of object.values() but don't get what I want. I want to put dynamically (with a string ?) the fields that I want to get from a model. i.e.: #model Class Test(model.Model) Id = models.AutoField(primary_key=True, verbose_name="a/a") Name = models.CharFiel

Re: fields in object.values()

2008-12-07 Thread Alex Koshelev
Manager's `values` method excepts list of field names but you give the string. Try this: tbData = tableName.objects.values(*strFld.split(",")) On Sun, Dec 7, 2008 at 23:48, sotiris.kazakis <[EMAIL PROTECTED]>wrote: > > hello, > > I search a lot about the use of object.values() but don't get what

Re: Non-displayed fields on admin form get overwritten

2008-12-07 Thread borntonetwork
Hi Rajesh. Sorry for the extended period of time between posts -- this is a weekend project for me. The code I pasted (poorly) *is* the model code that causes the problem, minus the last couple of field entries. So instead of this at the end of my fields list: 'paypal_number', 'pending_ref

range-like template tag?

2008-12-07 Thread Berco Beute
Is there a template tag to turn an int into a sequence (like 'range')? What I want to do is populate a select widget with the numbers up to the int, like: == {% for i in someInt.range %} {{i}} {% endfor %} == Passing the sequence

Re: Removing accents from strings

2008-12-07 Thread Malcolm Tredinnick
On Sun, 2008-12-07 at 11:12 -0500, Karen Tracey wrote: > On Sun, Dec 7, 2008 at 4:58 AM, Dave Dash <[EMAIL PROTECTED]> wrote: > > Sorry Karen my mistake for leaving that out, that > reTagnormalizer just > filtered everything that wasn't alphanumeric, the full code

Re: keep html

2008-12-07 Thread Malcolm Tredinnick
On Sun, 2008-12-07 at 14:24 -0300, Patricio Palma wrote: > > > On Sun, Dec 7, 2008 at 2:12 AM, Karen Tracey <[EMAIL PROTECTED]> > wrote: > > > > > Something like View->Page Source from the browser menu? > (That's what Firefox calls it -- I'd g

Re: keep html

2008-12-07 Thread Patricio Palma
On Sun, Dec 7, 2008 at 8:45 PM, Malcolm Tredinnick <[EMAIL PROTECTED] > wrote: > > > On Sun, 2008-12-07 at 14:24 -0300, Patricio Palma wrote: > > > > > > On Sun, Dec 7, 2008 at 2:12 AM, Karen Tracey <[EMAIL PROTECTED]> > > wrote: > > > > > > > > > > Something like View->Page Source from th

Re: Removing accents from strings

2008-12-07 Thread Dave Dash
Thanks Karen and Malcolm, I kind of got the sense that I wasn't alone with the doctest issue. I suppose there's always the unittests that I could write as well that wouldn't likely suffer the same issues, right? -d On Dec 7, 3:43 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 200

Re: Removing accents from strings

2008-12-07 Thread Malcolm Tredinnick
On Sun, 2008-12-07 at 17:48 -0800, Dave Dash wrote: > Thanks Karen and Malcolm, > > I kind of got the sense that I wasn't alone with the doctest issue. I > suppose there's always the unittests that I could write as well that > wouldn't likely suffer the same issues, right? Correct. Doctests ar

Re: Reducing the number of my view's database queries

2008-12-07 Thread Dave Dash
Without knowing too much about your code, the only thing I can say, having had a similar issue, was that select_related witha specified depth generally made for more efficient queries. For fun, I started on some code to output database queries on all my pages while I'm debugging: Queries

Re: Reducing the number of my view's database queries

2008-12-07 Thread Malcolm Tredinnick
On Sun, 2008-12-07 at 18:09 -0800, Dave Dash wrote: > Without knowing too much about your code, the only thing I can say, > having had a similar issue, was that select_related witha specified > depth generally made for more efficient queries. This is quite true. Also remember that if you know w

time it takes django to read database?

2008-12-07 Thread garagefan
following another tutorial to build a blog (webmonkey.com's) at it was rather frustrating to see nothing show up after creating a new blog... the admin section seems to see these right away, as they are there as soon as you hit save. But it seems to take the one section 10-20(or more?) minutes to

how to use generic_inlineformset_factory ?

2008-12-07 Thread Marco Louro
Hi, I'm trying to use generic_inlineformset_factory. There are no docs for it except a Generic Relations Model example @ http://www.djangoproject.com/documentation/models/generic_relations/ on the bottom (GenericInlineFormSet tests) My question here is how to pass the POST vars to it? In a mode

Re: how to use generic_inlineformset_factory ?

2008-12-07 Thread Malcolm Tredinnick
On Sun, 2008-12-07 at 19:46 -0800, Marco Louro wrote: > Hi, > > I'm trying to use generic_inlineformset_factory. There are no docs for > it except a Generic Relations Model example @ > http://www.djangoproject.com/documentation/models/generic_relations/ > on the bottom (GenericInlineFormSet test

Issue with authenticate and login

2008-12-07 Thread Zeroth
Currently, when I login, it doesn't show me as having logged in, or logged out. Doesn't show up until I restart the server. I think it may be an issue with the session framework. Here's the dpaste link of my login view, and my middleware/installed apps settings. _login is the provided authenticat

Re: range-like template tag?

2008-12-07 Thread Jeff FW
You could write a very simple filter to do this. Something like (untested): def range(top): return xrange(0, top) then use {% for i in someInt|range %} I think it would still be better to pass it in the context--why can't you do that? -Jeff On Dec 7, 5:12 pm, Berco Beute <[EMAIL PROTECTE

Re: how to use generic_inlineformset_factory ?

2008-12-07 Thread Marco Louro
Thanks for quick reply Malcom. This is the code for my view. I know I'm missing something, the formsets do show up correctly on the form page, but I'm just not seeing how to load the request.POST data into the formset for validation and save The error I get is: Exception Value: 'Manager' object

Re: Looking up a field's values against another model

2008-12-07 Thread eldonp2
Thanks Dj Glicrease: I see that the the admin interface works just as you said. Thats pretty smart. However, I don't see the name of the related object, it show something like... Here's the model... class TestModel2(models.Model): m2mfield1 = models.ManyToManyField('TestModel1') active

Re: time it takes django to read database?

2008-12-07 Thread garagefan
ok... i've been able to figure out how long it takes based on the time stamp... an hour and a half for a new object to have come in. It appears that the item is not readable by the two templates, one of which using {%for object in latest $} and then another template that doesn't use it at all. th

Re: Reducing the number of my view's database queries

2008-12-07 Thread Malcolm Tredinnick
On Sat, 2008-12-06 at 20:56 -0800, erikcw wrote: > Hi all, > > I'm trying to write a model query that will return a queryset along > with the latest (and earliest) data from 2 related models. > > Right now I'm doing something like this: > > objects = Model1.objects.filter(user=3).select_relate

variables inside variables in templates

2008-12-07 Thread Vicky
Is there a way to use variables like: {{ content.{{ items}} }} ?? I need do send the object and field names to template and access content of that field from template. This thing works: {{ content.name }} But i need the thing after '.' also to be a variab

Re: variables inside variables in templates

2008-12-07 Thread Malcolm Tredinnick
On Sun, 2008-12-07 at 21:41 -0800, Vicky wrote: > Is there a way to use variables like: > > {{ content.{{ items}} }} > > ?? http://groups.google.com/group/django-users/browse_thread/thread/c7e3496fae2e1a31 That thread includes both the reason this isn't in the core templates

Re: time it takes django to read database?

2008-12-07 Thread Alex Koshelev
Do you use caching? On Mon, Dec 8, 2008 at 07:34, garagefan <[EMAIL PROTECTED]> wrote: > > ok... i've been able to figure out how long it takes based on the time > stamp... an hour and a half for a new object to have come in. It > appears that the item is not readable by the two templates, one of

Re: Complex lookups and SelectMultiple widget

2008-12-07 Thread krylatij
> I am working on a search form that has a SelectMultiple widget. What > would be the best way to make a complex lookup with the SelectMultiple > widget? try this: try: district_ids = [int(x) for x in request.GET.getlist('district')] if len(district_ids) == 0: district_ids = [

Re: how to use generic_inlineformset_factory ?

2008-12-07 Thread Marco Louro
Well, i've spent countless hours on this, and it was so easy.. I guess it could be added to the docs since It's a really nice feature. I've posted my very bad view code at dpaste, but it might be enough if anyone who has a similar problem http://dpaste.com/hold/96937/ On Dec 8, 4:28 am, Marco