Re: ModelForm vs CheckboxSelectMultiple

2008-09-20 Thread Martin Ostrovsky
When creating your widget, you need to set empty_label = None, this will supress the '' choice. Also, I think you want to use forms.ModelMultipleChoiceField in conjunction with the widget forms.CheckboxSelectMultiple. On Sep 20, 6:26 pm, "Vance Dubberly" <[EMAIL PROTECTED]> wrote: > End resu

Re: filter queryset in admin

2008-09-21 Thread Martin Ostrovsky
Assuming you're using Django v1.0 ... you could override the queryset method in your class that defines the admin properties for your class. For example: class MyAdminClass(admin.ModelAdmin): def queryset(self, request): # Limit the queryset to some subset based on the value of reque

Re: Django wont display images on my CSS file

2009-03-27 Thread Martin Ostrovsky
Without seeing your settings.py file and urls.py, I can only guess, but you probably don't have serving static media setup correctly. If you're running this on the development server, you'll probably see a 404 next to /site_media/header_background.gif in the terminal window. This means Django can'

Re: Django wont display images on my CSS file

2009-03-27 Thread Martin Ostrovsky
I spoke too soon. Re-reading your comment, it does seem to be entirely a CSS/HTML issue - not Django related. Since the inlined style works, Django is finding the image. Sorry about that misleading response. On Mar 27, 9:07 am, Martin Ostrovsky wrote: > Without seeing your settings.py file

Re: Testing form posting

2009-03-29 Thread Martin Ostrovsky
You're POSTing the form instance, rather than the postedData. So: response = self.client.post('/myApp/post', form) should be: response = self.client.post('/myApp/post/', postedData) More info here: http://docs.djangoproject.com/en/dev/topics/testing/#making-requests On Mar 28, 9:14 pm, tsme

Re: Curious Error

2009-03-29 Thread Martin Ostrovsky
You're passing your template variable `classcolors` to the template filter `random`. Looking at the code for random.py: File "/usr/lib/python2.5/random.py", line 248, in choice return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty IndexError: string index out of range

Re: access to id of current user on admin

2009-05-18 Thread Martin Ostrovsky
Hi, You can define a custom save_models method in the ModelAdmin class you're associating with your Post class (i.e. in your admin.py file for the app in which Post resides). You can then access the user from the request (request.user). More info available at: http://docs.djangoproject.com/en/d

Re: Count by date

2009-11-23 Thread Martin Ostrovsky
You can limit your search by year, month or day. See http://docs.djangoproject.com/en/dev/ref/models/querysets/#year On Nov 20, 1:59 pm, Simon wrote: > Hi all, > > I am sure this must be a real noob question as it's so easy to do in > SQL. > I am trying to replicate something like the following

Django mashup contest

2010-06-10 Thread Martin Ostrovsky
Hi, (Apologies in advance for the spam) Our company, repustate.com, just launched our new natural language processing API. It's totally open & free and is powered by Django. To kick off our launch, we're having a contest to see who can create the best mashup using our API and any others on the we

Re: Making a m2m field required

2010-11-08 Thread Martin Ostrovsky
What about checking the raw POST for existence of data? So in your form, checking self.data.has_key('some_key') On Nov 8, 9:15 am, "Yo'av Moshe" wrote: > Hey, > > I tried this method with no success. > > Adding .clean to my Article's ModelForm and checking it's > self.instance.tags.all(), gives m

Odd behaviour with forms and i18n

2010-03-08 Thread Martin Ostrovsky
Perhaps somebody could explain exactly what's going on. I have a form whose labels are translatable strings: class MyForm(forms.Form): field1 = forms.CharField(label=_('Label 1'), max_length=20) I generated the .po files, supplied the translations, generated the .mo files, added the proper m

syncdb and postgres problems

2008-01-25 Thread Martin Ostrovsky
I'm trying to run syncdb on a clean database (no other tables etc.) in postgres. It produces the standard Postgres error: psycopg2.ProgrammingError: current transaction is aborted, commands ignored until end of transaction block Digging a bit deeper, I see the exception is thrown in get_table_li

