Re: Accessing data from previous steps in Form Wizard

2008-04-15 Thread Honza Král
forms for validation. Is it > possible to pass user-submitted data from previous forms to subsequent > forms in a form wizard? > > Thanks, > Leif > > > > > -- Honza Král E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~-~--~~

Re: Using form wizard to complete form over multiple sessions

2008-04-11 Thread Honza Král
e over > multiple sessions. I am considering adding save_for_later() and > resume_form_wizard() functions that would save the serialized form > data to the database, and allow users to resume the wizard at a later > time. > > Has anyone tried this? Any advice/thoughts? > > Be

Re: FormWizard and clean

2008-04-04 Thread Honza Král
that the clean() > is called on the first form again. This happens before the done() > method on the Wizard itself. Obviously with an expensive (time) > validation I don't want to do it twice. Is there some way to do once > only validation on the first form in a FormWizard ? > > Than

Re: caching and authentication

2007-07-07 Thread Honza Král
On 7/7/07, patrick k. <[EMAIL PROTECTED]> wrote: > > > Am 07.07.2007 um 02:13 schrieb Jeremy Dunck: > > > > > On 7/6/07, patrickk <[EMAIL PROTECTED]> wrote: > >> > >> when having a header where the username and a logout-button is > >> displayed, how do you cache this page/view? > > > > There's a

Re: newbie -- trouble using Postgres

2007-05-02 Thread Honza Král
are you sure you are using the correct backend, note that there are two backends for postgreSQL, you want the one with psycopg2 in it On 5/2/07, BasicSci007 <[EMAIL PROTECTED]> wrote: > > Can't seem to get django and postgres to hook up. MySQL or sqlite3 > work fine. postgres seems to work fine

Re: ERROR: invalid input syntax for type boolean: ""

2007-05-01 Thread Honza Král
On 5/1/07, Baurzhan Ismagulov <[EMAIL PROTECTED]> wrote: > > Hello, > > I have a class Object(models.Model) which contains model.BooleanFields. > I'm trying to add rows to it, like this: > > o = Object() > o.a1 = 'a1' > o.a2 = 'a2' > o.save() > > I don't set boolean values here. save() results in

Re: Added a column

2007-05-01 Thread Honza Král
On 5/1/07, gsmith <[EMAIL PROTECTED]> wrote: > > I'm using sqllite as my database. I've added a Image Field to one of > my tables. I am wondering how i get my database to register this new > column. I thought running the command 'python manage.py syncdb' would > update my database. However,

Re: Compound newforms

2007-05-01 Thread Honza Král
Hi, I use something similar to this. What I did was override the __init__ to take extra arguments with the instances it's editing and store them for future use. so it would look something like this: class MyForm(forms.Form): def __init__(self, objects=[], *args, **kwargs): super(Form,

Re: Newforms and CSS classes

2007-04-30 Thread Honza Král
equired" to make CSS styling easier. > > Am I overlooking something, or is newforms missing this? > > -- > Christian Joergensen | Linux, programming or web consultancy > http://www.razor.dk | Visit us at: http://www.gmta.info > > > -- Honza Král

Re: get the latest # of objects

2007-04-22 Thread Honza Král
On 4/22/07, drackett <[EMAIL PROTECTED]> wrote: > > hm. I'm trying to do this in a context processor and its not working: > > def entry_latest(request): > from app.entries.models import Entries > return {'entry_latest': Entries.objects[:5]} yeah, you have to slice the queryset:

Re: get the latest # of objects

2007-04-22 Thread Honza Král
just slice it: entry_list[:5] just bear in mind that slicing will actually query the database, so you need to do it when working with the data (e.g. not in urls.py when providing parameters for generic views) On 4/22/07, drackett <[EMAIL PROTECTED]> wrote: > > I love the ability to get the

Re: filtering by if a date field is empty

2007-04-22 Thread Honza Král
On 4/22/07, drackett <[EMAIL PROTECTED]> wrote: > > I am trying to grab objects from a model only if they are not complete > using a context processor. This is the code I have right now, but it > doesn't work. Is there an easy way to filter by if a date field is > empty/null? > > def

Re: Session support

2007-04-18 Thread Honza Král
On 4/18/07, James Bennett <[EMAIL PROTECTED]> wrote: > > On 4/18/07, SlavaSh <[EMAIL PROTECTED]> wrote: > > This is wrong "intentional design decision". > > There few more web clients in the world besides the IE and Firefox. > > Part of them does not support cookies. > > Django provides a sessions

