Re: residual fields admin error

2009-04-14 Thread zayatzz
i think the change has not hit the database. if your database is still empty then try doing python manage.py reset appname - that clears whole app database though. Alan On Apr 15, 6:24 am, CrabbyPete wrote: > I am just starting coding with django. So please bear with me.

Re: Models.py - retrieve information from other models via ForeignKey field?

2009-04-14 Thread zayatzz
well, im also a beginner but i think this should help you : http://docs.djangoproject.com/en/dev/ref/models/querysets/ Scroll down abit. there is example about books and authors which have quite similar relations to your models. In any case your information should e possible to get with one

Different approach?

2009-04-14 Thread Mariano Sokal
Well, i'm also new :) I've been using django for a couple of days trying to learn while developing a Pizza Delivery Software... (yes, I got bored doing blogs) and since it is not a traditional website where one has an admin area and a regular-user-live-site area, I feel that almost every

residual fields admin error

2009-04-14 Thread CrabbyPete
I am just starting coding with django. So please bear with me. I made a change to my User model so the field email_addr is now email. I deleted the database, made new tables with manage.py, did a resync, and changed all the code that refered to email_addr to email. Everything looks fine, but I

Re: NetBeans IDE for Python

2009-04-14 Thread Frank Liu
Why don't people use komodo edit. It's free and import works(mostly). It's got project browser, snippets, and commands, and works in mac/ linux/windows. There's even a django syntax highlighter plugin and an sqlite db browser plugin. Oh, you can also write macros for it in python or javascript

Re: Target WSGI script cannot be loaded as Python module

2009-04-14 Thread Thierry
Hello world with import socket gave me the same issue. I just re- installed Python 2.6, more specifically 2.6.2 and everything is working fine, thanks for your help. On Apr 14, 10:25 pm, Graham Dumpleton wrote: > On Apr 15, 12:07 pm, Thierry

Re: NetBeans IDE for Python

2009-04-14 Thread Victor Hooi
heya, I'm still a bit confused as to how to setup Django to work with Netbeans. I'm using Netbeans 6.7 M3 from here: http://bits.netbeans.org/download/6.7/m3/ I've created a new Django project using django-admin, e.g.: django-admin.py startproject testproject and then I'm creating a new

Models.py - retrieve information from other models via ForeignKey field?

2009-04-14 Thread Emma F
I feel like there must be something very elementary that I'm missing here, but I've been all through the documentation and can't figure it out. Say an app includes three models: - "Products" (includes fields: Product Name, Supplier, Cost Price, Retail Price - "Customers" (includes fields:

Re: Two projects, one admin, filebrowser

2009-04-14 Thread Micah Ransdell
If you are just wanting to serve out the files on the public site then you can just copy them over from the media/uploads folder on the intranet site, to the media/uploads folder on the public site. You can setup an cron job or simple post_save signal on the private side that automatically copies

Re: Target WSGI script cannot be loaded as Python module

2009-04-14 Thread Graham Dumpleton
On Apr 15, 12:07 pm, Thierry wrote: > I'm currently running Apache 2.2 on Windows and I can get the hello > world of modwsgi to run.  However, when I configure my Django project, > Apache has the following errors from the error.log file: > > mod_wsgi (pid=5956): Target

Target WSGI script cannot be loaded as Python module

2009-04-14 Thread Thierry
I'm currently running Apache 2.2 on Windows and I can get the hello world of modwsgi to run. However, when I configure my Django project, Apache has the following errors from the error.log file: mod_wsgi (pid=5956): Target WSGI script 'C:/django_proj/mysite/apache/ mysite.wsgi' cannot be loaded

Re: Sending large, generated files

2009-04-14 Thread Graham Dumpleton
On Apr 15, 7:49 am, Alex Loddengaard wrote: > I've found several messages on this list discussing ways to send large files > in a HttpResponse.  One can use FileWrapper, or one can use a generator and > yield chunks of the large file.  What about the case when the large file

Re: Random Syntax Errors on Download

2009-04-14 Thread James Bennett
On Tue, Apr 14, 2009 at 11:59 AM, AliasXNeo wrote: > The problem is intriguing, and I attempted to download and install the > official release 3 more times and then proceeded to get the latest > develepor release from SVN only to get the same exact problem. I'm > running

Re: How do you retrieve a username that is not in the URL?

