How to write to the history

2009-07-01 Thread mettwoch
Hi group, What would be a good way to log changes made to models from outside the admin interface? Thanks for any hint Marc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

Re: How to write to the history

2009-07-02 Thread mettwoch
Thanks a lot! Marc On Jul 1, 9:46 pm, Rajesh D wrote: > On Jul 1, 12:10 pm, mettwoch wrote: > > > Hi group, > > > What would be a good way to log changes made to models from outside > > the admin interface? > > Look at the log_* methods in

Keep session data between user switches

2009-07-02 Thread mettwoch
Hi, I write a POS application and several users share the same terminal. They use a barcode scanner to point to their badge to login (works already). I'd like to keep the session data for every user so that when user A leaves the terminal and user B makes an invoice and user A comes back to the t

Re: Keep session data between user switches

2009-07-03 Thread mettwoch
User model. Anyway I felt already that the User would quickly become an integral part of the business model and as such needs to be extended. Thanks for your help Marc On Jul 2, 7:17 pm, Rajesh D wrote: > On Jul 2, 12:18 pm,mettwoch wrote: > > > Hi, > > > I write a POS applicat

Don't understand ModelForm

2009-07-21 Thread mettwoch
Hi, I'd like to implement a simple "create" & "update" form for my "Partner" model using ModelForm. How can I make the difference in a view "save" function whether the POST comes from a "creation" or an "update" form? Unfortunately the primary-key seems never to be included by default in the form

Re: Don't understand ModelForm

2009-07-21 Thread mettwoch
Sorry my old brain doesn't get it. Is there somewhere a complete CRUD example using ModelForm? Thanks Marc On Jul 21, 6:04 pm, Shawn Milochik wrote: > On Jul 21, 2009, at 12:00 PM, mettwoch wrote: > > > > > > > Hi, > > > I'd like to impleme

Re: Don't understand ModelForm

2009-07-21 Thread mettwoch
Hi again, That's exactly what I did and the point is that it doesn't work! See my comments below ... On Jul 21, 8:00 pm, Shawn Milochik wrote: > On Jul 21, 2009, at 12:49 PM, mettwoch wrote: > > > > > Sorry my old brain doesn't get it. Is there somewhere

Re: Don't understand ModelForm

2009-07-21 Thread mettwoch
Sorry to insist, but that's what I don't understand here. How can I know that the partner that is 'posted' is new or not? I really become crazy here. I can't believe after all the good things I've discovered in Django that this can be so hard. Thanks for your time > > You are right, I made a mist

Re: Don't understand ModelForm

2009-07-21 Thread mettwoch
wrote: > On Jul 21, 2009, at 3:39 PM, mettwoch wrote: > > > > > Sorry to insist, but that's what I don't understand here. How can I > > know that the partner that is 'posted' is new or not? I really become > > crazy here. I can't believe after

Re: Don't understand ModelForm

2009-07-21 Thread mettwoch
... as I said: maybe I'm on the wrong track with ModelForm ... On Jul 21, 10:22 pm, Dan Harris wrote: > What do you mean by having the ID "in" the form? I don't quite > understand what you are trying to

Re: Don't understand ModelForm

2009-07-21 Thread mettwoch
Of course! The mistake is that I didn't have the ID in the URL, but I took the partner to be edited somewhere from the session. I'll change the code and it should work as expected. Thanks again for your patience Marc On Jul 21, 10:57 pm, Daniel Roseman wrote: > On Jul 21, 9:34

Model instance refreshing

2009-08-17 Thread mettwoch
Hi, I use a session to store several instances of different models coming from a: some_model.objects.get(pk = some_pk) When the data in the db changes the model instances in the session still contain the old data. What would be a good strategy to make shure that all objects in a session get fre

Re: Model instance refreshing

2009-08-18 Thread mettwoch
Oooh, obvious! It requires alot of changes, but I think I'll do it. Thanks Colin Marc On Aug 17, 10:43 pm, Colin Bean wrote: > On Mon, Aug 17, 2009 at 1:31 PM, mettwoch wrote: > > > Hi, > > > I use a session to store several instances of differen

Aggregation on expressions

