On Monday, 03 November 2008 10:50:34 Bülent Aldemir wrote:
> I want to have a nice representation for the other MyModel() fields. Must I
> define for each field a method to accomplish my task?
Seems the best way. There's only one 'repr' for any object and if you want
specific ones then either mak
On Thursday, 06 November 2008 14:38:41 limas wrote:
> can i set the value of a ModelForm field ,ie a text box, using
> javascript.
Try JQuery. If your input box has an id "blah" then:
$('#blah').val("some new value")
would set it for you.
jQuery is very cool for this kind of thing.
hth,
\d
--~
Hello,
In my model, I define the choices for a charfield. I make a ModelForm of that
model but I want my own widget for that field. How can I pass-through the
choices I defined in my model?
Some code:
class Movie( Relic ):
disk_type = models.CharField( 'Type', max_length=8, choices=((u'1','on
On Friday, 21 November 2008 08:06:32 urukay wrote:
> easy way how to solve it is to put definition of your choices out of model
> definition:
Yeah, that's what I call a 'global', but is there no way to get the choices
from the field in the model class?
\d
--~--~-~--~~~-
On Friday, 21 November 2008 13:46:35 Daniel Roseman wrote:
> There is an alternative, though: instead of overriding the fields
> declaratively, you can define a formfield_callback function.
This seems interesting. I have searched the docs online
for 'formfield_callback' and get no useful results
On Saturday, 22 November 2008 03:52:27 Jeff FW wrote:
> choices = Movie._meta.get_field('disk_type').choices
Ah, the 'Movie' in there was the missing voodoo. I was stuck on using an
instance; and yes, I prefer Movie dot choices 'global' idea.
Thanks for the various replies. I have more-or-less g
FWIW
O/S: Kubuntu
Edit: gvim, Firefox + Firebug.
Graphics: Inkscape, Gimp, ImageMagick.
Testing on: Safari (wine), ies4linux, Opera, FF.
server: ssh and rsync from a terminal.
Oh, and a whole lotta alt-tab F5'ing :)
\d
--~--~-~--~~~---~--~~
You received this me
On Monday, 24 November 2008 12:21:55 yves_s wrote:
> does anybody have some hints?
IIRC - You can do:
form.instance (inside your widget, I think...)
This assumes you made a form with something like:
f = MyForm(instance = someInstance)
On the command-line, try using:
python manage.py shell
Then i
Further info,
Looks like from within a widget there's no easy way to find the Form. I'd a
thunk there'd be a Parent attribute, but there ain't.
So:
If you are doing something like this:
class SomeWidget( forms.TextInput ):
def __init__(self,attrs=None, PASSANYTHINGHERE=whatever ):
My guess is something like:
{{ quote|escape }}
And then have a line in ulrsconf to catch that link and send it to a view
which pulls and makes the form.
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Dja
Sorry for being dense, but I don't really follow what you need. Look in the
docs for backward relationships between foreign keys. That may help you.
Something like:
group = Animal.objects.get(animal_group__id=XX)
But I don't know where you decide what XX is.
\d
--~--~-~--~~---
On Tuesday, 25 November 2008 09:11:36 laspal wrote:
> sortby = callreports.meetingdate
> company_list = Company.objects.order_by(sortby)
Try:
sortby = callreports__meetingdate
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Go
Hi,
I am stuck on the interface between a PIL Image and a
FilesystemStorage 'content' object.
I can: img = Image.open(content)
But how do I pass 'img' back to Django for saving?
My short class is pasted at end. The problem reported stems from the line:
name=super(CustomImageStorage,self).save(n
On Monday, 05 January 2009 05:15:27 Eric Abrahamsen wrote:
> On second thought, you should probably be writing the img back into
> the original "content" variable (which points to a File object), as
> that object might already have relevant attributes set...
I guess that's what I was asking: h
On Monday, 05 January 2009 09:44:37 Malcolm Tredinnick wrote:
> Basically, hang in there and be prepared to experiment a bit and
> possibly read some source code. Take notes as you go
Heh -- thanks for that! It does lift my spirits somewhat. I have been planning
to write a short tut on how to ma
On Monday, 05 January 2009 14:00:16 Eric Abrahamsen wrote:
> content.write(o.getvalue())
> super(CustomImageStorage,self).save(name, content)
That gives:
'InMemoryUploadedFile' object has no attribute '_mode'
Exception
Location: /usr/lib/python2.5/site-packages/django/core/files/base.py in
On Monday, 05 January 2009 00:51:03 Donn wrote:
> I am stuck on the interface between a PIL Image and a
> FilesystemStorage 'content' object.
>
> I can: img = Image.open(content)
> But how do I pass 'img' back to Django for saving?
I have some kind of working e
On Monday, 05 January 2009 17:50:09 A Melé wrote:
> Donn, take a look at django-thumbs source code
Many thanks -- it looks familiar now :)
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users&qu
Hi,
Can anyone help me get some extra info in settings.py?
I have a domain that I want to point to various different Django apps
depending on the 'hostname' portion of the domain name.
***.mydomain.com has (for ***):
www
comics
stuff
I want that first portion (www, comics, stuff) available in
On Tuesday, 13 January 2009 19:28:01 Tom Dyson wrote:
> We do something like this with middleware in the Carbon Account[1]:
I have not used middleware yet, so will look into it. I am not sure if it can
supply request.META *within* settings.py though.
I want to set certain variables depending on
Tom, thanks for your feedback.
I guess what I was asking was how to get the domain/subdomain info from places
like models and settings -- i.e. places that have no connection to a request.
Still, I see a way through and will employ your suggestions.
\d
--~--~-~--~~~
On Sunday, 17 August 2008 20:38:06 varikin wrote:
> I am planning on using jquery sort to reorder them
> by dragging them on the change list.
Cool, if you get that right, I'd like to hear about it!
\d
--~--~-~--~~~---~--~~
You received this message because you are
On Monday, 18 August 2008 09:39:12 Matthias Kestenholz wrote:
> But maybe I've got something for you if you want to reorder
> items using a drag-n-drop interface.
Thanks for that. I will go and look when I have a chance.
\d
--~--~-~--~~~---~--~~
You received this
Hi,
Just spent many hours getting a small form submit to work [I'm thick :)] with
Django and jQuery (with the form plugin) and thought I'd share it here. It's
on Django snippets:
http://www.djangosnippets.org/snippets/992/
HTH
\d
--~--~-~--~~~---~--~~
You receiv
> You could use Ajax for this. The client could periodically (say, every
> second) send a request to the server asking if the calculation is
> over.
If the view is running a loop - how would you provide a variable to another
view (that Ajax is calling) about the situation? Let's say a percentag
On Wednesday, 20 August 2008 15:27:24 Julien Phalip wrote:
> You could use the cache by setting a key that the other view can look
> up.
Right, thanks-- I'll go look it up.
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
I spent some time fiddling and have a basic jquery/ajax solution to this. I
still don't know how to 'backround' a process, but this will allow a progress
report to be pulled from Django while another view function is busy.
http://www.djangosnippets.org/snippets/994/
hth,
\d
--~--~-~--
On Sunday, 31 August 2008 16:33:32 Weber Sites wrote:
> The tutorial suggested to keep "mysite" out of the webroot so where do
> i point apache to?
Go to the Django site and read the docs about apache and mod_python. It's not
that hard really.
\d
--~--~-~--~~~---~--~
Hi,
My model (Item) has this line:
dimensions = models.ForeignKey(Dimension, null=True, blank=True )
Later, I want to make an Item sans dimensions like so:
itemobj = Item( blah
dimensions = dimobj,
)
But - dimobj is None (as it should be).
I get this error:
Cannot assign "(N
> This error message makes it appear dimobj is a single-element sequence
> containing None
You're a genius! I totally missed that. I had a hanging comma and hell
followed :)
Thx,
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to th
I am getting confused by terms, but this is the basic need:
1. In a base dir I have site1 and site2
2. I am in site2 (views) and I want to use the models defined in site1
3. from site1.models import Blah -- seems to work without error.
4. I get an error on stuff like this:
p = Blah.objects.all()
Extra info:
I have many Projects that equate to 'websites'.
Each has it's own database in Mysql.
I want one Project to be our Admin that let's us set some stuff that the other
websites (projects) read and act upon. (Hence OP needing to access a model
from another Project)
If I setup each "web
You are some kind of wonderful. Thanks for that, it has really helped me!
\d
--~--~-~--~~~---~--~~
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
T
Hi,
I have been looking, but can't find.
I have a Client model with a Website inline (related by FK). it's open in a
change screen in the admin.
The inline below has a field that refers to the parent Client.
That field is a drop-down showing many Clients.
Is there any way to tell the inline to
Hi,
Some code is below. I am in my FileSystemStorage class and I want to prevent
users from uploading images over 100K.
There are 2 questions here:
1. Is my use of len(content) sensible? I don't have a file yet, only a memory
object, so I can't use stat.
2. How would I raise an error so that it
> That should happen automatically - you shouldn't see the foreign key
> to the parent model. Can you post your model and admin code on
> dpaste.com so we can work out what's wrong?
Thanks, I'm sure it's something dumb I'm doing. Here: http://dpaste.com/78053/
\d
--~--~-~--~~
Karen,
I suspect I have been using foreign keys where I should be using one to many
or somesuch. I will retreat and rethink my layout.
Thanks,
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group
Hi,
Thought I'd start a new thread to clear out the cruft.
http://dpaste.com/78151/ shows my latest shot at the thing.
In that dpaste, the Client->WebsiteInline works as I'd hoped. But the
Website->PluginsEnabled does not.
I include my reasoning in comments in the dpaste.
If anyone can take
> Displaying an html page straight away after the user hits submit
> (telling the user that they will be notified by email when their job
> has finished running), whilst running the time-intensive task in the
> background.
Good job for javascript and Aja[xj]
Submit the form via something like jQue
On Monday, 15 September 2008 19:00:39 Steve Holden wrote:
> So, as Karen already said, there really doesn't seem to be any need for
> a "pluginsEnabled" module. The foreign key implements a one-to-many
> relationship between Website and Plugin: many Plugins can have the same
> Website, each Websit
On Tuesday, 16 September 2008 06:35:04 Karen Tracey wrote:
> With the new models you still have "should be the same" client duplicated
> in two places, which was the thing I was trying to advise you to get rid
> of.
Karen,
Once again I am indebted to you. I had tried your first advice but in my us
On Tuesday, 16 September 2008 10:32:54 est wrote:
> http://xxx.com/assets/main.css
> Now the problem is, how can I massively move all template under a new
> sub-directory URL like http://xxx.com/v2/ ?
How about
1. making a link under /var/www/assets to /whatever/v2/assets
2. move your assets dire
I have found that using Firebug (in Firefox) is a real boon. You can open the
response header and see the Django error page (open it in a new tab).
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users"
On Wednesday, 17 September 2008 23:35:46 [EMAIL PROTECTED] wrote:
> Better to set the upload filesize limit on your server eg Apache's has
> a directive for max file size. Otherwise the file will be uploaded and
> checked anyway.
I will look into this, but not sure how Apache will respond on the
On Thursday, 18 September 2008 12:13:12 Graham Dumpleton wrote:
> If using mod_python, the Apache LimitRequestBody directive doesn't
> work entirely properly.
I have heard of a "Content-length" variable (from PHP, but it's an http
thing) -- how could I use that? request["Content-length"] or somet
On Thursday, 18 September 2008 13:17:06 Graham Dumpleton wrote:
> If Content-Length was an unreliable indicator of request content then
> web applications wouldn't work properly.
Okay, in context of the OP's code -- how could I employ content length and get
an error message back to the admin cha
Hi,
I have these models:
Book, Album (etc.) and they are "grouped" in Res (for Resources)
My code is at : http://dpaste.com/79178/
Is there some (simple) way to get admin to work like this:
Edit a Res --> the inline shows the Book class OR album class *depending* on
what the class of the object
On Friday, 19 September 2008 19:55:05 Don wrote:
> class ResAdmin(admin.ModelAdmin):
> inlines = [ BookAdmin,
>AlbumAdmin,
>]
Hi, tried that but it gives both Book AND Album under Res.
The idea is to make Books and Albums and then (later) go to Res and add them
Hi,
I would like to change the 'already exists' message when one adds a record
that duplicates a unique one in the table.
Nearest I can tell, the fields.error_messages do not offer a way to alter that
message.
Here's my basic code:
class AAForm( ModelForm ):
def __init__(self,*args,**k
bump...
--~--~-~--~~~---~--~~
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 to [EMAIL PROTECTED]
For mor
On Tuesday, 23 September 2008 08:47:10 Daniel Roseman wrote:
> self.validate_unique()
Ah! That's the magic.
Thanks.
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, sen
On Tuesday, 23 September 2008 08:47:10 Daniel Roseman wrote:
> meantime maybe you could define a clean() method and catch and re-
> raise the ValidationError there.
I tried that idea of yours and it has no effect on the error message. Looking
at the source I see it's adding an error for a field c
On Tuesday, 23 September 2008 11:42:19 Daniel Roseman wrote:
> The __all__ error messages are available via form.non_field_errors().
I sent that along to the template, but it's still oddly silent.
Some code:
def clean(self):
try:
self.validate_unique()
except forms
On Tuesday, 23 September 2008 18:16:19 barbara shaurette wrote:
> Question 1: What are you using in your template to display the errors?
In the render to response I put {'formbugs': form.non_field_errors() } and in
the template {{formbugs}}.
It really looks like the self.validate_unique() in cle
Hi,
I thought I'd ask before rolling my own (at tedious pace) widget/whatever:
If you have a foreign key field to a table of thousands of, say, author names,
the drop-down control becomes a real problem:
1. It's not paged so all the items have to be stuffed into the html.
2. It's damn hard to us
On Saturday, 27 September 2008 00:07:02 Diego Ucha wrote:
> You could use the filter_(horizontal|vertical) solution
Ah, that's somewhere to start. Thanks.
I am not using admin because I really struggle to get it to work intuitively
but will go look at the source for a while.
\d
--~--~-
On Friday, 26 September 2008 21:32:30 David Durham, Jr. wrote:
> You could use something like an auto completing combo box
The thing about them is I see a lot of db hits happening. Each letter (or two)
pulls another query on the back end. Ouch. ( I think)
\d
--~--~-~--~~
On Friday, 26 September 2008 23:28:19 bruno desthuilliers wrote:
> If you want to
> avoid javascript, you'll need to store the current form's state and
> whatnots (using session) and redirect to a page displaying possible
> choices with (just like with the popup solution) paging, filtering
> etc,
Hi,
When I use $('blah').load() to fetch a response into a div it seems to be
pulling the data twice. This I see in Firebug where there are 2 GET headers.
Here is the JS that is fired on a click of a span tag:
$('#pickoradd_author').click( function() {
$('#lister').load('http://ddm/incunabula/zo
On Monday, 29 September 2008 22:56:24 Benjamin Wohlwend wrote:
> If you use
> the URL with a trailing slash, only one request should occur.
You sir, are a peach! That sorted it. What a relief; many thanks.
\d
--~--~-~--~~~---~--~~
You received this message becaus
Hi,
I have a modelForm that has a foreign key. I want the control to be a link
instead of a element. This I have managed. It opens a div which lets
me pick a value from a long list.
The problem I am having is feeding the chosen value back into the original
form. I can't figure out which clean
Perhaps if I ask it in a different way:
1. A 'book' has a title (string) and an author (foreign key).
2. I use a ModelForm from the model.
3. I want the 'author' form-control to look like this:
Author:__ [click here to choose or add an author]
4. When you click the link it opens a div.
5. The
On Wednesday, 01 October 2008 08:59:00 Merrick wrote:
> Also how do I access the form submission if not through
> cleaned_data.get?
I have found this works, but I can't say in what cases:
name = form.data['fullname']
\d
--~--~-~--~~~---~--~~
You received this mes
Hi,
I asked a little earlier, but this is a busy list and perhaps my post was too
obscure. Here is an edited repost in the hopes of catching someone who can
help out:
I am trying to create a custom field (and/or widget) that 'looks up' a foreign
key relation -- i.e. lists the other table and a
Bump
\d
--~--~-~--~~~---~--~~
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 to [EMAIL PROTECTED]
For
Thanks for your reply!
On Wednesday, 01 October 2008 14:51:04 felix wrote:
> > a. How to get it to validate. (clean and co.)
> when you select the desired whatever it should put it into the form's
> hidden field as an id
> or text field
> so that's what should be cleaned.
Yeah, the problem is tha
On Wednesday, 01 October 2008 10:28:13 TiNo wrote:
> If you do all that stuff with jquery, why not have jquery hide the original
> select (or modify it for that matter), and on select of an author, have
> jquery set the selected author as 'selected' in the dropdown box? That way
> there is no need
On Wednesday, 01 October 2008 16:13:18 Karen Tracey wrote:
> looking-glass icon on
> an admin change page where the ForeignKey field has been included in
> raw_id_fields.
Thanks for the lead!
\d
--~--~-~--~~~---~--~~
You received this message because you are subsc
On Friday, 03 October 2008 16:53:02 Alexis Bellido wrote:
> I'm not sure if I understand Malcolm's suggestion, is he talking about
> using named URL patterns as documented here?
Yes he is. They are quite tricky little devils and cause me much pain, but
that's because I am too impatient and have a
> I've been playing with custom fields, but I'm not sure where the
> python script containing the custom field definition goes?
Anywhere you can reach it with an import statement. I put mine alongside
models.py etc. and call it forms.py
\d
--~--~-~--~~~---~--~~
Hi,
After spending many (many) days on my own CRUD system I am *really* seeing the
beauty of the Django Admin system!
A few quick questions -- regarding Many to many field and filter_horizontal :
1. Assuming I have thousands of records, call them books, does that interface
provide paging?
2.
Bump...
--~--~-~--~~~---~--~~
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 to [EMAIL PROTECTED]
For mor
On Thursday, 09 October 2008 18:10:49 SnappyDjangoUser wrote:
> I think you are looking for the Pagination class
Thanks for the reply -- I know about Pagination but I was asking in a
particular context. Perhaps those docs mention the admin side of things. I
will have another look.
\d
--~--~--
Sounds like you should be doing something in the form's clean() function. You
can compare what's in the cleaned_data to what's in the model and then move
from there.
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Grou
Hi,
Dumb question - In a feed situation, I am using something like:
return Page.objects.order_by('-date')[:30]
That will always return (say) 30 results. They don't change, it's always the
same 30, with perhaps a few new ones.
Do I have to worry about this sameness -- or does the syndication sys
On Wednesday, 28 January 2009 09:46:09 Paul Johnston wrote:
> Is it possible to use more complex form widgets
In my *very* limited experience, I would say yes.
The widgets are really javascript and all your Django view needs to worry
about is what comes back via GET or POST.
Fetch the data fr
On Wednesday, 28 January 2009 14:49:27 Torsten Bronger wrote:
> If the ID of an entry is already known to the feedreader, it isn't
> displayed.
Okay, so it's built-into the reader. Thanks.
\d
--
Where I web: http://otherwise.relics.co.za/
Comics, tutorials, software and sundry
--~--~-
Hi,
I have docced, searched and read old posts, but I still can't get comments to
behave.
1. I have copied the templates to my app.
2. I have comments installed and working.
3. I have looked at the source, in vain; but I ain't too bright :)
4. I have a hidden "next" field in form.html so that a
Well, to answer with my current solution:
> My one idea is to intercept comments/posted/?c=... and then write a view to
> redirect back to the original page. Is this the route to take?
I did this:
urls.py
# Catch url for comment just posted (preview or error)
(r'^wiki/comments/posted/.*$','othe
On Sunday, 22 February 2009 21:00:24 Theme Park Photo, LLC wrote:
> {% block content %}
> Hello
> {% end block %}
It's not this extra space between end and block is it?
\d
--
Where I web: http://otherwise.relics.co.za/
Comics, tutorials, software and sundry
--~--~-~--~~
Hi,
I hope someone can give me a hand.
I'd like to have a *single* UserProfile table/model which is *shared*
across many apps, much like auth_user is.
--- setup info ---
Django 1.2.1 on a recent Linux system. All pretty up-to-date.
One project (X). Many apps (A,B,C). The url, say: *.home.box,
Hi,
Given that my apache uses many VirtualHosts and within each a ServerName,
how can I get that ServerName into a variable in my settings.py file?
I am using WSGI and mod_python. (different setups on dev vs. server)
The reason is that I need to be able to build the whole http://servername in
Graham -- thank you for that detailed response. I had not expected it to be
quite so intricate, so it will take me a wee while to savvy.
Regards,
\d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users"
83 matches
Mail list logo