Re: Limiting selection in admin pages [NEWBIE]

2006-05-15 Thread qhfgva
Thanks for the tip. Your example didn't quite work for me. I changed it to: 'groups__name__exact' Possibly it's because we are using different versions? I'm using the most recent trunk (magic-removal-branch). One question if you don't mind answering. I'm guessing that there is juju going on

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Ivan Sagalaev
Jay Parlar wrote: >Hmm... So let me get this straight... When someone does an upload via >my form, Django *temporarily* stores it in my uploads directory, with >the "_" at the end of the filename, right? > No. It tries to save the file with the given name and appends '_' only when there are alre

Re: django.po please try this

2006-05-15 Thread coulix
solution: use msgfmt -f so ...po --~--~-~--~~~---~--~~ 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, send e

Re: Many to Many challenges

2006-05-15 Thread Malcolm Tredinnick
Hi Chris, On Mon, 2006-05-15 at 20:44 -0500, Chris Moffitt wrote: > I seem to really be struggling with many-to-many and getting it all to > work. I'm using trunk (ver 2909) Here's the model I'm using- > > class Reporter(models.Model): > fname = models.CharField(maxlength=30) > lname =

Re: dynamic templates for form fields

2006-05-15 Thread Malcolm Tredinnick
On Mon, 2006-05-15 at 16:59 +0200, Alexandre CONRAD wrote: > Hello, > > I've already talked about it in the IRC channel, but I'm posting here to > make sure... > > I have a model Client like so: > > class Client(models.Model): > name = models.CharField(maxlength=30, core=True) > cont

Re: Problems with ForeignKey in magic-removal

2006-05-15 Thread Malcolm Tredinnick
On Mon, 2006-05-15 at 09:27 -0700, beewee wrote: > Hello, > > thanks for your fast answer, it worked :D Thinking out loud a bit here, more as a reminder to myself: but I wonder _why_ this worked? If you have no __str__ method, it will fall back to __repr__, so you should have been seeing the sam

Many to Many challenges

2006-05-15 Thread Chris Moffitt
I seem to really be struggling with many-to-many and getting it all to work. I'm using trunk (ver 2909) Here's the model I'm using- class Reporter(models.Model): fname = models.CharField(maxlength=30) lname = models.CharField(maxlength=30) class Admin: pass class Site(mo

Re: passing values into form templates

2006-05-15 Thread Bill de hÓra
Bill de hÓra wrote: > So after catching the source URL off the POST request, and before > forwarding to the template, I seem to have two choices: > > - write the link into the FormWrapper/AddManipulator configuration's > data. > > - pass the link along as another param to the template >

Re: Limiting selection in admin pages [NEWBIE]

2006-05-15 Thread tonemcd
This works (it's the pa - personal assistant - bit you want); class Person(models.Model): firstName = models.CharField(maxlength=50) lastName = models.CharField(maxlength=50) organization = models.ManyToManyField(Organization, related_name = 'organization') emailAddress = models.E

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Jay Parlar
On 5/15/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > > Jay Parlar wrote: > > >I'm still curious though if doing the > >new_data.update(request.FILES.copy()) is the best way to do that part > >of it. > > > > > Only if you don't care of lost files in your upload :-). Here's the code > that I use i

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Ivan Sagalaev
Jay Parlar wrote: >I'm still curious though if doing the >new_data.update(request.FILES.copy()) is the best way to do that part >of it. > > Only if you don't care of lost files in your upload :-). Here's the code that I use in my project to handle this. The function receives list of file fiel

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Ivan Sagalaev
Jay Parlar wrote: >Ahh, very cool. How should I build the new_data object though? Is >this the *right* way? > >new_data = request.POST.copy() >new_data.update(request.FILES.copy()) > > Well... In general it's a bit tricky. Doing it like this and feeding this new_data to manipulator will valid

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Jay Parlar
On 5/15/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > On 5/15/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > > > Instead of saving your file manually use Django's helper method: > > > > obj = manipulator.save(new_data) > > info = request.FILES['firmware_file'] > > obj.save_firmware_file_

django.po please try this

2006-05-15 Thread coulix
Hi i have a weid translation problem in setting.py language is fr-fr in a template foo i do {% load i18n %} then {% trans "Your name:" %} {% trans "Jumps to the admin page for pages that represent a single object." %} it outputs one non translated, one transalted : Your name: Renvoie à la page

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Jay Parlar
On 5/15/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > Instead of saving your file manually use Django's helper method: > > obj = manipulator.save(new_data) > info = request.FILES['firmware_file'] > obj.save_firmware_file_file(info['filename'], info['content']) > > This not only fills

Re: add the same fields to all my models: inheritance?

2006-05-15 Thread Bill de hÓra
gabor wrote: > so, is everyone just cut&paste-ing all this stuff into every model? I am :) I do it a lot for date based stuff (created/modified) to support admin/generic views. But whenever it gets figured out all I'll have to do is change the superclass and delete some cruft - not so bad. Bt

ManyToManyField reverse lookup not working

2006-05-15 Thread der . elminator
hi, i am using this set of models: # -*- encoding: utf-8 -*- from django.db import models from django.contrib.auth.models import User from myproject.tagging.models import Tag class Blog(models.Model): topic = models.CharField(maxlength=120) tags = models.ManyToManyField(Tag) class A

passing values into form templates

