Re: Forms ModelMultipleChoiceField with checkboxes?

2009-11-22 Thread leoz01
I think the easiest way is to make your own widget or otherwise you can make your own form field. On 19 nov, 10:19, Benjamin Wolf wrote: > Hello, > > I'm using Django's form and ModelMultipleChoiceField. > ModelMultipleChoiceField produces a select list with multiple options. >

Shortcut to create and update a model object?

2009-11-22 Thread Boris Schaeling
Is there a shortcut to create and update a model object from a form? For example I'd like to write something like: MyModel.objects.create(mymodel_form.cleaned_data) or model_obj = get_object_or_404(MyModel, pk=id) model_obj.update(mymodel_form.cleaned_data) Not setting attributes

Re: Application scope variable

2009-11-22 Thread Christophe Pettus
On Nov 22, 2009, at 9:58 PM, aurphir wrote: > How can I have an application scope variable which should be loaded > everytime the app starts app, be in memory and accessible by all until > the app stops. Django applications do not really "start" or "stop"; they're a collection of page handlers

Re: OneToOne across apps

2009-11-22 Thread Trev
Thanks Javier. It seems that I was perhaps thinking about it the wrong way. I believe I understand what you mean - the REFERENCE just keeps the table in order, it doesn't provide any performance boost. The speed boost comes from the indexes that are created, which Django automatically sets up.

Application scope variable

2009-11-22 Thread aurphir
Hi, How can I have an application scope variable which should be loaded everytime the app starts app, be in memory and accessible by all until the app stops. Thanks Vishal -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Problem with ModelForm

2009-11-22 Thread jorge
hi i have a problem when i try to render my form without information . so my code is : models.py class Obra(models.Model): cod_obra= models.CharField("código da obra",max_length=15,primary_key=True) nome_da_empreitada= models.CharField(max_length=100) data_de_incio =

How to customize admin site to upload multiple images

2009-11-22 Thread Radhikavk
hi, model class room_type(models.Model): room_type_id = models.AutoField(primary_key=True,null=False,blank=False) room_type_name = models.CharField(max_length=100,unique=True,null=False,blank=False) room_type_desc = models.TextField(null=True) standard_occupancy =

Re: time date formatting

2009-11-22 Thread Rama Vadakattu
> This clearly does not work ;) > > {{ pick.date "r" }} Why the above will not work? On Nov 21, 3:36 am, matches wrote: > If I want to format the current datetime for an rss feed, I do: > > {% now "r" %} > > I want to format a date the same way coming from a DB in this

Re: OneToOne across apps

2009-11-22 Thread Javier Guerra
Trev wrote: > Am I thinking about this wrong performance wise? all SQL engines i know about either ignore the REFERENCES hint, or use it for defining constraints. the SQL "...WHERE t1.fk=t2.pk" clause is enough to optimally use any index that could help. when Django creates the tables, it

time date formatting