Re: Newforms: adding a date picker

2007-04-15 Thread Honza Král
creating a widget might be an overkill in this case adding a custom class to the input field via the attrs parameter should cover it nicely. i use this approach without the need for a special widget. On 4/15/07, Ray Cote <[EMAIL PROTECTED]> wrote: > > Thanks, that is very helpful. > > At 11:45

Re: Dynamic query building

2007-04-02 Thread Honza Král
something like this works for me... q = Q( tag__name=first_tag ) for tag in other_tags: q = q | Q( tag__name=tag ) Model.objects.filter( q ) On 4/2/07, Christian Hoppner <[EMAIL PROTECTED]> wrote: > > Hi there! > > I've been thinking about including in my new app a kind of tag browser. The >

Re: Time length - Long and relative TimeField

2007-03-29 Thread Honza Král
On 3/29/07, Gilhad <[EMAIL PROTECTED]> wrote: > > > > > 240:00:00 (alternatively 10d 00:00:00) > > > > > > Does the timesince filter do what you require? > > > > If I understand correctly, gilhad wants to specify an interval. > > > > Possible solutions: use two PositiveIntegerFields

Re: Time length - Long and relative TimeField

2007-03-29 Thread Honza Král
On 3/29/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 3/29/07, Gilhad <[EMAIL PROTECTED]> wrote: > > > > > > Hello, is there something to use for long time periods like 30 hours or 2 > > years, which can be displayed as time? > > > 240:00:00 (alternatively 10d 00:00:00) >

Re: Problem with get_current_user via middleware

2007-03-26 Thread Honza Král
On 3/27/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Mon, 2007-03-26 at 21:56 +0200, Gilhad wrote: > > I am trying to get current user, but I have some problem with it. I got > > different '_local' object each time ... > > > > I followed the example at > >

Re: Database migration

2007-03-26 Thread Honza Král
On 3/27/07, Jonas Maurus <[EMAIL PROTECTED]> wrote: > > On Mar 26, 11:10 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > I apologize for the vague newbie question, but I'm gonna ask it > > anyway... > > > > I'd like to switch DBs from mysql to postgres... how does one do so? I > > assume

Re: Problem with get_current_user via middleware

2007-03-26 Thread Honza Král
On 3/26/07, Gilhad <[EMAIL PROTECTED]> wrote: > > I am trying to get current user, but I have some problem with it. I got > different '_local' object each time ... > > I followed the example at > http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser > > and make my model such way: > >

Re: newform: Post_add Submission not working

2007-03-02 Thread Honza Král
On 3/3/07, johnny <[EMAIL PROTECTED]> wrote: > > I did place form.errors in the template. If I type the invalid data, > then it displays the errors. Problem is when I type in valid data, it > doesn't display anything and brings me back to the form with the data > I have entered. Every

Re: How to modify form error messages.

2007-03-02 Thread Honza Král
On 3/2/07, Michael Lake <[EMAIL PROTECTED]> wrote: > > 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

Re: newform: Post_add Submission not working

2007-03-02 Thread Honza Král
it would seem that the form still have some errors, try outputting form.errors in the template to see if its empty On 3/2/07, johnny <[EMAIL PROTECTED]> wrote: > > When I submit the information with the form, for some reason, I keep > coming back to the form, with data I entered. I am not sure

Re: newforms: no attribute 'form_for_instance'

2007-03-01 Thread Honza Král
On 3/2/07, stevelewis <[EMAIL PROTECTED]> wrote: > > So I've developed on my laptop, and am trying to deploy to a unix box, > and most things work fine, but I'm using the newforms form for > instance method, and it can't find it: > > 'module' object has no attribute 'form_for_instance' > > It

Re: select_related?

2007-03-01 Thread Honza Král
On 2/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Could somebody explain the difference between lets assume you have models Article Author Category where every article has one author and one category > > Foo.objects.all() and this will do something like select * from articles; >

Re: Unique Id's across several classes/tables

2007-03-01 Thread Honza Král
On 2/28/07, jzellman <[EMAIL PROTECTED]> wrote: > > Thanks for the reply. > > What I am trying to do is have subclasses. So this is what i would > like to do: > > class Parent(models.Model): > #stuff common to all child types > > class ChildA(Parent): > #... > > class ChildB(Parent): >

Re: how to get object after form.save() ?