2009-04-14 Thread James Bennett
On Tue, Apr 14, 2009 at 5:12 PM, stkpoi wrote: >    if form.is_valid(): >      submission = Submission.objects.get_or_create( >      title=form['title'], >      link=form['link'], >      user=request.user.username >      ) And right there's your problem. The value to put

Re: Converting from local DST to UTC

2009-04-14 Thread Brian Neal
On Apr 14, 7:26 pm, Jamie wrote: > I am working on an app that will export a calendar event to Google > Calendar. Google Calendar requires that event datetimes be in UTC > format. I can make the conversion from local (America/New_York) to UTC > using pytz, but the time is off

Error: no module named manager

2009-04-14 Thread Daniel Sisco
All: I'm adding an app (from django snippits) that is just a template tag for a calendar application in my blog. This is the new directory structure: /apps/postcal | --> __init__.py | --> /templatetags

Re: Sending large, generated files

2009-04-14 Thread Ryan Kelly
> Looking at the code for the wsgi handler, it does call start_response() > before processing any of the response body - my understanding is that > this should cause the headers to be sent immediately. Humph, looks like my understanding isn't so hot - PEP 333 explicitly forbids start_response

Re: Sending large, generated files

2009-04-14 Thread Ryan Kelly
> I've found several messages on this list discussing ways to send large > files in a HttpResponse. One can use FileWrapper, or one can use a > generator and yield chunks of the large file. What about the case > when the large file is generated at HTTP request time? In this case, > it would be

Two projects, one admin, filebrowser

2009-04-14 Thread shacker
We're building an intranet and a public site that share a lot of data but without shared views. Therefore we're building them as two distinct Django projects connecting to a single shared database, with shared apps. To reduce confusion, the contrib.admin is only enabled on the intranet side, not

Converting from local DST to UTC

2009-04-14 Thread Jamie
I am working on an app that will export a calendar event to Google Calendar. Google Calendar requires that event datetimes be in UTC format. I can make the conversion from local (America/New_York) to UTC using pytz, but the time is off by an hour due to daylight savings time (Python thinks the

Re: How do you retrieve a username that is not in the URL?

2009-04-14 Thread stkpoi
#urls.py urlpatterns = patterns('', (r'^$', main_page), # ... (r'^submit/$', submit_page), (r'^submit/success/$', direct_to_template, { 'template': 'submit/submit_success.html' }), ) The error occurs at the "user=request.user.username" line in views.py.

Re: Trying to wrap my head around nested regroups or other ways to handle ordered ForeignKey stuff

2009-04-14 Thread Daniel Roseman
On Apr 14, 6:11 pm, Kevin Cole wrote: > Hi, > > First let me say I've looked at documentation, but feel a bit dyslexic > when it comes to this stuff. > > The situation: I have three tables: a service provider table with > city, state abbreviation and country abbreviation

Re: Grasping apps / projects and shared data

2009-04-14 Thread Daniel Roseman
On Apr 14, 9:47 pm, Leon wrote: > Hello! > > I'm new to django so far I like it, but I've now reached my first big > hurdle. > > I'm building a page which has a cms in the root, which shows the main > menu, and submenu of the site, > but then I have a blog app and a gallery app

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 6:00 PM, gordyt wrote: > > I think I've tracked down the problem. Here is a bit of code from > django.db.models.fields.related.py: > >def get_db_prep_lookup(self, lookup_type, value): ># If we are doing a lookup on a Related Field, we must

Re: textarea in ModelForm

2009-04-14 Thread Daniel Roseman
On Apr 14, 8:51 pm, grimmus wrote: > Thanks for the reply Alex, > > I am not really sure how i am supposed to override the default field > type. > > The link talks about MyDateFormField() but is this a method or what ? > > Could you provide an example of how i could put

How do you retrieve a username that is not in the URL?

2009-04-14 Thread stkpoi
I would like the url to not include the user's name. For example, it would be "/submit" and not "/submit/joe_user". request.user.username is not working for me. # Model class Submission(models.Model): title = models.CharField(max_length=200) link = models.URLField() user =

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread gordyt
Here is a dpaste link to that same bit of code that looks nicer: http://dpaste.com/hold/33474/ --gordy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Sending large, generated files

2009-04-14 Thread Alex Loddengaard
I've found several messages on this list discussing ways to send large files in a HttpResponse. One can use FileWrapper, or one can use a generator and yield chunks of the large file. What about the case when the large file is generated at HTTP request time? In this case, it would be annoying

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread gordyt
I think I've tracked down the problem. Here is a bit of code from django.db.models.fields.related.py: def get_db_prep_lookup(self, lookup_type, value): # If we are doing a lookup on a Related Field, we must be # comparing object instances. The value should be the PK of

Re: django-grappelli setup problem

2009-04-14 Thread Karen Tracey
On Tue, Apr 14, 2009 at 2:36 PM, Lars Stavholm wrote: > > Hi All, > > I'm trying to get django-grappelli running, but after following > the installation instructions, I end up with a 404 and the following: > > Using the URLconf defined in bfact.urls, Django tried these URL >

Re: TreePanel in Django

2009-04-14 Thread Peter Herndon
I've done something similar using jquery and the dynatree plugin, though the directory "structure" doesn't actually exist on the file system of the server. I'm building my tree from relationships stored in the db. Works for me so far, though I've yet to test with large quantities of objects.

Grasping apps / projects and shared data

2009-04-14 Thread Leon
Hello! I'm new to django so far I like it, but I've now reached my first big hurdle. I'm building a page which has a cms in the root, which shows the main menu, and submenu of the site, but then I have a blog app and a gallery app which are coupled to a special section of the site, I still want

Re: Temperature degree ascii code error on cvs output file

2009-04-14 Thread Jesse
Thanks I'll give the suggestions a try. On Apr 14, 9:55 am, Karen Tracey wrote: > On Tue, Apr 14, 2009 at 12:35 PM, Alex Gaynor wrote: > > On Tue, Apr 14, 2009 at 12:25 PM, Jesse wrote: > > >> The error is 'ascii' codec can't

Re: Creating an object with a FileField programmatically

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 4:04 PM, Vincent Foley wrote: > > Hello, > > I want to be able to add files inside a model to test that model. > However, I'm unable to find in the documentation any mention on how to > do so. I asked on IRC and somebody suggested the following: > >

Creating an object with a FileField programmatically

2009-04-14 Thread Vincent Foley
Hello, I want to be able to add files inside a model to test that model. However, I'm unable to find in the documentation any mention on how to do so. I asked on IRC and somebody suggested the following: from django.core.files import File from myproject.myapp.models import MyModel fd =

Re: textarea in ModelForm

2009-04-14 Thread grimmus
Thanks for the reply Alex, I am not really sure how i am supposed to override the default field type. The link talks about MyDateFormField() but is this a method or what ? Could you provide an example of how i could put the form field on the form instead of the model ? Thanks alot. On Apr 6,

Re: Generic relations swamp

2009-04-14 Thread zayatzz
Ok your idea worked just fine, but i keep coming up with new questions :) The result of it was that when i opened poll i got poll with name So i wrote something (i dont know how its called - model instance? model manager?) to retrieve the actual value of translation and my poll model looks

