Custom form where fields in Form do not match Model

2008-03-06 Thread Michael Lake
re it validates? I'm just really confused. Mike -- Michael Lake Caver, Linux enthusiast & interested in most things technical. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To p

Re: Creating link to root

2007-09-16 Thread Michael Lake
Cannot import settings file -' return settings.URL_ROOT and in settings.py I have: URL_ROOT = '/path_to/my_app' # Don't include any trailing / -- Michael Lake Computational Research Support Unit Science Faculty, UTS Ph: 9514 2238 --~--~-~--~~~---~--~~ You re

Re: ReStructuredText, markdown and other

2007-08-09 Thread Michael Lake
uy maybe > it's better to use python-born ReST? What are your experiences with > them? > > > > > -- Michael Lake Computational Research Support Unit Science Faculty, UTS Ph: 9514 2238 --~--~-~--~~~---~--~~ You received this message because

Re: Best way to pass data to a HttpResponseRedirect?

2007-07-27 Thread Michael Lake
Nis Jørgensen wrote: > As others have said, you can stuff things into request.session (after > adding the right middleware incantations). Using the session middleware looks far better but it will take me a while to try that out. I'll try and do that next week. > What is so bad about leaving

Re: Best way to pass data to a HttpResponseRedirect?

2007-07-27 Thread Michael Lake
Ah does this way seem sensible? > Nis Jørgensen wrote: >>The argument to HttpResponseRedirect is a url. You seem to be confusing >>it with a template. code # some error occurs return HttpResponseRedirect('error/2/') def error(request, message): { error_messages = { '1':

Re: Best way to pass data to a HttpResponseRedirect?

2007-07-27 Thread Michael Lake
Hi all Nis Jørgensen wrote: > The argument to HttpResponseRedirect is a url. You seem to be confusing > it with a template. OK I can do this: code # some error occurs message = 'You have ... tell admin that ' return HttpResponseRedirect('error/') and

Best way to pass data to a HttpResponseRedirect?

2007-07-27 Thread Michael Lake
Hi all A really simple question: I'm mostly using code like this: data = {'message': 'Some message to user...'} return render_to_response('main.html', data) But for error messages to users if one wishes to use a redirect like this: return

Re: Using Threadlocals: Error binding parameter 5 - probably unsupported type.

2007-07-23 Thread Michael Lake
(threadlocals.get_current_user()) and now I get the usernmame updated correctly and no errors. I am using Django 0.97-pre, SVN 5754 Michael Lake wrote: > Hi all > > I am using ThreadLocals from > http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser > > I am getting this er

Using Threadlocals: Error binding parameter 5 - probably unsupported type.

2007-07-18 Thread Michael Lake
Hi all I am using ThreadLocals from http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser I am getting this error on submitting the form: InterfaceError at /erun/10/1/ Error binding parameter 5 - probably unsupported type. This is my model: class Data(models.Model):

Re: How do I override a model method?

2007-07-02 Thread Michael Lake
:-) "Near them their sisters three, the Gorgons, winged With snakes for hair-- hated of mortal man--" Aeschylus Malcolm Tredinnick wrote: > On Tue, 2007-07-03 at 13:02 +1000, Michael Lake wrote: > [...] > >>I didn't realise I was dealing with both attributes

Re: How do I override a model method?

2007-07-02 Thread Michael Lake
Hi > On Tue, 2007-07-03 at 11:35 +1000, Michael Lake wrote: >>I'm having problems overriding a method in a model. >>I have seen how to override the save and delete methods and overriding a save >>works >>fine http://www.djangoproject.com/documentation/model-api/ &

How do I override a model method?

2007-07-02 Thread Michael Lake
Hi all I'm having problems overriding a method in a model. I have seen how to override the save and delete methods and overriding a save works fine http://www.djangoproject.com/documentation/model-api/ But I'm trying to override other automatically generated methods. Currently if I create a

Confused on how the groups feature works for the Admin interface

2007-06-07 Thread Michael Lake
oups. Mike -- Michael Lake --~--~-~--~~~---~--~~ 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: {{ perms }} seems to be empty