2009-11-22 Thread matches
If I want to format the current datetime for an rss feed, I do: {% now "r" %} I want to format a date the same way coming from a DB in this format "2009-11-18 08:00:00" Is there a way to format it with that same "r" format from a template level? This clearly does not work ;) {{ pick.date "r"

Re: Model inheritance - filtering base model only

2009-11-22 Thread Preston Holmes
Perhaps there is a more efficient way, but in my quick test, one can't filter() a queryset based on __class__ of the model, but seems one can manually filter it afterwords: qs = Player.objects.all() for i,obj in enumerate(qs): if obj.__class__ != Player: del(qs[i]) On Nov 22, 4:32 

Re: Question on how to update an existing record when using ModelForm

2009-11-22 Thread Preston Holmes
On Nov 22, 4:47 pm, Micah Vivion wrote: > Greetings, > > I have a question on how to update an existing row in my database when one of > the fields is my primary key. I am using ModelForm and Django-Piston - my > main goal here is to have RESTful Post send to my

OneToOne across apps

2009-11-22 Thread Trev
Hi there, I am new to Django and SQL, and I'm putting together my first Django project. My project will contain multiple apps, and one app has a model that I'd like to "One To One" extend with a table in a different app. However, it's not behaving how I'd expect, and I can't seem to find any

Trying to do hierarchical tagging using django-tagging-0.3

2009-11-22 Thread pamad
So, I'm trying to extend the Tag-model in tagging.models the following way: from django.db import models from tagging.models import Tag class TagContext(models.Model): context = models.ForeignKey( Tag, unique=True, related_name='context' ) parent = models.ForeignKey( Tag,

Question on how to update an existing record when using ModelForm

2009-11-22 Thread Micah Vivion
Greetings, I have a question on how to update an existing row in my database when one of the fields is my primary key. I am using ModelForm and Django-Piston - my main goal here is to have RESTful Post send to my webservice. I am able to have initial Posts be sent correctly (i.e. that Primary

Re: Django web flow

2009-11-22 Thread Sid
> Err... Do we have to read Spring's doc to find out what this means ? "The Spring Web MVC framework offers a slightly higher level of functionality: form controllers that implement a predefined work flow. " Source: http://www.ervacon.com/products/swf/intro/index.html -- You received this

Model inheritance - filtering base model only

2009-11-22 Thread lfrodrigues
Hello, I have these models: class Player(models.Model): . class PlayerM(Player): ... If I do PlayerM.objects.all() e get all PlayerM objects and for Player.objects.all() I get all Player and PlayerM as expected. How can get only the objects of type Player (only retrieve the

Re: Missing attribute on User

2009-11-22 Thread Russell Keith-Magee
On Mon, Nov 23, 2009 at 1:59 AM, Hanne Moa wrote: > I have models M, N, which both have a foreignkey to User. When in the > shell/runserver, User has attributes for both M and N, but in a > batchfile ($ DJANGO_SETTINGS_MODULE=settings python batch.py) only M > is reachable

Migrating users from legacy db, best practice?

2009-11-22 Thread rikard
Hey guys, So I am starting my first django project, we're going to rebuild a site from scratch and migrate the existing users. But since I am new to django, I wondering what's the best practice for migrating the users. I've been reading the django book about users and registration and also a

Missing attribute on User

2009-11-22 Thread Hanne Moa
I have models M, N, which both have a foreignkey to User. When in the shell/runserver, User has attributes for both M and N, but in a batchfile ($ DJANGO_SETTINGS_MODULE=settings python batch.py) only M is reachable from User while trying to get N leads to AttributeError: 'User' object has no

417 EXPECTATION FAILED in response

2009-11-22 Thread cootetom
Hi all, I recently ran a load test on my django web site which is running on an Apache server. I tested it up to a load of 5000 users. I got a few time out error's on a page that queries mySQL on a date field so I'm going to index that column to see if that solves it. However I also got another

Re: Have var available in every context passed to a template?

2009-11-22 Thread apramanik
Great, that worked! Abhik On Nov 21, 6:52 pm, Christophe Pettus wrote: > On Nov 21, 2009, at 6:48 PM, apramanik wrote: > > > Is there a way (either via decorators or some other mechanism) to get > > an var/object (say request.user) to be in the context passed to every > >

Re: Happy 5th Brithday Firefox

2009-11-22 Thread bittin
Happy Birthday =) On Wed, Nov 11, 2009 at 12:47 AM, aga toytoy wrote: > hmmm it seems we forgot to greet and thank Firefox for it's 5th year of > existence! > > http://www.spreadfirefox.com/5years/en-US/ > http://zi.pe/eft > >

Reverse viewname inside widget doesn't work on django 1.2?

2009-11-22 Thread Joshua Partogi
Hi all, I tried to reverse url by calling: reverse('wmd-settings-js') inside a widget as such: class MarkDownInput(forms.Textarea): class Media: js = (reverse('wmd-settings-js')) But then I would get this error from django: Exception Type: ImproperlyConfigured Exception

Re: How best to display a report?

2009-11-22 Thread adelaide_mike
Nevermind. Found the solution in a post from abrightwell. Thanks. Mike On Nov 22, 8:40 pm, adelaide_mike wrote: > Hi Kenneth, and thanks for the reference.  I must admin I did not > think of looking int he Django docs for ReportLab related stuff. > Should have. >

Re: How best to display a report?

2009-11-22 Thread adelaide_mike
Hi Kenneth, and thanks for the reference. I must admin I did not think of looking int he Django docs for ReportLab related stuff. Should have. My new problem is that the example in the docs uses canvas, but in order to display tabular data I think I need to use SimpleDocTemplate, with which I am