Re: Trying to wrap my head around nested regroups or other ways to handle ordered ForeignKey stuff

2009-04-14 Thread Kevin Cole
And... Never mind. Not sure how I missed it before, but it appears select_related() gets me what I want. I think... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

django-grappelli setup problem

2009-04-14 Thread Lars Stavholm
Hi All, I'm trying to get django-grappelli running, but after following the installation instructions, I end up with a 404 and the following: Using the URLconf defined in bfact.urls, Django tried these URL patterns, in this order: 1. ^admin/(.*) 2. ^grappelli/ ^bookmark/add/$ 3.

Re: Statistic gathering

2009-04-14 Thread Tim Chase
Alex Gaynor wrote: > On Tue, Apr 14, 2009 at 1:21 PM, ab3...@gmail.com wrote: > >> I'm new to Django. I'm trying to figure out if there is a well >> established design paradigm to collect statistics on hyperlink usage. >> >> When a visitor follows a link to an external

Re: Statistic gathering

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 1:21 PM, ab3...@gmail.com wrote: > > I'm new to Django. I'm trying to figure out if there is a well > established design paradigm to collect statistics on hyperlink usage. > > When a visitor follows a link to an external website, I > would like to

Statistic gathering

2009-04-14 Thread ab3...@gmail.com
I'm new to Django. I'm trying to figure out if there is a well established design paradigm to collect statistics on hyperlink usage. When a visitor follows a link to an external website, I would like to insert the following information into a mysql database table: - the datetime of the click

Trying to wrap my head around nested regroups or other ways to handle ordered ForeignKey stuff

2009-04-14 Thread Kevin Cole
Hi, First let me say I've looked at documentation, but feel a bit dyslexic when it comes to this stuff. The situation: I have three tables: a service provider table with city, state abbreviation and country abbreviation (among other other info), a states table with state names, abbreviations,