2007-03-01 Thread Honza Král
On 3/2/07, grahamu <[EMAIL PROTECTED]> wrote: > > > On Mar 1, 12:53 pm, "Honza Kr�l" <[EMAIL PROTECTED]> wrote: > > > > 1. Is there an easy way to get the new object created by form.save()? > > > > obj = form.save() > > Thanks, I finally saw that after perusing the django source code. > > > > 2.

Re: how to get object after form.save() ?

2007-03-01 Thread Honza Král
On 3/1/07, grahamu <[EMAIL PROTECTED]> wrote: > > Hi all, > Two newforms questions... > > 1. Is there an easy way to get the new object created by form.save()? obj = form.save() > 2. Is is true that one should not call form.save() if the form was > instantiated from a class resulting from

Re: models.TimeField()

2007-02-27 Thread Honza Král
On 2/28/07, DuncanM <[EMAIL PROTECTED]> wrote: > > When you use this field type, django automatically places a clock next > to the field which is very handy with quick links: 6am, noon, > midnight, now() or something similar. > > Is there any way I can get the list that is displayed then to be set

Re: Using HTML/CSS as templates

2007-02-27 Thread Honza Král
On 2/27/07, MattW <[EMAIL PROTECTED]> wrote: > > Dear Group, > > I've got an HTML page with associated CSS that I want to use as my > template. Just to test it, I call: > > return render_to_response('about.html') > > and I get the page, but with no CSS info. I've checked the page > source, and it

Re: Models Causing Admin to Crash

2007-02-26 Thread Honza Král
On 2/26/07, oggie rob <[EMAIL PROTECTED]> wrote: > > I can't tell if this is the cause, but you should remove the "pass" > right under "class Admin": pass is just an empty command, it doesn't do anything > > -rob > > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone:

Re: Models Causing Admin to Crash

2007-02-26 Thread Honza Král
On 2/26/07, DuncanM <[EMAIL PROTECTED]> wrote: > > Hi, > I have some models related to a football (soccer) team, I had models > for everything working fine except my Results model. I tried adding > it yesterday and encountered a few problems with it, which was solved > due to the help from these

Re: Newbie: Accessor and Definition help

2007-02-25 Thread Honza Král
On 2/25/07, DuncanM <[EMAIL PROTECTED]> wrote: > > I have 2 classes: > > class Player(models.Model): > team = models.ForeignKey(Team) > forename = models.CharField(maxlength=50) > surname = models.CharField(maxlength=50) > age = models.PositiveIntegerField() > sex =

Re: Aggregate class: a first-attempt

2007-02-24 Thread Honza Král
I created a ticket for this: http://code.djangoproject.com/ticket/3566 any comments are welcome On 2/23/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > >> items.aggregate((,), sum=( > >> 'field1', > >> 'field2', > >> ... > >> 'field20', > >> 'field21', > >>

Re: session variable

2007-02-23 Thread Honza Král
On 2/23/07, Seth Buntin <[EMAIL PROTECTED]> wrote: > > So I can have for instance: > > request.session["order_items"] = [] > > and then in different view I can have: > > request.session["order_items"].append(1) > > and that append to the session variable? yes, but the session

Re: Admin page: is it possible?

2007-02-23 Thread Honza Král
Hi enrico, for most of the things you want to do, it would be better to write your own app, using generic_views, it shouldn't require much coding and it would give you the desired functionality without horribly abusing the admin app. ;) On 2/23/07, morellik <[EMAIL PROTECTED]> wrote: > > Dear

Re: Aggregate class: a first-attempt

2007-02-23 Thread Honza Král
On 2/23/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > >> quseryset = Model.objects.all() > >> queryset.aggregate( ( 'name', 'city' ), sum=( 'pay', > >>> 'some_other_field' ), avg=( 'pay', 'age' ), count=True ) > >> I like this calling interface as an alternate method for its > >> fine-tuned

Re: Aggregate class: a first-attempt

2007-02-22 Thread Honza Král
On 2/23/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > >> I haven't yet figured out a way to suppress the order_by portion, > >> so what's currently in there is an ugly hack. But it would need > >> to prevent the standard methods from inserting an ORDER BY clause > >> against a non-aggregated

Re: Aggregate class: a first-attempt

2007-02-22 Thread Honza Král
On 2/22/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > Below I've pasted my first attempt at an aggregate function > class. Its __init__ takes a queryset (and an optional list of > aggregate functions to perform if, say, you only want the "sum"s > rather than min/max/avg/sum). Thus you should be

