Re: modifying a queryset in a generic view wrapper

2008-06-15 Thread Jonas Oberschweiber
Hi, have you considered making a new model method like this: def get_formatted(self): do your rendering stuff You can just use that in your template like {{ post.get_formatted }} and don't have to worry about querysets and generic views. Not sure if that's the best solution, but

Re: SQLobject vs SQLAlchemy

2008-06-15 Thread Russell Keith-Magee
On Mon, Jun 16, 2008 at 12:41 PM, Pepsi330ml <[EMAIL PROTECTED]> wrote: > > I'm interested to know also whether there is any adv in using anyone > of the ORM. > Using the Django ORM will provide ease of use. > But is there a major adv to use Object or Alchemy over the Django ORM?

Re: Django HTML Editor

2008-06-15 Thread Ngu Soon Hui
Thanks everyone. So far what I can see is that there are a lot of editors that are either 1) Free 2) WYSIWYG 3) Support Django template But unfortunately non of them meets all the three criteria. Any more takers? On Jun 14, 2:06 pm, Ngu Soon Hui <[EMAIL PROTECTED]> wrote: > I want a

Re: SQLobject vs SQLAlchemy

2008-06-15 Thread Pepsi330ml
I'm interested to know also whether there is any adv in using anyone of the ORM. Using the Django ORM will provide ease of use. But is there a major adv to use Object or Alchemy over the Django ORM? Russ, You mentioned: "There's nothing stopping you from using SQLObject or SQLAlchemy in

Re: help with fixtures

2008-06-15 Thread Russell Keith-Magee
On Mon, Jun 16, 2008 at 11:36 AM, ristretto <[EMAIL PROTECTED]> wrote: > > I'm running into this too. Can someone confirm this related to MySQL > InnoDB tables or not? This is unrelated to MySQL or InnoDB (although that configuration will cause some difficulties with fixtures that have

Re: modifying a queryset in a generic view wrapper

2008-06-15 Thread joshuajonah
even using a new list object as the queryset doesn't render it: def blog_post(request, year, month, day, slug): queryset = Post.objects.all() modifiedq = queryset from string import replace for item in modifiedq: item.body =

Re: modifying a queryset in a generic view wrapper

2008-06-15 Thread joshuajonah
I'm guessing the object_detail generic view does the actual lookup of the query, how would i extend that in this view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

modifying a queryset in a generic view wrapper

2008-06-15 Thread joshuajonah
I need to format some data in a queryset before it's displayed in the view. It's a date_based.object_detail wrapper. I am trying to change some "[code]" tags into divs, the example is self-explainitory: def blog_post(request, year, month, day, slug): queryset = Post.objects.all()

Fwd: help with fixtures

2008-06-15 Thread ristretto
I'm running into this too. Can someone confirm this related to MySQL InnoDB tables or not? I created a fixture with python manage.py dumpdata --format=json --indent=2 > initial_data.json when I run syncdb (after dropping my app's tables), the data is loaded fine. In fact, if I delete

Re: How to make a wrapper for date_based.object_detail

2008-06-15 Thread joshuajonah
Nevermind, found it in the generic view .py --~--~-~--~~~---~--~~ 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,

Re: Django test Client problems

2008-06-15 Thread Russell Keith-Magee
On Fri, Jun 13, 2008 at 11:28 PM, Chatchai Neanudorn <[EMAIL PROTECTED]> wrote: > Hi, > > If you want to add functionalities to test client, you may need to modify > (or subclass, if posible ) the client code (django.test.client.Client). This will generally be a good approach, but it is not

How to make a wrapper for date_based.object_detail

2008-06-15 Thread joshuajonah
Ok, just trying to do some extra work on the data before i output it to a date_based.object_detail generic view. I can't seem to make a simple wrapper for it so that it is handled with a view. I've tried alot of options, here's where I'm at right now: urls.py:

Re: URL with querystring does not work while doing unittest

2008-06-15 Thread ksachdeva
Thanks. This helped. Regards Kapil On Jun 15, 7:34 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Mon, Jun 16, 2008 at 7:32 AM, ksachdeva <[EMAIL PROTECTED]> wrote: > > > When I try to write a unittest which does self.client.get("/myurl/ > > snode/?S=4=3") I get template does not

Re: URL with querystring does not work while doing unittest