Re: Random Syntax Errors on Download

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 12:59 PM, AliasXNeo wrote: > > I recently downloaded the latest Official release of Django for > installation on my Windows XP OS. After copying the appropriate files > over to the site-packages folder in the python installation, I > attempted to

Random Syntax Errors on Download

2009-04-14 Thread AliasXNeo
I recently downloaded the latest Official release of Django for installation on my Windows XP OS. After copying the appropriate files over to the site-packages folder in the python installation, I attempted to create a test project to insure correct installation by invoking the command:

Re: Temperature degree ascii code error on cvs output file

2009-04-14 Thread Karen Tracey
On Tue, Apr 14, 2009 at 12:35 PM, Alex Gaynor wrote: > On Tue, Apr 14, 2009 at 12:25 PM, Jesse wrote: > >> >> The error is 'ascii' codec can't encode character u'\xb0' in position >> 98: ordinal not in range(128) and it occurs when a temperature degree

Re: Temperature degree ascii code error on cvs output file

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 12:25 PM, Jesse wrote: > > The error is 'ascii' codec can't encode character u'\xb0' in position > 98: ordinal not in range(128) and it occurs when a temperature degree > such as 35°C > is in the text. > > I'm using the following code in the view.py: >

Temperature degree ascii code error on cvs output file

2009-04-14 Thread Jesse
The error is 'ascii' codec can't encode character u'\xb0' in position 98: ordinal not in range(128) and it occurs when a temperature degree such as 35°C is in the text. I'm using the following code in the view.py: response = HttpResponse(mimetype='text/csv')

Re: Adding model instance attributes

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 11:33 AM, Mitch Chapman wrote: > > Is it bad form in Django to add "transient" instance variables to > model instances? > > I'm rendering a set of search results. Each result record is a User > instance. I want to show whether or not each record

Adding model instance attributes

2009-04-14 Thread Mitch Chapman
Is it bad form in Django to add "transient" instance variables to model instances? I'm rendering a set of search results. Each result record is a User instance. I want to show whether or not each record is a friend of the user who is conducting the search. Right now my view is annotating each

Re: get_absolute_url method append extra text

2009-04-14 Thread nixon66
Alex, Thanks Ron On Apr 14, 11:22 am, Alex Gaynor wrote: > On Tue, Apr 14, 2009 at 11:19 AM, nixon66 wrote: > > > Alex, > > > Ok, I'm going to ram my head into a wall now. Seriously thanks. > > > On Apr 14, 11:03 am, Alex Gaynor

Re: get_absolute_url method append extra text

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 11:19 AM, nixon66 wrote: > > Alex, > > Ok, I'm going to ram my head into a wall now. Seriously thanks. > > On Apr 14, 11:03 am, Alex Gaynor wrote: > > On Tue, Apr 14, 2009 at 11:01 AM, nixon66 wrote: > > >

Re: get_absolute_url method append extra text

2009-04-14 Thread nixon66
Alex, Ok, I'm going to ram my head into a wall now. Seriously thanks. On Apr 14, 11:03 am, Alex Gaynor wrote: > On Tue, Apr 14, 2009 at 11:01 AM, nixon66 wrote: > > > I have this model with an get_absolute_url method. > > > class

Re: get_absolute_url method append extra text

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 11:01 AM, nixon66 wrote: > > > I have this model with an get_absolute_url method. > > > > class Country(models.Model): >country_cd = models.CharField(max_length=2, primary_key=True) >country = models.CharField(max_length=80, blank=True) >

get_absolute_url method append extra text

2009-04-14 Thread nixon66
I have this model with an get_absolute_url method. class Country(models.Model): country_cd = models.CharField(max_length=2, primary_key=True) country = models.CharField(max_length=80, blank=True) slug = models.CharField(max_length=80, blank=True) class Meta: db_table =

Re: list to queryset

2009-04-14 Thread snorkel
Thanks a lot, This works fine and is much nicer I have been floundering around for what seems like weeks trying to figure out how you're supposed to this snorkel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: single queryset from multiple tables

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 10:50 AM, veearrsix wrote: > > Thanks for the help so far guys, I've used that recipe suggested by > Malcolm, where by I pass a number of querysets into the method. It > works as expected I guess, BUT, I would like to be able to sort by the >

Re: single queryset from multiple tables