Re: username in the database

2007-02-22 Thread Honza Král
On 2/22/07, Mary <[EMAIL PROTECTED]> wrote: > > hi all; > > I am creating a model that will create a table that will contain some > articles that will be filled by admin people so i need to know how can > i create a > > field in the database that adds the user name of the logged person > when he

Re: Database changes

2007-02-20 Thread Honza Král
On 2/20/07, Mike H <[EMAIL PROTECTED]> wrote: > > > For me, if there was a way to simply add missing columns that would be > enough. Any data manipulation should be done by a patch runner that can > be tested and automated, but simply adding missing columns to a table I > think should be done by

Re: how to get a reference to a authenticated user

2007-02-20 Thread Honza Král
On 2/20/07, Honza Kr�l <[EMAIL PROTECTED]> wrote: > On 2/20/07, Benedict Verheyen <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > i have some tables that i want to link with an authorized user. > > Right now i use the login mechanism of django. > > > > 1. Is it possible to specify a foreign_key to

Re: how to get a reference to a authenticated user

2007-02-20 Thread Honza Král
On 2/20/07, Benedict Verheyen <[EMAIL PROTECTED]> wrote: > > Hi, > > i have some tables that i want to link with an authorized user. > Right now i use the login mechanism of django. > > 1. Is it possible to specify a foreign_key to the auth_user database? > If not, what is the best way to have a

Re: Database changes

2007-02-20 Thread Honza Král
On 2/20/07, kbochert <[EMAIL PROTECTED]> wrote: > > > > On Feb 19, 5:27 pm, "Lawrence Oluyede" <[EMAIL PROTECTED]> wrote: > > > All I can think of is to create a new model, say Poll1, with the > > > correct fields, do a syncdb, write and execute a python function to > > > transfer the data from

Re: Binary Data fields?

2007-02-19 Thread Honza Král
On 2/19/07, voltron <[EMAIL PROTECTED]> wrote: > > How would I go about saving images in a database? The imageField saves > images in the file system, how can I cleanly in a Djangoish way > override this? django currently doesn't support BLOBs so there is no way to do that in a clean django

Re: Admin without Auth

2007-02-19 Thread Honza Král
On 2/19/07, kbochert <[EMAIL PROTECTED]> wrote: > > > > On Feb 19, 1:25 pm, "Honza Kr�l" <[EMAIL PROTECTED]> wrote: > > On 2/19/07, kbochert <[EMAIL PROTECTED]> wrote: > > > > > > > > > On Feb 19, 12:46 pm, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > what exactly are you doing? > > > >

Re: Admin without Auth

2007-02-19 Thread Honza Král
On 2/19/07, kbochert <[EMAIL PROTECTED]> wrote: > > > > On Feb 19, 1:25 pm, "Honza Kr�l" <[EMAIL PROTECTED]> wrote: > > On 2/19/07, kbochert <[EMAIL PROTECTED]> wrote: > > > > > > > > > On Feb 19, 12:46 pm, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > what exactly are you doing? > > > >

Re: Admin without Auth

2007-02-19 Thread Honza Král
On 2/19/07, kbochert <[EMAIL PROTECTED]> wrote: > > > > On Feb 19, 12:46 pm, "Honza Kr�l" <[EMAIL PROTECTED]> wrote: > > > > > what exactly are you doing? > > this approach works perfectly for me... > > > I put the mentioned sql in a file in my Djano installation django/ >

Re: Admin without Auth

2007-02-19 Thread Honza Král
On 2/19/07, kbochert <[EMAIL PROTECTED]> wrote: > > > > On Feb 19, 1:11 pm, "Chris Brand" <[EMAIL PROTECTED]> wrote: > > > I then erase my apps database and run 'manage.py syncdb' > > > > Are you aware that you don't have to erase the database before running > > syncdb ? If you don't erase the db,

Re: django admin - too many sql-queries

2007-02-18 Thread Honza Král
On 2/18/07, James Bennett <[EMAIL PROTECTED]> wrote: > > On 2/18/07, VIK_Tomas <[EMAIL PROTECTED]> wrote: > > class Action(models.Model): > >name = models.CharField(maxlength=64, unique=True) > >photo = models.ForeignKey('Photo', null=True, blank=True) > > Set 'raw_id_admin=True' on the

Re: Custom Admin save function