Freelance Django Developers

2007-10-03 Thread Martin Ostrovsky
Hello Django Developers, We're looking for Django developers to work on various web applications. You can be located anywhere in the world, but your English has to be very strong. You should be familiar with the following: - source control (svn) - unit testing with Django - AJAX - and of course,

Emailing Error Messages

2006-08-24 Thread Martin Ostrovsky
Hello, Is there an existing method or means in Django to have any exceptions that are caught emailed automatically? Or does this require a bit of custom code? Thanks, Martin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Some function are missing from my Django objects

2006-03-02 Thread Martin Ostrovsky
Hi, I have a ManyToMany relationship between 2 classes as below: class Places(meta.Model): class People(meta.Model): places = ManyToManyField(Places) >From command line, everything is OK. But within a view, an instance of the People class will not have a method get_places_list(). I

Re: Some function are missing from my Django objects

2006-03-02 Thread Martin Ostrovsky
Found the problem. Was importing the wrong models class. Was using the direct path to my models rather than django.models.app_name. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to th

Django & Rico

2006-03-06 Thread Martin Ostrovsky
An out-of-leftfield question, has anybody tried and (successfully) used Rico (openrico.org) with Django? Or any XML over HTTP for that matter with Django? Just looking for some code examples. Thanks. --~--~-~--~~~---~--~~ You received this message because you are

Content-length header

2006-03-22 Thread Martin Ostrovsky
Hi, Does the HttpResponse object set its own content-length header ? (e.g. the size of the template after it has been loaded). If not, how come? - Martin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use

Re: Content-length header

2006-03-22 Thread Martin Ostrovsky
I guess the easiest thing to do is just look at the code myself. For those interested, no it is not set. Other than Content-type, no headers are set explicitly, which is completely fair. --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: How to set up a Flash-based file upload form?

2011-11-10 Thread Martin Ostrovsky
Hey Zak, Take a look at uploadify (www.uploadify.com). It relies on jQuery, but it's probably the plugin you've seen around the net, it's quite popular and easy to setup / modify. On Nov 10, 3:44 pm, zak wrote: > All the cool websites have abandoned the HTML input type="file" tag, > they are usi

Re: run form save in background

2011-12-02 Thread Martin Ostrovsky
I'd rip out the non-db stuff from the form.save() method and put those in an asynchronous queue. Then you can have another process which polls the queue and performs these other tasks after the database save. So for example, you would do the following: instance = form.save() # push your task to t

Re: connection refused when running django-celery

2011-06-05 Thread Martin Ostrovsky
What are you using for your AMQP? I use celery with RabbitMQ. You have to start your AMQP service first, then celery. On Jun 4, 2:17 am, Kenneth Gonsalves wrote: > hi, > > I am trying django-celery, but on running: > > python manage.py celeryd -l info > > I get this error: > > [2011-06-04 01:08:5

Re: Edit instance for ModelChoiceField not getting selected selected

2011-06-05 Thread Martin Ostrovsky
Without seeing your model or your data, it's hard to tell what's going on. You're overriding the queryset for those two fields. If the instance's values for those two fields is not in that updated queryset, then your widgets won't get a default value. In other words, if the value of "b_name" for

Re: Is it possible to specify the html class attribute for a form field?

2010-12-11 Thread Martin Ostrovsky
When you create your form, you can specify extra attributes to each widget of each field. For example: myfield = forms.CharField(widget=forms.Textarea(attrs={'cols':80, 'rows':80}) So as one of the keys in your attrs argument, you can make it 'class' and then provide the class name as the value.

Re: Django and PIL problem?

2011-01-10 Thread Martin Ostrovsky
What's the value of form.cleaned_data['image']? That IOError is usually thrown when the contents of what you pass in to open() don't constitute a valid image. On Jan 10, 5:26 pm, atcive wrote: > I have the same problem:/ > Anyone cah help? -- You received this message because you are subscribed