Re: Journals and Documents in an accounting application

2009-06-04 Thread Luc Saffre
On 5.06.2009 4:39, Karen Tracey wrote: > My first thought would be to not store that value in a model at all, but > rather pull it from the DB as max of the appropriate column when needed. Yes, that would make things easier and more straightforward. But some features that are easy with my setup

Newbie - record parent ID in child data entered by ModelForm

2009-06-04 Thread adelaide_mike
Another "in principle" question. My Street model is the parent of my Property model, many to one via foreign key. User selects the street and I store it in request.session. User then gets to enter the property details in this form: class PropertyForm(ModelForm): class Meta:

Re: Noobie question about getting form data to save to the database

2009-06-04 Thread Streamweaver
You need to call form.save() after you validate the form. As below: def add(request): if request.method == 'POST': form = AddShow(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/shows/#success') return HttpResponseRedire

Related Managers and use_for_related_fields strangeness

2009-06-04 Thread Streamweaver
I'm still struggling a bit with related managers. I have what I think should work right by the documentation but behavior isn't as expect. I've pasted the actual code below but the basic deal is this. I have a Project model which has Releases so Releases have a FK field for Projects. I want to

Re: Journals and Documents in an accounting application

2009-06-04 Thread Karen Tracey
On Thu, Jun 4, 2009 at 3:25 PM, Luc Saffre wrote: > > On 4.06.2009 19:46, Karen Tracey wrote: > > Well the problems the test reveal with the in-memory Journal instance > > having a stale lastnum after documents are deleted is a bit of a gotcha > > with they way you have set this up. Though it's

Historical Records (as introduced in the Pro Django book)

2009-06-04 Thread chris
Hi there, I am struggling with the Historical Records model, which is introduced in Apress' Pro Django book by Marty Alchin. (Apologies if this is off- topic. I tried to contact the author but never got a reply) In a nutshell, this is a very clever approach to keeping track of changes in model

Problems with .htacces and dispatch.fcgi on shared hosting platform

2009-06-04 Thread Robocop
Hello Again, In pursuing a solution to one problem, i seemed to have created another. After playing around a bit with my dispatch.fcgi script, i started getting django application errors. After some frustration i restored my scripts to the half working state they were in when i had started. How

Noobie question about getting form data to save to the database

2009-06-04 Thread Andy Dietler
I'm pretty new to Django and Python and I've had some success from reading some books and guides playing around so far but I'm having trouble figuring out how to get data I submit from a form to save into the database. I've simplified down my code to just the basics and I can get the form to submi

Re: simple of flatpages with custom ordering

2009-06-04 Thread josebrwn
thank you! --~--~-~--~~~---~--~~ 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 django-users+unsubscr

Re: multiple modelforms for model

2009-06-04 Thread phred78
http://docs.djangoproject.com/en/1.0/topics/forms/ --~--~-~--~~~---~--~~ 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 grou

Re: multiple modelforms for model

2009-06-04 Thread phred78
You have to put these in a forms.py files inside your app. They are not database models, so syncdb is maybe ignoring the whole thing? Hope that helps. Fred On Jun 5, 12:08 am, adrian wrote: > I need to show Telephone and Address modelforms in the middle of > another big form, > so I decided to

multiple modelforms for model

2009-06-04 Thread adrian
I need to show Telephone and Address modelforms in the middle of another big form, so I decided to organize the big form into smaller modelforms and display each in a separate fieldset. This works well until the next time I clear the DB and run syncdb. At that point, syncdb completely ignores th

Re: select size box error

2009-06-04 Thread phred78
Do you think maybe the view is expecting a value from each one of the dropdowns? I had a similar problem with an input box and had to tell the view what to do if there was no value submitted. Otherwise it would give out an error. I can't see from your code, but are you using POST or GET? Cheers,

Re: strange behaviour when running manage.py shell with ipython

2009-06-04 Thread FranckB
I've same problems when launching ./manage.py shell --plain On 4 juin, 23:46, FranckB wrote: > Does anyone experiences keyboard and autocompletion problems when > running manage.py shell whith ipython ? > It sounds very strange, if i run ipython i have no problem with > browsing modules and usin

strange behaviour when running manage.py shell with ipython

2009-06-04 Thread FranckB
Does anyone experiences keyboard and autocompletion problems when running manage.py shell whith ipython ? It sounds very strange, if i run ipython i have no problem with browsing modules and using addictive shortcuts like cursor keys, but whithin a django project context i just can't use it, no au

Re: Django Registration templates not talking to my other pages. Sometimes.

2009-06-04 Thread Matt
Thanks for replying so quickly. It looks like you're right and the login page isn't actually logging users in. Any idea why that might be? I'm using the auth.login view and a template that looks like this: ##login.html {% extends "base.html" %} {% block content %} {% if form.errors %} Your us

Raw SQL is okay but .objects.all() returns only two of 2933 rows

2009-06-04 Thread modelmike
Hi, I am running svn revision 10924 on Windows Server 2008 with Oracle 10g release 2. Using inspectdb, I created a model for an Oracle table. When I issue .objects.all() for the new model, the records returned are records added using either the Python interpreter or the Django admin. None of t

Re: __all__in instead of __in

2009-06-04 Thread ryan
actually, you need to do something like this: user_stations = u.get_profile().station.all().values_list('pk', flat=True) excluded_stations = Station.objects.exclude(id__in=user_station_pks) all_terrestrial_active_orders = Order.objects.filter(order_type=0, in_market=True, end_date__gte=today) ter

Re: Modifying the way a ChoiceField is rendered

2009-06-04 Thread notcourage
I wish there was an easy way to customize CheckboxSelectMultiple. The widget library doesn't seem to have a well-defined customization method beyond subclass, paste the superclass impl, and edit it. I don't like the . I want to create a variant which shows thumbnails for image choices. On Jun 4,

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

Re: How to SEO adapt a I18N django web site..

2009-06-04 Thread jenlu
Great and thanks, on the road but will get these fixes done when I get back on Monday. Thx !!! --~--~-~--~~~---~--~~ 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@g

Re: Journals and Documents in an accounting application

2009-06-04 Thread Luc Saffre
On 4.06.2009 19:46, Karen Tracey wrote: > Well the problems the test reveal with the in-memory Journal instance > having a stale lastnum after documents are deleted is a bit of a gotcha > with they way you have set this up. Though it's easily fixed in the > test, I fear actual code that uses thes

Re: __all__in instead of __in

2009-06-04 Thread ryan
answering my own question, seems like: Order.objects.filter(Q(station=1), Q(station=2), Q(station=3)) -ryan On Jun 4, 2:29 pm, ryan wrote: > #models.py > class Station(models.Model): >     station_name = models.CharField(max_length=20) > > class Order(models.Model): >     station = models.Many

__all__in instead of __in

2009-06-04 Thread ryan
#models.py class Station(models.Model): station_name = models.CharField(max_length=20) class Order(models.Model): station = models.ManyToManyField(Station, blank=True, null=True) class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) station = models.ManyToM

Re: simple of flatpages with custom ordering

2009-06-04 Thread Alex Gaynor
On Thu, Jun 4, 2009 at 12:52 PM, josebrwn wrote: > > Hi, > > I would like to have a list of recent flatpages. I'm doing something > like: > > class LatestCmsNode(template.Node): >def render(self, context): >context['latest_cms'] = FlatPage.objects.all()[:2] >

simple of flatpages with custom ordering

2009-06-04 Thread josebrwn
Hi, I would like to have a list of recent flatpages. I'm doing something like: class LatestCmsNode(template.Node): def render(self, context): context['latest_cms'] = FlatPage.objects.all()[:2] return '' but this orders the results by url (title), and wh

Re: Ajax with JSON-RPC -- new Django handler

2009-06-04 Thread BenW
I made a few changes to make it a bit more general-purpose. It now uses @publicmethod instead of the horrific public__ notation. However, the dispatcher class just checks if method.__class__.__name__ == 'publicmethod' and __public__ == True inside it. This seems a bit odd but I'm not sure how to

Re: Feedparser problem

2009-06-04 Thread Derek Willis
I just tried the code and it worked for me (although I do work for the NYT, so I hope it would!), so I'm guessing it's a Windows 7 issue - perhaps it doesn't treat feedparser requests the same as other Python scripts for purposes of requesting urls? Derek On Jun 4, 11:40 am, Jonathan Nelson wro

Re: Journals and Documents in an accounting application

2009-06-04 Thread Karen Tracey
On Thu, Jun 4, 2009 at 9:39 AM, Luc Saffre wrote: > Hello, > > here is a code example that illustrates how I plan to implement journals > in an accounting application. The attached file models.py contains the > details. I saved it (together with an empty __init__.py) in a new > directory "journal

Re: Feedparser problem

2009-06-04 Thread Jonathan Nelson
Thanks, I'll give it a shot. J On Jun 4, 8:06 am, Alex Gaynor wrote: > On Thu, Jun 4, 2009 at 7:37 AM, Jonathan Nelson wrote: > > > > > > > > > I'm trying to add a feedreader element to my django project.  I'm > > using Mark Pilgrim's great feedparser library.  I've used it before > > without a

Book: Python Web Development with Django

2009-06-04 Thread phoebebright
Just finished reading this book and found it really helpful as a newbie to both Python and Django. The things I really liked about this book: - assumes I know very little - intro to python programming just the right level of detail for me - tutorials include plenty of real code examples - gotchas

Re: decoupling urlconfs

2009-06-04 Thread Vladimir Ionescu
In your main urls.py you only have one regex matchin anything starting with polls, so "/" does not match anything. If you type http://127.0.0.1:8000/polls/ you should see your index. On Jun 4, 6:45 pm, Ross wrote: > I've been working my way through the Django tutorial and everything > has gone

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

2009-06-04 Thread Alex Gaynor
On Thu, Jun 4, 2009 at 10:55 AM, Daniel Roseman < roseman.dan...@googlemail.com> wrote: > > On Jun 4, 3:19 pm, adelaide_mike wrote: > > My latest problem can be illustrated thus: > > > > In the first form we select the main course - spam or eggs. In the > > next form we select the dessert - ice

Re: decoupling urlconfs

2009-06-04 Thread Daniel Roseman
On Jun 4, 4:45 pm, Ross wrote: > I've been working my way through the Django tutorial and everything > has gone fine until I came across the part near the end of section 3 > about decoupling the urlconfs. I did as follows: I copied urls.py into > my polls directory (C:\mysite\polls\urls.py). It n

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

2009-06-04 Thread Daniel Roseman
On Jun 4, 3:19 pm, adelaide_mike wrote: > My latest problem can be illustrated thus: > > In the first form we select the main course - spam or eggs.  In the > next form we select the dessert - ice cream or mud cake, and in the > third form we select the after-dimmer drink - tea or coffee. > > How

decoupling urlconfs

2009-06-04 Thread Ross
I've been working my way through the Django tutorial and everything has gone fine until I came across the part near the end of section 3 about decoupling the urlconfs. I did as follows: I copied urls.py into my polls directory (C:\mysite\polls\urls.py). It now looks like this: from django.conf.ur

Re: ORACLE_HOME in wsgi script

2009-06-04 Thread Pablo Suárez Hernández
In my case I have the next line on my wsgi script. os.environ['ORACLE_HOME'] = '/usr/lib/oracle/xe/app/oracle/product/10.2.0/server' You must be sure you have installed the oracle-instantclient-devel package (which has the libclntsh.so and others files required). I hope this helps you. Regard

Using generic create_update views with non-editable fields in a model

2009-06-04 Thread Vladimir Ionescu
Hi all, I am new to Django, Python and web development in general. I've been playing with Django for a couple of days and I like it. I am writing an application that will allow multiple users to create, update and delete objects. At this point I would like to limit users' access to their own obje

Desperate Help needed. manage.py runserver no longer works.

2009-06-04 Thread CrabbyPete
I am new to django and I am running it on a Windows server. I installed mod_wsgi with Apache and go it to work, but now when I run python manage.py runserver. I get the error Error: Could not import settings 'spot.settings' (Is it on sys.path? Does it have syntax errors?): No module named setting

Re: Error when Rendering form with ModelChoiceField

2009-06-04 Thread Alex Gaynor
On Thu, Jun 4, 2009 at 9:38 AM, justind wrote: > > Thanks Alex. That works great. > > Just wondering: It seems like this causes the form to be bound, which > causes it to render all its errors. > I can set .is_bound to False manually to get around this, is this what > I should be doing? > > On Ju

Re: Feedparser problem

2009-06-04 Thread Alex Gaynor
On Thu, Jun 4, 2009 at 7:37 AM, Jonathan Nelson wrote: > > I'm trying to add a feedreader element to my django project. I'm > using Mark Pilgrim's great feedparser library. I've used it before > without any problems. I'm getting a TypeError I can't figure out. > I've tried searching google, bin

Re: Django deployment

2009-06-04 Thread AmanKow
On Jun 3, 4:16 am, vishy wrote: > Hi, > > I am developing an application on windows. I decided to upload it on > webfaction n see how deployment goes. The issues I faced was with > paths given - > for templates - I had given absolute path of directory on windows, > for database(using sqlite) -

Re: Ajax with JSON-RPC -- new Django handler

2009-06-04 Thread BenW
Ahh yes, I had not considered calling them from Python since in my use case they are treated more like an extension into the browser than anything else. I will definitely refactor the class to use @publicmethod so as to make the instance containing RPC methods more general-purpose. Thanks for th

Re: Error when Rendering form with ModelChoiceField

2009-06-04 Thread justind
Thanks Alex. That works great. Just wondering: It seems like this causes the form to be bound, which causes it to render all its errors. I can set .is_bound to False manually to get around this, is this what I should be doing? On Jun 3, 5:15 pm, Alex Gaynor wrote: > On Wed, Jun 3, 2009 at 5:12

Disabling reverse relation

2009-06-04 Thread Mattias Brändström
Hello! I'm trying to figure out if it is possible to disable the creation of a reverse relation field when defining relations between models. Something like this example: class Route(models.Model): start = models.ForeignKey (Location, related_name='starting_points') finish = models.Forei

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

2009-06-04 Thread adelaide_mike
My latest problem can be illustrated thus: In the first form we select the main course - spam or eggs. In the next form we select the dessert - ice cream or mud cake, and in the third form we select the after-dimmer drink - tea or coffee. How is the proper way to remember the choice made in for

ORACLE_HOME in wsgi script

2009-06-04 Thread SlafS
Hi! I'm trying to run Django app with mod_wsgi and Oracle, but when I try to configure it I always get an internal server error (500) with this error.log: ImproperlyConfigured: Error loading cx_Oracle module: libclntsh.so. 11.1: cannot open shared object file: No such file or directory It seems

Journals and Documents in an accounting application

2009-06-04 Thread Luc Saffre
Hello, here is a code example that illustrates how I plan to implement journals in an accounting application. The attached file models.py contains the details. I saved it (together with an empty __init__.py) in a new directory "journals" under django/tests/modeltests of my SVN working copy (which

Re: Using alternating url patterns

2009-06-04 Thread Tom Evans
On Thu, 2009-06-04 at 05:01 -0700, janedenone wrote: > > On 3 Jun., 12:26, Tom Evans wrote: > > On Wed, 2009-06-03 at 02:56 -0700, janedenone wrote: > > > Hi, > > > > > is it possible to use alternating url patterns without confusing the > > > reverse lookup mechanism? > > > > > I'd like to do s

Re: Newb problem with form wizard

2009-06-04 Thread Jonathan Nelson
I haven't used the form wizard, but it seems like your forms are in ...templates/wha/ Django is looking for your form at ...templates/wha/forms/wizard.html you have them in ...templates/wha/contact/forms/wizard.html try adding ...templates/wha/contact/forms or ...templates/what/contact to your

Feedparser problem

2009-06-04 Thread Jonathan Nelson
I'm trying to add a feedreader element to my django project. I'm using Mark Pilgrim's great feedparser library. I've used it before without any problems. I'm getting a TypeError I can't figure out. I've tried searching google, bing, google groups to no avail. Here's the dpaste of what I'm tryi

Re: Using alternating url patterns

2009-06-04 Thread janedenone
On 3 Jun., 12:26, Tom Evans wrote: > On Wed, 2009-06-03 at 02:56 -0700, janedenone wrote: > > Hi, > > > is it possible to use alternating url patterns without confusing the > > reverse lookup mechanism? > > > I'd like to do something like > > > (r'^(authors|autoren)/(?P[_a-z]+)$', 'author_detail

Re: Modifying the way a ChoiceField is rendered

2009-06-04 Thread LaundroMat
On Jun 4, 11:15 am, Tom Evans wrote: > On Wed, 2009-06-03 at 14:28 -0700, LaundroMat wrote: > > Hi - > > > I'm trying to change the way a ChoiceField (with widget = > > forms.RadioSelect) is being rendered in a template. Currently, > > rendering the form as_p() for instance, will return HTML such

Re: How to SEO adapt a I18N django web site..

2009-06-04 Thread phred78
I forgot something. I noticed that you have two description meta tags in your code: There should be only one, of course. The Google bot doesn't like duplicate descriptions. It might think you're cheating. Fred --~--~-~--~~~---~--~~ You received this message bec

Re: How to SEO adapt a I18N django web site..

2009-06-04 Thread phred78
Jens, I have been using django-localeurl and it solves most of your problems. The site I'm currently working on is indexed in all 5 languages, with no real effort on my part. It prefixes your content with the correct ISO. Check it here: http://code.google.com/p/django-localeurl/ You can also che

Re: Slightly OT: Why use dpaste?

2009-06-04 Thread googletorp
dpaste is a good tool if you have a long code sample or traceback that are giving you some problems. Usually when responding to the thread with a solution, the poster with copy the relevant snippet making the dpaste obsolete for further references. This might not always be the case, but for most

Oracle unicode sorting

2009-06-04 Thread SlafS
Hi there! I've got a Django app working on the Oracle backend. I have a table/ model with a char field and I store there strings (names) that contain polish letters. On the admin panel when I sort those names, ones that are starting with polish letters are after those that are starting with lette

Re: forms with ajax - how to use ModelForm?

2009-06-04 Thread googletorp
First of, when you use modelforms, you can instead do: if form.is_valid(): form.save() It doesn't make any difference to Django if you post the data via AJAX or regular form submit, the only thing you want to make different is probably the return value (redirect or json). This can be done usi

Re: Modifying the way a ChoiceField is rendered

2009-06-04 Thread Tom Evans
On Wed, 2009-06-03 at 14:28 -0700, LaundroMat wrote: > Hi - > > I'm trying to change the way a ChoiceField (with widget = > forms.RadioSelect) is being rendered in a template. Currently, > rendering the form as_p() for instance, will return HTML such as: > > value="1" name="type" />choice 1 > .

Re: Ajax with JSON-RPC -- new Django handler

2009-06-04 Thread Artem Egorkine
On Wed, Jun 3, 2009 at 9:18 PM, BenW wrote: > > Sorry about the example having bad syntax (doh!) -- I will get that > fixed. I chose the public__ prefix because it makes it easier to > introspect the supplied instance to find the methods intended to be > public without forcing users of the class

Display dashes in the admin site combobox

2009-06-04 Thread james
Hello, I have this product model class Product(models.Model): VAT_CODES = ( (6.00, '6%'), (12.00, '12%'), (21.00, '21%'), ) description = models.CharField(max_length=50,) unit_price = models.DecimalField(max_digits=10,decimal_places=2) vat_code = model

How to SEO adapt a I18N django web site..

2009-06-04 Thread jenlu
Hi, this topic is somewhere between django - implementation - SEO stuff... I am currently running http://work724.com - a business system based on Django. The intro/signup site is in both English and Swedish (in process of adding more languages) and using django language cookie for getting this