2007-02-18 Thread Honza Král
On 2/18/07, Florian Apolloner <[EMAIL PROTECTED]> wrote: > > 2007/2/18, Honza Kr�l <[EMAIL PROTECTED]>: > > I just wrote it into the email as an example of how I would go about > > doing something like this, I said you will have to tweak it a bit, try > > it in shell first and see how its

Re: global name '_get_deleted_objects' is not defined

2007-02-18 Thread Honza Král
On 2/18/07, Robin Percy <[EMAIL PROTECTED]> wrote: > Has anyone else run into the following error when deleting objects using the > newforms-admin branch? > > Exception Value: global name '_get_deleted_objects' is not defined > Exception Location: >

Re: how to count many-to-many relations?

2007-02-18 Thread Honza Král
Hi, I believe you could use queryset.extra( select={ 'B_count' : 'SELECT COUNT(*) FROM myapp_a_bs WHERE a_id = myapp_a.id' } ) it will result in a slightly different, but equivalent, query: SELECT myapp_a.id, myapp_a, ..., ( SELECT COUNT(*) FROM myapp_a_bs WHERE a_id = myapp_a.id ) AS

Re: Custom Admin save function

2007-02-18 Thread Honza Král
On 2/18/07, Florian Apolloner <[EMAIL PROTECTED]> wrote: > > I got a few questions cause it is not working (I assume I am to > silly): > > def save( self ): > > old_data = self.__class__.objects.get(pk=self.id).__dict__ > I can substitue pk with id (this is my primary...) sure, that's exactly

Re: django admin - too many sql-queries

2007-02-18 Thread Honza Král
On 2/18/07, Gary Wilson <[EMAIL PROTECTED]> wrote: > > On Feb 18, 10:48 am, "Honza Kr�l" <[EMAIL PROTECTED]> wrote: > > On 2/18/07, Tom? Pokorn? <[EMAIL PROTECTED]> wrote: > > > > > models.py attached. > > > > > On Sun, 2007-02-18 at 16:51 +0100, Honza Kr?l wrote: > > > > > > that's odd can you

Re: django admin - too many sql-queries

2007-02-18 Thread Honza Král
On 2/18/07, Tom� Pokorn� <[EMAIL PROTECTED]> wrote: > models.py attached. > > > On Sun, 2007-02-18 at 16:51 +0100, Honza Kr�l wrote: > > > > > that's odd can you post your Model definition? definitely odd, list_select_related appears to have no effect on the sql queries. even if I add photo to

Re: Custom Admin save function

2007-02-18 Thread Honza Král
On 2/18/07, Florian Apolloner <[EMAIL PROTECTED]> wrote: > > > you simply override the save() function to do what you described: > > create another instance and mark this one as deleted... > That's what I want to do > > > what is now in 'm' ?? the new object, the one merked for deletion? etc.

Re: django admin - too many sql-queries

2007-02-18 Thread Honza Král
On 2/18/07, VIK_Tomas <[EMAIL PROTECTED]> wrote: > > > > > http://www.djangoproject.com/documentation/model_api/#list-select-related > > > > a try add > >class Admin: > list_select_related = True > > to all models, but it has no effect - "Edit Action" is still very > slow. > > with this

Re: ManyToManyField does not allow empty relations

2007-02-18 Thread Honza Král
On 2/18/07, akonsu <[EMAIL PROTECTED]> wrote: > > thanks for your response. > > specifying null=True for ManyToManyField will allow nulls in the > corresponding field in the association table, right? but since this > table is just a list of pairs this is not needed because having no > row at all

Re: ordering - how to using relation or db function

2007-02-18 Thread Honza Král
AFAIK this is currently not possible with django's ORM, you can work around that by using: queryset.order_by().extra( where=[ ' 1=1 ORDER BY whatever' ] ) which means: on queryset, reset sorting and to where clause append 1=1 (so if the SQL has correct syntax) and ORDER BY whatever... but I

Re: django admin - too many sql-queries

2007-02-18 Thread Honza Král
On 2/18/07, VIK_Tomas <[EMAIL PROTECTED]> wrote: > > Hi, > > I have db-model like this: > > class Action(models.Model): >name = models.CharField(maxlength=64, unique=True) >photo = models.ForeignKey('Photo', null=True, blank=True) > > class Album(models.Model): >action =

Re: Custom Admin save function