2007-05-23 Thread Michael Lake
Jeremy Dunck wrote: > On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote: >>I notice it's a Set object comprising a single list. So I thought I could do >>this: >> >>{% for item in perms.lab %} >>{{ item }} >>{% endfor %} > > > Y

Re: {{ perms }} seems to be empty

2007-05-23 Thread Michael Lake
list. So I thought I could do this: {% for item in perms.lab %} {{ item }} {% endfor %} But the above just seems to hand the browser and waits and waits... Mike -- Michael Lake --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: {{ perms }} seems to be empty

2007-05-23 Thread Michael Lake
e using as it supposed to be automatically available from the request object. -- Michael Lake --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email t

{{ perms }} seems to be empty

2007-05-22 Thread Michael Lake
ong? Mike -- Michael Lake --~--~-~--~~~---~--~~ 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 email

Re: rendering files in markdown

2007-05-17 Thread Michael Lake
ing between {{ description | markdown | wikiform }} and {{ description | textile | wikiform }} by editing all the templates :-) Mike -- Michael Lake --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: rendering files in markdown

2007-05-17 Thread Michael Lake
ython 2.4 i.e. your using 2.3 then place the # register.filter lines here after the defines above, otherwise you # will get a NameError. register.filter('wikiform', wikiform) -- Michael Lake --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Newform and Minimal File Upload Example

2007-05-15 Thread Michael Lake
d then add some validation (like checking that it is an image and say checking its size) after I have a small test working fine. Michael Lake wrote: > Hi all > > Guillaume wrote in May "Newform and File Upload problem" > > >>Well, my message was maybe a li

Newform and Minimal File Upload Example

2007-05-14 Thread Michael Lake
Hi all Guillaume wrote in May "Newform and File Upload problem" > Well, my message was maybe a little long. I still have not found answers > to my problem. To make it short, Is there anywhere a short example of file > upload using newform ? > The most simple thing with a model with 1

Re: How can I get the admin interface to not ignore newlines in a text field?

2007-05-10 Thread Michael Lake
Alexander Pugachev wrote: > Newlines characters do not break lines in HTML. You need in strings to > show text in few lines in list view. Ah :-) Obvious now why it wasn't rendering the text as text with newlines.. Thanks. -- Michael Lake Computational Research Support Unit Science F

Re: How can I get the admin interface to not ignore newlines in a text field?

2007-05-09 Thread Michael Lake
Michael Lake wrote: > Alexander Pugachev wrote: >>What is the type of the field? It should be TextField? > > Yes it is: >description = models.TextField(core=True) To be more precise; the new lines do not show when the admin interface just displays the field but it does

Re: How can I get the admin interface to not ignore newlines in a text field?

2007-05-09 Thread Michael Lake
output like this: >>line 1 >>line 2 >> >>But when I view this in the admin interface I get >>line 1 line 2 >> >>How can I get the admin interface to not ignore newlines? >> >>Mike -- Mi

How can I get the admin interface to not ignore newlines in a text field?

2007-05-08 Thread Michael Lake
Hi all I have a content field which has newlines in it. When I do a select from the database of that field I get the output like this: line 1 line 2 But when I view this in the admin interface I get line 1 line 2 How can I get the admin interface to not ignore newlines? Mike

Re: In Admininterface: Error: variable not passed into template?

2007-05-07 Thread Michael Lake
the correct headings and there is no errors. ID Experiment id Node id Content Hence it appears that in a model that if one has fields with _id in their name there are problems. Michael Lake wrote: > Hi all > > In the Admin interface I'm getting the folloing error for a model: > Error: v

Re: In Admininterface: Error: variable not passed into template?

2007-04-19 Thread Michael Lake
the error Error: variable not passed into template?>Data > On Apr 18, 10:39 pm, Michael Lake <[EMAIL PROTECTED]> wrote: > >>Hi all >> >>In the Admin interface I'm getting the folloing error for a model: >>Error: variable not passed into template?>D

In Admininterface: Error: variable not passed into template?