2008-06-15 Thread Russell Keith-Magee
On Mon, Jun 16, 2008 at 7:32 AM, ksachdeva <[EMAIL PROTECTED]> wrote: > > When I try to write a unittest which does self.client.get("/myurl/ > snode/?S=4=3") I get template does not exists (TemplateDoesNotExist > exception). Django's test client doesn't do any intelligent parsing of URLs to pull

URL with querystring does not work while doing unittest

2008-06-15 Thread ksachdeva
Hi, One of the url I have to entertain is "/myurl/snode/?S=4=3". I have not done anything special in urlpatterns to handle this for e.g. my url patter for this is (r'^myurl/snode/ $','site.timtim.views.doSomething') If I go to "/myurl/snode/?S=4=3" from my browser things work. In my view I can

splitting up model definition, row level behaviour and table level behaviour

2008-06-15 Thread Thierry
Im looking to split the above mentioned in different files. Is there any howto on this topic? How have you implemented this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Call for translations / translation reviews

2008-06-15 Thread Marc Fargas
Hi there, We have a few new translations in the bug tracker: Estonian, Vietnamese, Lithuanian, and an Hebrew update. There are not too many users/developers who speak those languages so any help is much appreciated. So, if you have time and speak any of those languages please take a look at the

Re: Lighttpd Vs Apache

2008-06-15 Thread Jeff Anderson
James Matthews wrote: Hi, I am now debating on if i should use Apache with mod_python or Lighttpd with fastcgi. I won't be serving many files (just one webpage for now...) But that page will preform be doing many calculation/database query's. Which one would you guys recommend. Pros and

Re: problem with forms with db access