2007-02-18 Thread Honza Král
you simply override the save() function to do what you described: create another instance and mark this one as deleted... the only problem I can think of is with the instance for example if I do m = Model.objects.all()[0] m.some_field = 'new value' m.save() what is now in 'm' ?? the new

Re: newforms select field

2007-02-18 Thread Honza Král
On 2/18/07, paulh <[EMAIL PROTECTED]> wrote: > > Thanks for the replies. As always, reading the docs again teaches you > a bit more than the first time; I now see that that initial was not > what I was after. > > Arnaud, I think your method is more what I was after and as you say, > it does

Re: newforms select field

2007-02-17 Thread Honza Král
On 2/17/07, paulh <[EMAIL PROTECTED]> wrote: > > I feel the following should work: > class Myform(forms.Form): > ...publ = forms.ChoiceField(label='Publisher', required=False) > > and then in handler I should be able to set the choices dynamically > by: > > def meth(request): >

Re: error pages ?

2007-02-17 Thread Honza Král
On 2/17/07, akonsu <[EMAIL PROTECTED]> wrote: > > hello, > > the tutorial on djangoproject.com explains how to set up views > generating error pages for responses such as 404 or 500. is there a > way to use mod_python functionality and make apache serve its own > error pages? in case when it is

Re: Help about saving two linked instances...

2007-02-17 Thread Honza Král
Hi Giuseppe, On 2/17/07, Giuseppe Franchi <[EMAIL PROTECTED]> wrote: > > Hello everyone! > I've approached Django and Python from a few time and i love them > both. > As i am newbie i have a noobish question. My problem is: i have to > store a Resource object splitted in two tables as following:

Re: Custom model initializers - getting logged in user in django models

2007-02-17 Thread Honza Král
This doesn't seem very clean to me... I also need to have logged-in user available in my models, so I have written a custom middleware that stores the user in thread_locals: import threading _thread_locals = threading.local() def get_current_user(): return getattr( _thread_locals, 'user',

Re: rendering dynamic fields in newforms

2007-02-17 Thread Honza Král
for rendering you should use BoundField... I use something like this... for s in : name = 'stay_' + str( s.id ) bf = BoundField( self, self.fields[name], name ) output.append( u'%s' % bf ) On 2/17/07, Rubic <[EMAIL PROTECTED]> wrote: > > Hi, I'm

Re: Problems with session middleware

2007-02-15 Thread Honza Král
On 2/16/07, Almad <[EMAIL PROTECTED]> wrote: > > Hello, > > please...nobody have a clue? > > I've run into same issue again and it's somehow making django usuable > for me :-( > > (and yes, still with the freshest trunk) > > Thank You, > > Almad my guess would be that you are somewhere returning

Re: Users permissions

2007-02-15 Thread Honza Král
it's impossible at the moment, but it should be possible with the newforms-admin branch via a hook On 2/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hello, I'm thinking about create a website using django. One of the > apps would be a news section, where everybody can publish the news

Re: Django Cheat Sheet

2007-02-13 Thread Honza Král
On 2/13/07, Matt <[EMAIL PROTECTED]> wrote: > > Cheers for all the feedback guys. Well, cheers to you in the first place... ;) Here's a reply to your questions so > far. > > As Malcolm Tredinnick pointed out in a private reply (and James Bennet > here), Django doesn't mind whether you pass it a

Re: Newforms: Can I do these?

2007-02-11 Thread Honza Král
On 2/12/07, johnny <[EMAIL PROTECTED]> wrote: > > One last thing forgot to ask: What about forms.ImageField? forms.FileField, but you have to do some coding on your own > > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585

Re: Newforms: Can I do these?

2007-02-11 Thread Honza Král
yes $ sed -ne 's;^class \([a-zA-Z]\{1,\}\)(.*;\1;p' django/newforms/fields.py Field CharField IntegerField DateField TimeField DateTimeField RegexField EmailField URLField BooleanField NullBooleanField ChoiceField MultipleChoiceField ComboField MultiValueField SplitDateTimeField On 2/11/07,

Re: use newforms in regestration problem

2007-02-11 Thread Honza Král
On 2/11/07, lee <[EMAIL PROTECTED]> wrote: > hi all, > > I am a newbie to django, I want to use 'newforms' module to generate a > regestration page, because it can validate the data automatically, but > there is a problem: > > As usual, web site always let people input password twice when

Re: new forms - problem populating with data from a table