2007-04-18 Thread Michael Lake
can edit the rows using the admin interface. I can't see whats wrong with this particular model. manage syncdb runs with no errors and manage.py validate says 0 errors. In models.py the other models display fine in the Admin interface. Mike -- Michael L

Providing action specific feedback messages to users and HttpResponseRedirects

2007-04-13 Thread Michael Lake
ot;%s" % request.path) data = { 'request': request, 'message': message, 'form': form.as_table(), } return render_to_response('test_form_for_instance.html', data) Mike -- Michael Lake --~--~-~--~~~---~--~~ You received this message b

Re: Restructured text parsing not showing h1 levels.

2007-04-02 Thread Michael Lake
ges directory but now knowing what to look for I can see where this is set. I modified docutils/readers/standalone.py as set the value from 1 to 0 and now a lone H1 is shown :-) It's probably best to use for me to look at trying Dougs code and Jonathan Buchanan

Re: Restructured text parsing not showing h1 levels.

2007-04-01 Thread Michael Lake
Hi > On Mon, 2007-04-02 at 15:24 +1000, Michael Lake wrote: > >>Hi all >>I have a problem I think when I use the markup package. This provides >>markdown, >>textile and restructuredtext markups. I have the following in views.py: >> >>def testwiki: &

Restructured text parsing not showing h1 levels.

2007-04-01 Thread Michael Lake
heading shows fine. It also works fine if I have a H1 anywhere lower down. But If I just wish to have one H1 level Im in problems. Maybe this is a restructured text parsing problem? Has anyone seen this? Mike -- Michael Lake --~--~-~--~~~---~--~~ You received

Re: URL prefix in applications and templates.

2007-03-29 Thread Michael Lake
Jeremy Dunck wrote: > On 3/29/07, Michael Lake <[EMAIL PROTECTED]> wrote: > ... >>MyTag is {{ mytag }} end. >> > {% mytag %} > {{ }} is for variables. :) Thanks. With that change it is now working. Although I had read the documentation and it shows {% %}

Re: URL prefix in applications and templates.

