ah nice one Jason :) sorry it took me a while to respond, I had a load more problems and I sort of forgot about this one....
I didn't get your solution working, but while I was hacking away and searching the net for ideas I found request.GET.get('q', '') in http://stackoverflow.com/questions/150505/django-capturing-url-parameters-in-request-get and multiple url params in: http://stackoverflow.com/questions/2364700/django-url-parameter-key-used-twice I then realise that I was already overriding the admin models get_form() which has the request parameter, so it was simply a matter of setting the initial state of the field via: initial=doc_no and passing in the parameters via: add/?doc_no=Test1&doc_desc=Test2 and Test1 and Test2 ended up in the correct boxes :), I'm a bit new to web dev stuff so have never used url parameters, so I'm glad it was this easy, only took about ten mins :) I've no idea if this is the right way to do what I wanted, but it works, here's the code.... class MyModelAdmin(admin.ModelAdmin): ... def get_form(self, request, obj=None): """override some widgets for the admin change form""" form = super(MyModelAdmin, self).get_form(request, obj) doc_no = request.GET.get('doc_no', '') doc_desc = request.GET.get('doc_desc', '') form.base_fields['doc_no'] = forms.CharField( widget=forms.Textarea(), initial=doc_no) form.base_fields['doc_desc'] = forms.CharField( widget=forms.Textarea(), initial=doc_desc) return form Thanks again Jason! On May 9, 3:44 pm, leveille <leveil...@gmail.com> wrote: > On May 9, 4:58 am, nih <steven.bisse...@googlemail.com> wrote: > > > I've got a python program that starts up a django web app, I'm trying > > to figure out how to pass values from the program to the web app so > > some fields in the admin add page are automatically populated with > > values from the program, is the only way via url parameters?, I sense > > its a lot more complicated than that :-) > > Hi, Steve, > > I've overridden render_change_form in the past to add extra context to > a change form for one of my admin classes. I've pasted a quick > example here:http://dpaste.com/hold/192434/. This method can be > found in the ModelAdmin base > class:http://code.djangoproject.com/browser/django/trunk/django/contrib/adm.... > Of course, because request is passed to this method, you can access > GET, etc. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.