2007-02-10 Thread Honza Král
On 2/10/07, Lawrence Oluyede <[EMAIL PROTECTED]> wrote: > > > I now want to take an existing user record and create an edit account > > form, where the data entered by the user in the registration form is > > represented and available to edit. Seemed simple when I set out to do > > it, but I can't

Re: new forms - problem populating with data from a table

2007-02-10 Thread Honza Král
On 2/10/07, daev <[EMAIL PROTECTED]> wrote: > > On Feb 9, 10:12 pm, "Tipan" <[EMAIL PROTECTED]> wrote: > > > else: > > form=UserAccountForm() > > return render_to_response('account.html',{'form':form}) > somthing like this: > form = UserAccountForm(

Re: ManyToOneRel error on newforms branch

2007-02-07 Thread Honza Král
On 2/8/07, Mae <[EMAIL PROTECTED]> wrote: > > I don't have any raw_id_admins in my code... :( yeah, I am sorry, I jumped to the wrong conclusion (note to self, do not post after having more beers)... the problem seems to ( grep -r raw_id_admin django_src_dir ) be in

Re: ManyToOneRel error on newforms branch

2007-02-07 Thread Honza Král
On 2/8/07, Mae <[EMAIL PROTECTED]> wrote: > > So, I have a model that's set up exactly like the docs on Many-To-Many > relationships with intermediary tables describe here (http:// > www.djangoproject.com/documentation/models/m2m_intermediary/). > > Using the most recent django-newforms branch,

Re: Can I get stdout from mod_python?

2007-02-05 Thread Honza Král
On 2/5/07, quentinsf <[EMAIL PROTECTED]> wrote: > > I'm developing some code which I need to run under mod_python - the > 'runserver' option won't work because it's complex stuff and I need to > handle multiple simultaneous requests, even in the early debugging > stages. > > It would be really

Re: urls parameter - deliver query set

2007-02-05 Thread Honza Král
to try and serialize queryset (or any other object for that matter), pass it to the user and than back to server is just not nice... try passing the parameters needed to construct the queryset, store it temporarily in a DB (session or some cache backend) or anything, just don't give it to the

Re: Help with Last Seen (why doesn't this work???)

2007-02-01 Thread Honza Král
btw, some literature about python and programming in general would perhaps be in order... I recommend diveintopython.org On 2/1/07, Honza Kr�l <[EMAIL PROTECTED]> wrote: > On 2/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > I like that brevity and simplicity, but could you clarify

Re: Help with Last Seen (why doesn't this work???)

2007-01-31 Thread Honza Král
this seems more accurate: def process_request( self, request ): now = datetime.datetime.now() # get last_request, defaults to now, when he was never seen before # you may wish to omit setting last_seen in that case (he wasn't ever seen) last_request =

Re: Help with Last Seen (why doesn't this work???)

2007-01-31 Thread Honza Král
On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I know I'm dense, and I'm just not seeing this, but isn't that what > I'm doing? > > now = datetime.datetime.now() > last_request = request.session['last_request'] > > if (now - last_request).seconds > (60 * 60 *4): > ... but this line:

Re: Help with Last Seen (why doesn't this work???)

2007-01-31 Thread Honza Král
On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Ok, but if I update last_request at every request, then won't (now - > last_request) ALWAYS be more or less 0? not if you update it AFTER the comparison... > > > On Jan 31, 4:16 am, "Honza Kr�l" <[EMAIL PROTECTED]> wrote: > > On

Re: Help with Last Seen (why doesn't this work???)

2007-01-31 Thread Honza Král
On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > There's some conceptual thing I'm apparently just not getting. I > attempted to follow Doug's advice and came up with: > > class LastSeen (object): > """Middleware that adds various objects to thread local storage > from the request

Re: New Vim files for Django

2007-01-29 Thread Honza Král
On 1/28/07, Dave Hodder <[EMAIL PROTECTED]> wrote: > > Hello, > > Updated syntax files for the Vim editor are available here: > > http://www.vim.org/scripts/script.php?script_id=1487 > > Improvements include: > >* Support for the new comment syntax, e.g. {# greeting #}. > >* Better

Re: order_by not working with foreign keys:

2007-01-24 Thread Honza Král
On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > > Honza Kr�l wrote: > > it occured before on the mailing list... > > > > if you add select_related(), it will work... > > > > the problem is that specifying ordering like this doesn't force the > > join in the query so you might end

Re: newforms & object save

2007-01-24 Thread Honza Král
see ticket #3257 it is complete patch with tests, the only thing missing is a decision whether (and potentially how) to add ( "", "-" ) to choices magically if required is False On 1/24/07, ak <[EMAIL PROTECTED]> wrote: > > Adrian, is there any progress on correct handling of foreign key

Re: order_by not working with foreign keys:

2007-01-23 Thread Honza Král
it occured before on the mailing list... if you add select_related(), it will work... the problem is that specifying ordering like this doesn't force the join in the query so you might end up with a query that sorts on something that just isn't there... On 1/23/07, Bram - Smartelectronix

Re: Customizing the class returned by newforms.form_for_model()

2007-01-15 Thread Honza Král
plus you can supply a super class that the resulting class will subclass via the form keyword argument... On 1/16/07, Honza Kr l <[EMAIL PROTECTED]> wrote: On 1/16/07, jfagnani <[EMAIL PROTECTED]> wrote: > > I'm just starting to learn newforms myself, but it looks like > form_for_model returns

Re: Customizing the class returned by newforms.form_for_model()

2007-01-15 Thread Honza Král
On 1/16/07, jfagnani <[EMAIL PROTECTED]> wrote: I'm just starting to learn newforms myself, but it looks like form_for_model returns a class, so shouldn't you be able to subclass it? I'm not sure how that would work though, since the class doesn't exist when defining your subclass, but that's

Re: newforms : how to display as_ul from views.py

2007-01-15 Thread Honza Král
maybe I am missing something but why don't you use {{ form.as_ul }} in your template?? On 1/15/07, Ramdas S <[EMAIL PROTECTED]> wrote: How do I get the templates to render the following form from the views.py given below as as unordered list, instead of the standard table formt. This is a

Re: add manipulator with current user field

2007-01-14 Thread Honza Král
On 1/14/07, James Tauber <[EMAIL PROTECTED]> wrote: On 14/01/2007, at 10:29 AM, Honza Kr l wrote: > On 1/14/07, James Tauber <[EMAIL PROTECTED]> wrote: >> >> I have a model with a required field of ForeignKey(User) >> >> What's the easiest way to write an add manipulator that automatically >>

Re: how to do SQL SUM

2007-01-14 Thread Honza Král
On 1/14/07, Mark Striebeck <[EMAIL PROTECTED]> wrote: Hey, that's exactly what I needed too. But when I tried it, I got a OperationalError: (1140, 'Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause') my bad... sorry try

Re: add manipulator with current user field

2007-01-14 Thread Honza Král
On 1/14/07, James Tauber <[EMAIL PROTECTED]> wrote: I have a model with a required field of ForeignKey(User) What's the easiest way to write an add manipulator that automatically provides the current authenticated user for that field? do not write it at all, use generic views and wrap it in

Re: django.contrib.auth.decorators._checklogin didn't return an HttpResponse object.

2007-01-13 Thread Honza Král
the problem is not in django, it is more likely in your code... you have probably applied the login_required decorator to a view function, that does not correctly return the HttpResponse object... again if you would post the function we could tell you more... Honza On 1/14/07, rzimerman <[EMAIL

Re: Please help me use "views.django.views.static"

2007-01-13 Thread Honza Král
How does your ENTIRE urls.py look? it looks like you supplied a prefix (mysite.www) to the patterns function, so that it is prepended to every view name you put there... remove it and it should be OK On 1/14/07, rzimerman <[EMAIL PROTECTED]> wrote: I want the Django development web server to

Re: generic views and non-editable foreign keys

2007-01-13 Thread Honza Král
I would recommend you reading this blog by James Bennet: http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views it has some great tips on using and extending generic views... On 1/14/07, qhfgva <[EMAIL PROTECTED]> wrote: So far I've been using generic views for

Re: newforms and dynamic choices

2007-01-13 Thread Honza Král
On 1/13/07, Brian Victor <[EMAIL PROTECTED]> wrote: Let's say there's a Room model. And let's say there's a ManyToMany relationship with User to specify which users can schedule certain rooms. How should a person in such a circumstance create a SelectField on a form with a user's rooms as

Re: Latex Rendering

2007-01-13 Thread Honza Král
or you can simply output the latex code using templates... its just a text file and thus can be rendered via the standard mechanism... we use this approach to generate RTF files On 1/12/07, Kjell Magne Fauske <[EMAIL PROTECTED]> wrote: Anush Shetty wrote: > Hi, > I want to build a wiki with

  1   2   >