2008-06-15 Thread ./ed
Hi actually i did not go as smoothly as i expected :( first ModelChoiceField is *really* implemented only on development version (i was on the lastest release) so i had to clean a lot of code plus to obtain the first item on the list of choices (and not the empty string) you need to set the the

Lighttpd Vs Apache

2008-06-15 Thread James Matthews
Hi, I am now debating on if i should use Apache with mod_python or Lighttpd with fastcgi. I won't be serving many files (just one webpage for now...) But that page will preform be doing many calculation/database query's. Which one would you guys recommend. Pros and Cons Thanks James --

Re: Use new variables on templates

2008-06-15 Thread Eric Abrahamsen
Crap, I knew there was something a little off there. On Jun 16, 2008, at 12:50 AM, James Bennett wrote: > > On Sun, Jun 15, 2008 at 11:29 AM, Eric Abrahamsen <[EMAIL PROTECTED]> > wrote: >> One of the things django does for you is make 'settings' available >> everywhere. So if you want to

Re: Use new variables on templates

2008-06-15 Thread James Bennett
On Sun, Jun 15, 2008 at 11:29 AM, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > One of the things django does for you is make 'settings' available > everywhere. So if you want to use these constants in a template, you > should be able to do this in a view: Er. No, no it doesn't. If you want

Re: Use new variables on templates

2008-06-15 Thread Eric Abrahamsen
One of the things django does for you is make 'settings' available everywhere. So if you want to use these constants in a template, you should be able to do this in a view: site_name = settings.SITE_NAME and then pass 'site_name' into a template. Sure hope that's correct... E On Jun 16,

django admin - list edit in place

2008-06-15 Thread Thierry
Im a looking for an admin mode to allow the staff to edit multiple items at once. An edit in place for the standard list view would be great. Or just a list of many forms would also do. Before i start building, is there anything like this available? Greetz, Thierry

Re: problem with forms with db access

2008-06-15 Thread ./ed
Thanks a lot! i had the feeling it was a class/instance issue it should work fine now Thx again ./ed On Jun 15, 4:53 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Sun, Jun 15, 2008 at 7:58 AM, ./ed <[EMAIL PROTECTED]> wrote: > > the problem is that when i add an entry to the aModel

Re: problem with forms with db access

2008-06-15 Thread James Bennett
On Sun, Jun 15, 2008 at 7:58 AM, ./ed <[EMAIL PROTECTED]> wrote: > the problem is that when i add an entry to the aModel table it does > not update in the form (even with various reload scheme) > it does update when I 'touch' the python file. So my guess is the > problem lies in the 'compilation'

Re: problem with forms with db access

2008-06-15 Thread Daniel Roseman
On Jun 15, 1:58 pm, "./ed" <[EMAIL PROTECTED]> wrote: > ## forms.py > class aForm(forms.Form): > choicelist = [(obj.id,obj.myfield) for obj in > aModel.objects.all()] > mod = forms.ChoiceField(choice=choicelist) > > that's not exactly the code because the choice list is

problem with forms with db access

2008-06-15 Thread ./ed
Hi, I'm an experienced programmer in python but I discovered Django last week and managed to deploy a full application in one day! That's a piece of work. I have a slight problem though. I want to have a form with a choice list where items come from the database. For example : ## models.py

Re: How to check if something in one array is in another

2008-06-15 Thread Tim Chase
> The two arrays are just normal dictionaries that look something like > this: > > friends = [id=1,id=2,id=3] > friends2 = [id=3] This is the first suspicious item because if it is a dictionary, the key "id" appears more than once -- something that can't happen with a dict. Sets are the

Re: Django HTML Editor

2008-06-15 Thread James Matthews
Thanks for this post! I am now trying Komodo Edit out. On Sun, Jun 15, 2008 at 8:23 AM, Gene Campbell <[EMAIL PROTECTED]> wrote: > > jEdit - I've used it for years; it is good but not great for django. > But, it's just a killer editor, I don't care. > > > On Sun, Jun 15, 2008 at 3:42 AM, mario

Re: simple python math help.

2008-06-15 Thread Jarred Bishop
Thanks James. I typed the above post before I saw your response. disregard it. On Jun 15, 10:02 pm, Jarred Bishop <[EMAIL PROTECTED]> wrote: > Thanks for that, i see now. However it doesn't solve my problem. Is > there a way to force it to return a decimal when whole numbers are > supplied? > >

Re: simple python math help.

2008-06-15 Thread Gene Campbell
your doing integer division, and / gets you the number of times 200 is divisible by 400, which is 0 times in a integer context. try 200.0/400 if you make one a float, you get a float answer. or this... >>> size = float(200), float(400) >>> size[0]/size[1] 0.5 I'm still quite a python/django

Re: simple python math help.

2008-06-15 Thread Jarred Bishop
Thanks for that, i see now. However it doesn't solve my problem. Is there a way to force it to return a decimal when whole numbers are supplied? I'm using the python image library (http://www.pythonware.com/library/ pil/handbook/image.htm) to resize some images, and the size of those images is

Re: simple python math help.

2008-06-15 Thread James Bennett
On Sun, Jun 15, 2008 at 4:36 AM, Jarred Bishop <[EMAIL PROTECTED]> wrote: > it returns '0'. which isnt much help. how do i get '0.5' or '.5' ? This has a very long history, going all the way back to the C programming language (which the Python interpreter is written in, and which many

Re: simple python math help.

2008-06-15 Thread Sebastian Bauer
size = [200.0, 400.0] return size[0]/size[1] Jarred Bishop pisze: > Hi, this is driving me crazy. I'm sure there is a VERY simple solution > but can't seem to find it. thanks for you help. > > if I have > > size = 200, 400 > return size[0]/size[1] > > it returns '0'. which isnt much

simple python math help.

2008-06-15 Thread Jarred Bishop
Hi, this is driving me crazy. I'm sure there is a VERY simple solution but can't seem to find it. thanks for you help. if I have size = 200, 400 return size[0]/size[1] it returns '0'. which isnt much help. how do i get '0.5' or '.5' ? Thanks.

How to check if something in one array is in another

2008-06-15 Thread Darthmahon
Hi Guys, I'm trying to do a hash lookup with two arrays. Basically, I have a friends list and another list that has user id's. I want to check if any of the user id's I have are also in the friends list. The two arrays are just normal dictionaries that look something like this: friends =

Re: ManyToManyField-- any way to have it editable inline from both sides?

2008-06-15 Thread Russell Keith-Magee
On Sun, Jun 15, 2008 at 12:12 PM, Jason <[EMAIL PROTECTED]> wrote: > > Sorry if this has been addressed-- having trouble figuring out how to > search for this issue. > > Basically, I'd like to be able to edit many-to-many relationships from > both admin screen, so if "articles" has a mtm

Re: Django HTML Editor

2008-06-15 Thread Gene Campbell
jEdit - I've used it for years; it is good but not great for django. But, it's just a killer editor, I don't care. On Sun, Jun 15, 2008 at 3:42 AM, mario <[EMAIL PROTECTED]> wrote: > > Hi, > > Have you tried using TinyMCE. It works and is compatible with Django > Templates including bundled