2009-08-18 Thread mettwoch
Hi, Some time ago I asked if there is a way to aggregate on an expression and I was told that it's not possible at the moment. I managed to use a mix of aggregation and some arithmetics to reduce processing time by a factor of 20 in critical areas of my application. While doing so, I felt that so

Re: Aggregation on expressions

2009-08-18 Thread mettwoch
lField() quantity = models.DecimalField() total = models.ExpressionField('price * quantity') The SQL looks something like this for InvoiceLine.objects.all(): SELECT price, quantity, price * quantity AS total FROM invoiceline; Marc On Aug 18, 4:08 pm, Russell Keith-Magee w

Re: template syntax

2009-08-18 Thread mettwoch
Use: {% name_of_your_dictionary.key_you_want_to_access %} Remember that templates use the '.' (dot) to access keys, attributes, indexes ... Kindly Yours Marc On Aug 18, 4:55 pm, elminio wrote: > Hi, > > Im passing to the template dictionary and I would like to get by key > to the value of tha

Re: template syntax

2009-08-18 Thread mettwoch
See this: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for There's an example of iterating over key, value pairs Marc On Aug 18, 5:48 pm, elminio wrote: > I iterate through all students and have distionary containing students > ids as key and for example grade as a value. I pa

Dynamically constructing a Form

2009-08-20 Thread mettwoch
Hi, I'd like to dynamically construct a form. Is there a way to do something like this ... from django import forms my_form = forms.Form() ... and then add fields to my_form possibly along with their value. I've tried to add the fields directly to the fields dictionary and values to the data

Re: UnicodeEncodeError on csv export

2009-08-20 Thread mettwoch
I ran into the same problem and I found in the Python documentation that the csv module has some Unicode issues ... http://docs.python.org/library/csv.html?highlight=csv#module-csv ... with an attempt to getting around it with a wrapper ... http://docs.python.org/library/csv.html?highlight=csv#

Re: Dynamically constructing a Form

2009-08-20 Thread mettwoch
Answering to myself, I got it to work with assigning to the 'fields' and 'initial' attributes of the instantiated form. Again, I feel that this is a kind of hack and may not work with future versions of Django. Marc On Aug 20, 11:03 am, mettwoch wrote: > Hi, >

Re: Aggregation on expressions

2009-08-20 Thread mettwoch
m, Russell Keith-Magee wrote: > On Tue, Aug 18, 2009 at 10:48 PM, mettwoch wrote: > > > The whole thing behind that it is: I'm developing an invoicing/ > > inventory application and I run into performance problems that might > > require using raw SQL and admittedly I

print PDF on windows

2009-08-25 Thread mettwoch
How do the Django people handle printing directly on Windows? I remembered about http://timgolden.me.uk/python/win32_how_do_i/print.html, but unfortunately his method for PDFs only print on the default printer. I need the server to produce the PDF, save it (works already) and send it to a specific

Re: print PDF on windows

2009-08-26 Thread mettwoch
Adobe Reader on windows isn't the most stable especially when > it comes to open many PDFs - you might have to manually manage > instances to make sure it doesn't eat up all your memory. Foxit Reader > however doesn't render all PDFs perfectly, or at least the same way > th

Re: print PDF on windows

2009-08-27 Thread mettwoch
wrote: > 2009/8/27 mettwoch : > > > > > I'm now using Foxit Reader. Thanks for the tip. The following works > > perfectly in the Django shell and prints the document in > > attachment.file.path to the specified network printer: > > > p = Popen (['

Date Field in ModelForm

2009-09-09 Thread mettwoch
Hi, I don't understand why the following code produces an error (see below): >>> from django import forms >>> from ishop.bo.models import Document >>> d = Document.objects.get(pk=8) >>> print d.date_due 2009-08-28 >>> class df(forms.ModelForm): >>> class Meta: >>> model = Documen

Re: Date Field in ModelForm

2009-09-09 Thread mettwoch
Here is the definition of the field: date_due = models.DateField(auto_now_add=True) On Sep 9, 12:57 pm, Daniel Roseman wrote: > On Sep 9, 11:49 am, mettwoch wrote: > > > > > Hi, > > > I don't understand why the following code produces an error