2009-04-14 Thread veearrsix
Thanks for the help so far guys, I've used that recipe suggested by Malcolm, where by I pass a number of querysets into the method. It works as expected I guess, BUT, I would like to be able to sort by the datetime field from each queryset, however the fieldnames for each of the date time fields

Re: list to queryset

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 9:03 AM, snorkel wrote: > > I am new to Django and this is driving me crazy... excuse my > inexperience > anyway > > I have 3 classes > class Job(): > . some stuff . > > class Sequence() >... more stuff ... >

list to queryset

2009-04-14 Thread snorkel
I am new to Django and this is driving me crazy... excuse my inexperience anyway I have 3 classes class Job(): . some stuff . class Sequence() ... more stuff ... job=models.ForeignKey('Job') element_type=models.ManyToMany('ElementType') class ElementType() ... some

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread gordyt
Howdy Daniel! > I suspect you have not set the subclass's metaclass to > models.SubfieldBase - see > here:http://docs.djangoproject.com/en/dev/howto/custom-model-fields/#the-s... > > You need to do this to get any of the overridden methods to be called. Thanks for the update, but that isn't

Re: i18n translations

2009-04-14 Thread zayatzz
Thanks! On Apr 14, 3:52 pm, matehat wrote: > Hi Alan, > > > Is this really meant to work so that you create translations in a file > > manually and then create objects with names/descriptions that have > > translation in the file or is there a more automatic way to do

Re: Generic relations swamp

2009-04-14 Thread zayatzz
On Apr 14, 3:45 pm, matehat wrote: > Sorry about the last post (was a little tired from a sleepless night > of solving problems in physics ...). I think you can solve the issue > by putting "return unicode(self.name)" instead of "return self.name" > in all of the

Re: i18n translations

2009-04-14 Thread matehat
Hi Alan, > Is this really meant to work so that you create translations in a file > manually and then create objects with names/descriptions that have > translation in the file or is there a more automatic way to do this? currently, Django's i18n system is made to translate static strings in a

Re: i18n translations

2009-04-14 Thread matehat
Hi Alan, > Is this really meant to work so that you create translations in a file > manually and then create objects with names/descriptions that have > translation in the file or is there a more automatic way to do this? currently, Django's i18n system is made to translate static strings in a

Re: Generic relations swamp

2009-04-14 Thread matehat
Sorry about the last post (was a little tired from a sleepless night of solving problems in physics ...). I think you can solve the issue by putting "return unicode(self.name)" instead of "return self.name" in all of the __unicode__ method of your models. The things is that you must make sure to

Python object maker for database result sets

2009-04-14 Thread Sebastian
Hello Django-Users, The software development team at the Campbell-Lange Workshop (CLW) has been using Django since 0.95. From the beginning we have been very impressed with the URL dispatcher, form validation and templating language. We have, however, found that the Django ORM occasionally

Re: custom comment app migration

2009-04-14 Thread Eric
This has gone well so far -- I ended up pointing my new comment app models at the old database tables using the db_table meta option, and then manually altering the table definitions, that kept things a lot simpler. I'm getting an AlreadyRegistered exception for a custom CommentsAdmin definition

Re: Process multiple html forms in the same view

2009-04-14 Thread Bastien
Thank you Karen, that's exactly what I need "To give each Form its own namespace". On Apr 13, 10:57 pm, Karen Tracey wrote: > On Mon, Apr 13, 2009 at 2:11 PM, Bastien wrote: > > ... So my question is how could the > > view know which POST data

Re: django and i18n what's wrong???

2009-04-14 Thread drakkan
Ok remain two minor issue: 1) http://code.djangoproject.com/ticket/5494 2) ugettext_lazy are not json serializable so when I use transaltion to populate ajax widgets I have to explicitily convert to unicode, but this is really a minor issue any eta for 1)? will be in django 1.1, still the same

i18n translations

2009-04-14 Thread zayatzz
Hello I had in mind a system with translations and i was creating my own translation system, which ran into a problem i dont know how to fix (http://groups.google.com/group/django-users/browse_thread/thread/ b5d138693a864618/6e6edf7d6227cb50?lnk=gst=swamp#6e6edf7d6227cb50). Then i found these

Re: Does fixtures loading invoke custom save method?

2009-04-14 Thread Will Hardy
Yes it is correct: fixtures only load data into the database. If you want the .save() method to be called, you could use the the dumpscript management command I wrote in django_extensions: http://github.com/django-extensions/django-extensions/tree/master Cheers, Will