2006-05-15 Thread Bill de hÓra
Hi, I have this forms contortion where a default value in the form varies based on the initial use choice, and I'm looking to see what's the sanest way to support it in django. It goes like this: User on any page can from a selection state a type of feedback ("this page", "this site", "other"

Re: Problems with ForeignKey in magic-removal

2006-05-15 Thread beewee
Hello, thanks for your fast answer, it worked :D BeeWee --~--~-~--~~~---~--~~ 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

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Ivan Sagalaev
Jay Parlar wrote: >However, I need to use this with my own view, which currently looks as follows: > >def upload_file(request): >manipulator = FirmwareUpload.AddManipulator() >if request.POST: >new_data = request.POST.copy() >new_data['firmware'] = _save_file(request.FILES

Re: Best practice for separating Model and Control?

2006-05-15 Thread lcaamano
We're not using Django yet but I think I have a good idea of how we'd use it in our framework. I'll try to summarize that in a few paragraphs, which hopefully will give you another idea of how to deal with the problem you present. We use two modules per table, one has the "manager class" and the

Accessing a field's upload_to strftime

2006-05-15 Thread Jay Parlar
I have a field in a model as follows: class FirmwareUpload(models.Model): firmware = models.FileField(upload_to="uploads/%A-%B-%Y") ... If I do an upload through the Admin, everything works great, a directory gets created with the strftime info filled in. However, I need to use this wit

Re: Problems with ForeignKey in magic-removal

2006-05-15 Thread arthur debert
Hi beewee, __repr__ has been replaced by __str__ . this is more of a return to python conventions than anything. try changing your __repr__ methods to __str__ ones. more on this here: http://groups.google.com/group/django-users/browse_frm/thread/9f6f205e0f9cbc8e/800b8c3367f79b38?q=__str__&rnum=

dynamic templates for form fields

2006-05-15 Thread Alexandre CONRAD
Hello, I've already talked about it in the IRC channel, but I'm posting here to make sure... I have a model Client like so: class Client(models.Model): name = models.CharField(maxlength=30, core=True) contact_name = models.CharField(maxlength=30, blank=True) contact_email = mode

Problems with ForeignKey in magic-removal

2006-05-15 Thread beewee
Hi all! I've got a webpage using django. The website worked without problems until I installed the magic-removal. Although I obeyed everything here http://code.djangoproject.com/wiki/RemovingTheMagic the admin panel isn't working correctly. Here's a (shorted) code of my models: class Thread(mode

Limiting selection in admin pages [NEWBIE]

2006-05-15 Thread qhfgva
I have a table like Contracts contract_number : text faculty : foreign_key to User As expected ALL the users show up in this drop down in the admin page. My intention is to have faculty is be a sub set of users. My first thought is to create a Group called "faculty" and use the "l

Re: how to iterate over a subset of model.all

2006-05-15 Thread Honza Král
before, it will ad a LIMIT, OFFSET clause to the SQL On 5/15/06, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > On 5/14/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > > On Sun, 2006-05-14 at 15:13 +0530, Amit Upadhyay wrote: > > > Lets say I have a Author and Article models, related via man

Re: how to iterate over a subset of model.all

2006-05-15 Thread Amit Upadhyay
On 5/14/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: On Sun, 2006-05-14 at 15:13 +0530, Amit Upadhyay wrote:> Lets say I have a Author and Article models, related via many to many.> On the profile view of authors I want to show the articles they> contributed to, but not all of them. The numbe

Re: Using existing database shema

2006-05-15 Thread Michael Radziej
Filipe wrote: > I'm starting a new project and am looking for the right framework for > it. Django is the best candidate so far :) > > If I understand right it's not mandatory to have a relational database > to use Django, as long as one does not inherit models from > "meta.Model". > > My questi

Re: Question about cache

2006-05-15 Thread Malcolm Tredinnick
Hi Axel, On Mon, 2006-05-15 at 13:09 +0200, Axel Steiner wrote: > Hi all, > > I've set up the cache system of Django and it works fine, except one thing. > Is it possible to reload or clean the cache, when there is a new record > in the database? Yes. Have a look at this post from Adrian: http

Question about cache

2006-05-15 Thread Axel Steiner
Hi all, I've set up the cache system of Django and it works fine, except one thing. Is it possible to reload or clean the cache, when there is a new record in the database? Thanks, Axel --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: Using existing database shema

2006-05-15 Thread Malcolm Tredinnick
On Mon, 2006-05-15 at 10:55 +, Filipe wrote: > Hi all, > > I'm starting a new project and am looking for the right framework for > it. Django is the best candidate so far :) > > If I understand right it's not mandatory to have a relational database > to use Django, as long as one does not in

Re: Using existing database shema

2006-05-15 Thread Kenneth Gonsalves
On Monday 15 May 2006 4:25 pm, Filipe wrote: > My question is, how about using an already existing database? I > will need to use a database of an application that is currently > in production (I can't touch it's schema), so the DB won't be > generated from my model in Django. Is it possible to us

Using existing database shema

2006-05-15 Thread Filipe
Hi all, I'm starting a new project and am looking for the right framework for it. Django is the best candidate so far :) If I understand right it's not mandatory to have a relational database to use Django, as long as one does not inherit models from "meta.Model". My question is, how about usin

Re: Why django return pages with not webserver running?

2006-05-15 Thread Malcolm Tredinnick
On Sun, 2006-05-14 at 20:06 -0700, [EMAIL PROTECTED] wrote: > Using 0.95 I'm triying to solve a problem. > > When the webserver is running, say this: > > Traceback (most recent call last): > File [...] > SyntaxError at /articulos/ > invalid syntax (urls.py, line 14) OK, so I cannot see an