2007-03-28 Thread Michael Lake
EBUG > setting. > """ > try: > from django.conf import settings > except ImportError: > return '' > if settings.DEBUG: > return settings.URL_ROOT_DEBUG > else: > return settings.URL_ROOT > > url_root() = r

URL prefix in applications and templates.

2007-03-27 Thread Michael Lake
django-users/browse_thread/thread/3346f3f509bf3bf8/c8595511c8d34c05?lnk=gst=url+root=4=en# Project URL-prefix http://groups.google.com/group/django-users/browse_thread/thread/f16d6bcf4d667069/d0c58efec5640d61?lnk=gst=url+root=8=en# Mike -- Michael Lake --~--~-~--~~~

Re: I wish for a "less than" and "greater than" in templates

2007-03-21 Thread Michael Lake
limodou wrote: > You can also use PyIf tag(written by me) to do that. > http://www.djangosnippets.org/snippets/12/ > And it can support any python expression. So it's more general I think. And it's short and understandable. I like it too. Thanks Mike -- Mic

Re: I wish for a "less than" and "greater than" in templates

2007-03-21 Thread Michael Lake
Kenneth Gonsalves wrote: > On 22-Mar-07, at 9:25 AM, Michael Lake wrote: >>>write your own tag - someone has done it, you can see it in this >>>file: >>> >>>http://nrcfosshelpline.in/code/browser/trunk/web/templatetags/ >>>base_utils.py >>

Re: Having problems getting contrib.markup to load

2007-03-21 Thread Michael Lake
markdown library is not installed which is much much better. I have to get and install that and then I think I should be running fine. Thanks -- Michael Lake --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Group

I wish for a "less than" and "greater than" in templates

2007-03-21 Thread Michael Lake
in/code/browser/trunk/web/templatetags/ > base_utils.py > > class CompareNode near the end But that link above no longer works. Does anyone have some code for this? I looked in Django Snippets and didn't find such a snippet. Mike -- Michael Lake --~--~-~--~~~-

Re: How do I make a TextArea box in a form bigger?

2007-03-15 Thread Michael Lake
Hi all >>On 14-Mar-07, at 12:02 PM, Michael Lake wrote: >>>The textarea is about two lines high only. I want the text entry >>>box to be much bigger as it will be holding a full page of text ... Kenneth helped out and suggested this: >>widgets.TextArea(attrs={'ro

How do I make a TextArea box in a form bigger?

2007-03-13 Thread Michael Lake
render_to_response('test.html', data) TEMPLATE Lots of text: {{ form.details }} -- Michael Lake --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: Help needed in understanding newforms.

2007-03-01 Thread Michael Lake
m. > > In short, form.save() is really just a convenience method for one class > of forms where saving is an easy thing to work out how to do. You may > not always have it available. Oh, it's complex. I think I sort of understand the above. Time for me to go back a bit and create some tes

Re: Help needed in understanding newforms.

2007-03-01 Thread Michael Lake
Malcolm Tredinnick wrote: > Hi Michael, > > On Fri, 2007-03-02 at 16:08 +1100, Michael Lake wrote: >> Im trying to understand newforms and comparing the newforms docs at >> http://www.djangoproject.com/documentation/newforms/ with "Using djangos >> newforms&qu

Re: How to modify form error messages.

2007-03-01 Thread Michael Lake
Malcolm Tredinnick wrote: > On Fri, 2007-03-02 at 15:27 +1100, Michael Lake wrote: > >>Hi all >> >>I see in the documentation for forms that the HTML output will include the >>validation >>errors as a near the field. How does one change that? I would like t

Help needed in understanding newforms.

2007-03-01 Thread Michael Lake
d on the save methods. Some exemples use form.save() and others define a save method under the model Class. Sorry this is a bit of a long post with many questions. The whole newforms just has not yet "clicked" :-) -- Michael Lake --~--~-~--~~~---~-

How to modify form error messages.

2007-03-01 Thread Michael Lake
Hi all I see in the documentation for forms that the HTML output will include the validation errors as a near the field. How does one change that? I would like the errors to be after the form field similar to this below irrespective of whether im rendering it as_p or asdefault table

Re: How to do dynamic lookup of variables.

2007-02-15 Thread Michael Lake
return render_to_response('lab/experiments.html', >>{'experiment_list': experiment_list, >> 'ecount': ecount, # ecount is the number of experiments. >> 'pcount': pcount, # pcount is the number of procedures in an >> experiment. >> }) >> >

Re: Is there a way for a template file to know its name?

2007-02-12 Thread Michael Lake
anks. I now have {% if not no_display %} ... a help link in a div {% else %} ... a blank div element ... {% endif %} and in my views for the just for the help function I have: render-to_reponse('lab/help.html', {'no_display': 1}) Works a treat. Thanks. > On Tue, 2007-

Is there a way for a template file to know its name?

2007-02-12 Thread Michael Lake
to appear on the help page itself so I was wanting to have something like this in base.html {% if template_name == help.html %} {% else %} Help {% endif %} where template_name or something is the name of the current template file being rendered. Mike -- Michael Lake

Re: Help needed with select_related and a Many-to-many relationship.

2007-02-11 Thread Michael Lake
Malcolm Tredinnick wrote: > On Mon, 2007-02-12 at 13:04 +1100, Michael Lake wrote: > >>Hi all >> >>I made this post earlier but since then I have gone back to try and get this >>working >>by understanding things via the django shell. The app is for a la

Help needed with select_related and a Many-to-many relationship.

2007-02-11 Thread Michael Lake
at are in each experiment. The id field would not really be used at all - django just adds it. -- Michael Lake --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

General help and help with an ordered ManyToMany

2007-02-07 Thread Michael Lake
.name }} Description: {{ object.description}} List of procedures for this experiment. {{ ??? procedure_list.name }} INCLUDE HERE A LIST OF THE PROCEDURES NAMES AND DESCRIPTIONS FOR THIS EXP. -- Michael Lake Computational Research Support Unit Science Facult