Re: Date Field in ModelForm

2009-09-09 Thread mettwoch
Some more info: Windows Vista Django 1.1Final PostGreSQL 8.3.7 psycopg2 Python 2.5.4 mod_wsgi Apache2.2 On Sep 9, 12:57 pm, Daniel Roseman wrote: > On Sep 9, 11:49 am, mettwoch wrote: > > > > > Hi, > > > I don't understand why the following code

Re: understsanding views

2009-09-09 Thread mettwoch
That function should at least return somewhere, I guess to the caller which might be a "view" function that returns a HttpResponse. Anyway, You should consider putting code that updates the database in the "model". Marc On Sep 9, 4:25 pm, elminio wrote: > Hello, > > I assume that each view sho

A long way ...

2009-04-07 Thread mettwoch
Hi, I've been watching Django and other Python frameworks a few years ago and stopped at version 0.96. Last year I started to look at a web framework to move an old M$ Access Inventory application to a more stable and universal architecture. Turbogears was the choice and a few weeks ago I redisco

Re: A long way ...

2009-04-08 Thread mettwoch
? Marc On Apr 8, 4:54 am, Malcolm Tredinnick wrote: > On Tue, 2009-04-07 at 14:31 -0700, mettwoch wrote: > > Hi, > > > I've been watching Django and other Python frameworks a few years ago > > and stopped at version 0.96. Last year I started to look at a web >

Sequence number generation

2009-04-29 Thread mettwoch
Hi, I'm rather new to Django (and webapp development) and I'd appreciate any advice on the following problem. I've a model named 'document' that can hold any kind of documents like customer invoices, supplier invoices, goods returned, ..., but I've to ensure that the customer invoices be numbere

Re: Sequence number generation

2009-05-04 Thread mettwoch
Read, re-read and then ask a question ;-). So I'm answering my question myself: Use the TransactionMiddleware to tie together the two updates. On Apr 29, 3:20 pm, mettwoch wrote: > Hi, > > I'm rather new to Django (and webapp development) and I'd appreciate > any advi

Aggregate

2009-05-27 Thread mettwoch
Hi Group, I wonder if there's a way to aggregate an expression like: Sum("quantity*price") on a model having "quantity" and "price" fields. Marc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django user

Re: Aggregate

2009-05-27 Thread mettwoch
Thanks Alex, but then I wonder if it would be reasonable to move this kind of simple rules to a "view" in the database and let Django access the view rather than the raw table. Any experience with that? Marc On May 27, 4:49 pm, Alex Gaynor wrote: > On Wed, May 27, 2009 at 9:45

Re: Newb - how to remember the main course while we select the dessert

2009-06-04 Thread mettwoch
The choices are sent to the kitchen and I suppose You also want to be payed by the customer. You could think about using a database to hold the customer's order. The kitchen could list all orders that have status "to be cooked" and later use the orders that have status "to be payed" to print the i

success story - thanks to all

2009-09-22 Thread mettwoch
Hi, I'd just like to share with you all a great moment. We switched today from our old inventory/invoicing app to a new Django/PostGreSQL based solution. Thank you so much for all the kind hints and help that I got over the last 3 month and that helped getting to this point. Some facts: - Up to

Building Q queries

2009-11-04 Thread mettwoch
Hi, I wonder if I can use the Q object to build queries interactively and store them for repeated use. I imagine building up the tree of the Q object in a simple web interface that introspects the models, shows the fields and some operators and let the user build, name and store queries for later

Calling method of a proxy-model in a template

2010-09-30 Thread mettwoch
Hi, Let's say that I have a proxy model of the User model that adds some methods. What would be an elegant way to access these methods from within a template in the same easy way I access the User attributes through {{ request.session.user.some_attribute }}. Kindly Yours Marc -- You received th

Re: Calling method of a proxy-model in a template

2010-10-08 Thread mettwoch
Hi Daniel, Thanks for the hint, I've read through the documentation and I should be able to handle it despite the fact that I'm more of a "surface" than an "underground" programmer. Kindly Yours Marc On Sep 30, 5:19 pm, Daniel Roseman wrote: > On Sep 30, 3