Re: 'module' object has no attribute 'day_abbr' --Problem editing using Admin

2008-04-02 Thread Ryan Vanasse
After looking at the exception some more, I was thinking it would be that. Well, I'll have to rename the app...since I'm pretty early in the dev process I should be alright. Thanks kenneth, Erik, and Karen, for your help. And especially thanks for the import test statement. It's one of those

Does lighttpd supports "forward" proxy?

2008-04-02 Thread Thiyaga
Hi, I'm using lighttpd version 1.4.19. It supports reverse proxy using proxy.server configuration with mod_proxy module. Example proxy.server = ( ".jsp" => ( ( "host" => "10.0.0.242", "port" => 81

Re: inspectdb and foreign keys

2008-04-02 Thread Karen Tracey
On Thu, Apr 3, 2008 at 12:05 AM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > In your database ( not in the model ) rename the field 'category in > table MdlCourse to category_id and it should fix the problem... > normally a ForeignKey field name in the database is ClassName_id > Or, if you

Re: inspectdb and foreign keys

2008-04-02 Thread [EMAIL PROTECTED]
In your database ( not in the model ) rename the field 'category in table MdlCourse to category_id and it should fix the problem... normally a ForeignKey field name in the database is ClassName_id On Apr 2, 6:12 pm, mthorley <[EMAIL PROTECTED]> wrote: > Greetings, I used inspectdb to create my

Re: relative link problem with admin login

2008-04-02 Thread MrJogo
I tried doing what you suggested, but now it gives me the error 'RegexURLResolver' object has no attribute 'rindex' when I try to go to the admin page (or any page that exists, for that matter. Pages that don't exist get an unhandled exception). Also, I'm not sure if your solution will fix my

Re: tags separated by comma

2008-04-02 Thread ameriblog
thanks. it looks like it requires the latest django trunk build, is that right? i'm still using 0.96. On Apr 2, 7:00 pm, Simon Oberhammer <[EMAIL PROTECTED]> wrote: > there is already an easy to intergrate  django-tagging > app,http://code.google.com/p/django-tagging/ > > I have used and,

Re: Best practice for databases and distributed development with Django

2008-04-02 Thread Ronny Haryanto
On Thu, Apr 3, 2008 at 7:36 AM, Julien <[EMAIL PROTECTED]> wrote: > We're using SVN between several developers to work on the same project > and it's working quite well. But it's not as simple concerning the > database. > > Each of us has a local database to muck around with, and if one of us

Re: Best practice for databases and distributed development with Django

2008-04-02 Thread Brian Luft
Simon's method is a good way to go. In general its a good idea to use some sort of scheme for managing all of the changes that occur to the base schema in revision control. This way you can pull down a tagged copy of your source tree, run the CREATE DATABASE script, and run the alter script(s)

Re: Best practice for databases and distributed development with Django

2008-04-02 Thread Simon Oberhammer
> that developer has to inform all others of the changes so they all > make the change manually on their own local database. you could have a mysql-changes.sql file in your app directories. it holds the ALTER, DROP, etc. statements. put it under SVN. when you get a new rev with the comment "db

Re: datetime 8 hours off

2008-04-02 Thread Simon Oberhammer
thanks, i will try fastcgi tomorrow and report back. > Is the time constantly 8 hours behind or does that vary e.g. does the > offset get larger over time? it's always 8 hours behind, but not reproducable. though it happens everyday. there are php sites running on the server.. well let's see

Who tests the testers...

2008-04-02 Thread Tim Chase
Following Russ Magee's suggestion[1] regarding custom test-runners, I'm trying to figure out how to test my test-runner. I dug around in the Django source, but I didn't see anything in the tests/ directory that exercised the existing test-runner to ensure that it doesn't fail spectacularly.

Best practice for databases and distributed development with Django

2008-04-02 Thread Julien
Hi, We're using SVN between several developers to work on the same project and it's working quite well. But it's not as simple concerning the database. Each of us has a local database to muck around with, and if one of us makes a change in the models that implies modifying the database manually

mptt and drilldown template help needed

2008-04-02 Thread Nagy Károly
Is there anybody out there using mptt? 'full_tree_model' tags and filters are working correctly, but i was unable to use a 'drilldown_tree_for_node'. Does anybody have a working example or detailed instructions? tia, Charlie. -- "s minden mestert kinevettem, ki nem nevetett önmagán." GPG

tags separated by comma

2008-04-02 Thread ameriblog
i'm interested in my political app for allowing site visitors to submit news stories on candidates, etc. i'd like for them to be able to add tags to the story that are separated by a comma. just kind of curious the best way to do this, structure my model, etc?

Error adding an excluded field

2008-04-02 Thread jorgehugoma
here's my final working view function. I don't know if it was the best way to solve this problem but it was the best i could come up with. Any suggestions? And thanks for the assistance guys. def cartuchoFallado(request, numinfo): if request.method == 'POST': form =

inspectdb and foreign keys

2008-04-02 Thread mthorley
Greetings, I used inspectdb to create my models and then tried editing the generated models in order to define the ForeignKey relationships, and I'm getting an error. Here's what I have. Note: I commented out the original category field and tried adding my own ForeignKey class

Re: Generic relation issues, can't delete objects

2008-04-02 Thread Josh
Sorry, here's the full traceback: Environment: Request Method: GET Request URL: http://myproject.webfactional.com/admin/words/word/278/delete/ Django Version: 0.97-pre-SVN-7388 Python Version: 2.5.1 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes',

Re: running tests.py

2008-04-02 Thread Tony
Ah I see, "tests.py" rather than "test.py" Its an annoying detail that a newbie like me would miss. Thanks. On Apr 2, 10:35 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 4/3/08, Tony <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > It might just be me not seeing the obvious but I'm

Very strange TagField() behavior.

2008-04-02 Thread Josh
I've installed the development version of django-tagging, and have put a TagField() in my model that I want to be tagged so that I can edit the tags from the admin interface. However I am getting some very strange behavior. I can use the TagField() in the admin interface to add and remove tags

Re: middleware question

2008-04-02 Thread Russell Keith-Magee
On 4/3/08, Chris <[EMAIL PROTECTED]> wrote: > > Can anyone help me with this? It looks like I need to pass in a > django_content_type= to the request context > before it gets passed to the middleware for further processing. Any > thoughts? Yes. I think you need to wait more than 30 minutes

Re: running tests.py

2008-04-02 Thread Russell Keith-Magee
On 4/3/08, Tony <[EMAIL PROTECTED]> wrote: > > Hi, > > It might just be me not seeing the obvious but I'm sure in the django > documentation it says that if you type the command "python manage.py > test" it will "Looking for unit tests and doctests in the models.py > and tests.py files in

Re: Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread Szaijan
Thanks Alex. I'm not sure why this works for you, but not in my code. The only difference I see is the '**' you have preceding your use of the filter argument. What is the significance of that? The following: ln[1]: filter = {'id__exact':'100'} ln[2]: mgr = getattr(eval(mn), 'objects')

Re: relative link problem with admin login

2008-04-02 Thread Evert Rol
> I'm trying to set up my site on a university webspace, so the root is > a subdirectory, ie www.university.edu/~mysite/. Because of this, I'm > having trouble logging into the admin pages. I go to > www.university.edu/~mysite/admin/ > and get the login page, but when I try to login, it goes to

Re: middleware question

2008-04-02 Thread Chris
Can anyone help me with this? It looks like I need to pass in a django_content_type= to the request context before it gets passed to the middleware for further processing. Any thoughts? On Apr 2, 3:37 pm, Chris <[EMAIL PROTECTED]> wrote: > Is there a way to grab content_type and object_id in a

Error adding an excluded field

2008-04-02 Thread jorgehugoma
here's my model class: class CartuchoFallado(models.Model): serie = models.CharField(max_length = 15, primary_key = True) informe = models.ForeignKey(CambioDeProducto, verbose_name = 'Informe de Falla') cartucho = models.ForeignKey(Cartucho, verbose_name = 'Cartucho') marca =

Using CsrfMIddleware with ajax post requests

2008-04-02 Thread shabda
I have a some links, simple like .. . I handle clicks on them as ajax, and do a post . I want to protect this post against CSRF attacks, but CsrfMiddleware works only for form posts, because it add a form field. Is there some way I can get the CsrfMiddleware to work with ajax posts?

Re: Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread [EMAIL PROTECTED]
a) You don't need to use getattr when you know what attr you are trying to get, those getattr calls can be changed to mgr.filter b) filter works using kwargs, kwargs work like dictionaries so you can just create a dictionary and then in the method call do **dictionary_var to have it called with

Multiple multiple forms

2008-04-02 Thread bobhaugen
...or, multiple forms where each of the multiple parent forms has multiple child forms. What's happening here is that a group of farmers pool their goods and deliver them through a central point to a bunch of customers. Each customer order delivery item could be supplied by more than one

Re: Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread [EMAIL PROTECTED]
a) There is no reason to use getattr if you know what method/proprety you want, you can replace all thsoe getattr calls with: mgr.filter b) Filter operates using keyword arguments, so you can build a dictionary to use it, for example: In [2]: filter = {'title__icontains': 'test'} In [3]:

Re: Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread Szaijan
A follow on question. In a similar vein, I need to be able to call the object manager on models specified at run time. I figured out how to get this to work for cases where the arguments are empty, thanks to Malcolm's assstance: mgr = getattr(eval(modelName), 'objects'); objs = getattr(mgr,

middleware question

2008-04-02 Thread Chris
Is there a way to grab content_type and object_id in a middleware processor? Example if I went to my articles section: http://www.xyz.com/articles// could I some how get the content_type and the object_id from the request context that is passed in? I want to be able to perform a middleware task

Re: Advanced Form Questions

2008-04-02 Thread Chris Hartjes
On Wed, Apr 2, 2008 at 3:28 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > If your goal is to edit multiple items read this: > > http://collingrady.wordpress.com/2008/02/18/editing-multiple-objects-in-django-with-newforms/ > Alex, That's pretty much what I'm looking for. Thanks! --

relative link problem with admin login

2008-04-02 Thread MrJogo
I'm trying to set up my site on a university webspace, so the root is a subdirectory, ie www.university.edu/~mysite/. Because of this, I'm having trouble logging into the admin pages. I go to www.university.edu/~mysite/admin/ and get the login page, but when I try to login, it goes to

edit_inline and models with FileField(core=True)

2008-04-02 Thread Kip Parker
This model is edited inline with the ImageField being the only one with core=True. class Image(models.Model): image = models.ImageField(upload_to="images", core=True) caption = models.CharField(blank=True, max_length=250) artist = models.ForeignKey(Artist,

Re: How often do you update your django?

2008-04-02 Thread Jeff Anderson
SteveMc wrote: On this topic, our company's moving over to Python and Django. A lot of our developers are understandably wary of using trunk code, but there are a lot of features we'd like that aren't in 0.96. Does anyone have any advice on a trunk revision to stick with that's stable and

running tests.py

2008-04-02 Thread Tony
Hi, It might just be me not seeing the obvious but I'm sure in the django documentation it says that if you type the command "python manage.py test" it will "Looking for unit tests and doctests in the models.py and tests.py files in each installed application" and run those tests? Or am I

Re: is Django OK for parallelized computations?

2008-04-02 Thread Valery
Hi Karen sound reasonable. Look, but Malcolm actually means "there should be no problem with multiple processes, this is the way all web server stuff works". Contradiction? I guess, the contradiction is actually in the initialization of connection to DB that every app process does after being

Need help to solve intermittent error

2008-04-02 Thread latoga
Got a strange one to toss to the group... First, my config: latest django from svn running on Solaris with latest apache and python 2.4. My django server recently started showing the following page when accessing a valid URL: --- start error --- Mod_python error: "PythonHandler

Re: Database API reference:

2008-04-02 Thread Collin Grady
You forgot to use person in front of the values of course, since they're still attributes of that dict :) So instead of pnr which is just printing static text "pnr", you need to do {{ person.pnr }} just like every other variable access :) --~--~-~--~~~---~--~~ You

Re: Database API reference:

2008-04-02 Thread Daniel Roseman
On Apr 2, 7:08 pm, Jaap <[EMAIL PROTECTED]> wrote: > Still Greek to me... So far I did it like this: > > [view] > def start(request): > group = Staff.objects.values('pnr', 'last_name') > return render_to_response('tlist.html', group) > > [template] > > {% for person in group %} > >

Re: Generic relation issues, can't delete objects

2008-04-02 Thread Karen Tracey
On Wed, Apr 2, 2008 at 11:41 AM, Josh <[EMAIL PROTECTED]> wrote: > > I've created a sort of modified tagging system for the site I'm > working on. Because of the nature of the 'tags' I had to diverge a > little form the standard and my models look like this: > > class Word(models.Model): >

Re: Template Inheritance and Template Context Processors

2008-04-02 Thread ocgstyles
I saw this: http://www.djangoproject.com/documentation/templates/#custom-libraries-and-template-inheritance Which sounds like it'd be a reason why, but that's for filters. Is there a similar restriction on processors? On Apr 2, 2:03 pm, ocgstyles <[EMAIL PROTECTED]> wrote: > Hi all, > > I

Re: 'module' object has no attribute 'day_abbr' --Problem editing using Admin

2008-04-02 Thread Karen Tracey
On Wed, Apr 2, 2008 at 1:18 AM, Ryan Vanasse <[EMAIL PROTECTED]> wrote: > > Thanks for the reply. I checked the DB file and yes, you were correct > about the updating the table. > > I updated it using the manage.py sqlreset command. Currently it > contains an event date of type "date" (in the

Re: Database API reference:

2008-04-02 Thread Jaap
Still Greek to me... So far I did it like this: [view] def start(request): group = Staff.objects.values('pnr', 'last_name') return render_to_response('tlist.html', group) [template] {% for person in group %} pnr last_name {% endfor %} Where did I go wrong?

Template Inheritance and Template Context Processors

2008-04-02 Thread ocgstyles
Hi all, I added a context processor of my own. So that section of my settings.py looks like: TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n',

Re: newforms: emptying fields after failed validation

2008-04-02 Thread Karen Tracey
On Wed, Apr 2, 2008 at 9:44 AM, Gollum <[EMAIL PROTECTED]> wrote: > > Still, does anybody know how to actually change fields value after > failed validation. > I really only need to clear my password fields only when the passwords > do not validate, not on any invalid field. > I'm confused, does

Re: How often do you update your django?

2008-04-02 Thread [EMAIL PROTECTED]
Just take the current revision, it is as stable as any other revision(probably moreso), I would stick to that, and track the trunk and if a new feature comes out that you want, review the backwards incompatible changes page, and then SVN up. On Apr 2, 12:02 pm, SteveMc <[EMAIL PROTECTED]> wrote:

Re: Database API reference:

2008-04-02 Thread [EMAIL PROTECTED]
In [3]: Page.objects.values('id', 'title') Out[3]: [{'id': 1, 'title': u'This is a test page'}] In [4]: Page.objects.values('id', 'title').filter(id__gt=1) Out[4]: [] On Apr 2, 12:22 pm, Jaap <[EMAIL PROTECTED]> wrote: > QuerySet methods that return new QuerySets: > values(*fields) > > Could

Database API reference:

2008-04-02 Thread Jaap
QuerySet methods that return new QuerySets: values(*fields) Could anyone please give an example of this, using view and template? I have read the example using the interpreter, and cannot get it to work in view/template. FYI: I use version 0.96.1, Windows XP.

Re: How often do you update your django?

2008-04-02 Thread SteveMc
On this topic, our company's moving over to Python and Django. A lot of our developers are understandably wary of using trunk code, but there are a lot of features we'd like that aren't in 0.96. Does anyone have any advice on a trunk revision to stick with that's stable and includes most of the

Re: django-survey Extracted from PyCon

2008-04-02 Thread [EMAIL PROTECTED]
Sorry, I have been very burnt out after PyCon. We set up google group here: http://groups.google.com/group/django-survey/ I just updated the project home page with the information. The problem you are having with the checkbox, is due to not knowing how to add choices using the admin. The admin

Re: django-basic-blog question

2008-04-02 Thread Travis Ringger
That makes sense, and sure enough, that was the problem. Thanks for pointing it out. I had tagging in my PYTHONPATH, but didn't realize I needed it in INSTALLED_APPS as well. Thank you very much. -Travis On Wed, Apr 2, 2008 at 9:49 AM, Marty Alchin <[EMAIL PROTECTED]> wrote: > > On Wed, Apr 2,

Re: django-basic-blog question

2008-04-02 Thread Marty Alchin
On Wed, Apr 2, 2008 at 11:39 AM, Travis Ringger <[EMAIL PROTECTED]> wrote: > I have installed the django-tagging dependency and have run > syncdb a few times, but I have no tagging_tag table. Did you just download django-tagging and put it on your PYTHONPATH, or did you actually add it to your

admin help

2008-04-02 Thread Poz
Hello all, I've worked all last night on getting my first admin page up and running. I'm following along with the djangobook.com example and I just can't get the thing to work. I have my setting.py MIDDLEWARE, TEMPLATE_DIRS set as their default and i have the admin app in my INSTALLED_APPS and

Re: Track number of hits on object

2008-04-02 Thread Rajesh Dhawan
Hi Goran, > I know that the code will be executed in the View for the object but > should the .increase_hits() method be defined in the Model or in the > models manager? > > class Post(model.Model) > ... > hits = PositiveInteger(default=0) > > def increase_hits(self): > >

django-basic-blog question

2008-04-02 Thread Travis Ringger
Hello Everyone, I tried deploying the django-basic-blog last night. However, in the site admin, I get an error about a missing table whenever I save a post. The strange thing is, if I go back to the Posts list, the new post is there. The error is below. I have installed the django-tagging

Re: FYI: Random Newline in POST data

2008-04-02 Thread Karen Tracey
On Wed, Apr 2, 2008 at 5:06 AM, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > Hi, > > if you have a lot of post data, you might get random extraneous newline > characters. I got it in a select input. It took long to find the problem: > > http://code.djangoproject.com/ticket/6256 > > Attention,

Mod_Python and Eggs

2008-04-02 Thread JLathem
The first time I boot my server and view my django app I get the following message === ExtractionError: Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg

Need help structuring a reviews and ratings app

2008-04-02 Thread [EMAIL PROTECTED]
Ok, here's what I'm trying to do, and I'm just not sure how to structure it. 1) Have an initial review of Foo. The initial reviewer should be able to rate Foo in several categories. 2) Have staff counterpoints to the initial review, also rating it in the same categories. 3) Have visitor comments

Re: UPDATE: is Django OK for parallelized computations? (both psql and mysql won't work when parallelized)

2008-04-02 Thread Valery
Hi message "no results to fetch" is typical for psycopg. So, I decided to try mysql. Now the sporadic mesage is: : (2013, 'Lost connection to MySQL server during query') and in 10% cases the application simply hungs up. Maybe the number of connections/cursors gets to high? Anyway, it is all

Re: Reports

2008-04-02 Thread Alagu Madhu
rlib.sicompos.com http://www.htmltopdf.org/ http://openreport.org/index.py/static/page/docs On Apr 2, 2:51 pm, "Marinho Brandao" <[EMAIL PROTECTED]> wrote: > Sorry, I sent to wrong user group > > 2008/4/2, Marinho Brandao <[EMAIL PROTECTED]>: > > > > > Olá, > > >  para geração de gráficos,

Combine raw SQL with model.save() in one transaction?

2008-04-02 Thread Constantin Christmann
Is it possible to combine raw SQL statements with Django's convenient model.save() in one transaction? I use MySQL/InnoDB and need to place some raw SQL inside a transaction block: cursor = connection.cursor() cursor.execute(""" START

Track number of hits on object

2008-04-02 Thread gorans
Hi all, I'm still quite new to django coding and am trying to learn to work inline with Django's DRY and other principles. In this case I'm having trouble deciding what is the more Django way of counting the number of times an object has been open. I know that the code will be executed in the

Re: Auth System

2008-04-02 Thread [EMAIL PROTECTED]
Why is anyone shocked that the print version of the book would have an error? --~--~-~--~~~---~--~~ 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

Re: datetime 8 hours off

2008-04-02 Thread Jarek Zgoda
Simon Oberhammer napisał(a): > anybody? after restartign apache everything is fine again.. i have to > do this once or twice a day. > > On Apr 1, 9:15 pm, Simon Oberhammer <[EMAIL PROTECTED]> > wrote: >>> What version of Django are you using?, what deployment method >>> are you using?

Re: ORM / General Database Question

2008-04-02 Thread Malcolm Tredinnick
On Wed, 2008-04-02 at 08:06 -0400, Chris wrote: > I've done this without questioning it ever since I can remember : no > matter what, assign a primary key to everything. > > Is this necessary when you have a ForeignKey relation? Can the > ForeignKey be the unique identifier in the table? Yes,

Re: get_or_create and DoesNotExist

2008-04-02 Thread Bruno Tikami
Bryan, sorry for the late reply. I've downloaded your code and will run some tests right now. I write you back when I get something. []s! Tkm On Mon, Mar 31, 2008 at 7:28 PM, Bryan Veloso <[EMAIL PROTECTED]> wrote: > > Sure thing Bruno, > > Model: http://dpaste.com/hold/42454/ > Flickr

ORM / General Database Question

2008-04-02 Thread Chris
I've done this without questioning it ever since I can remember : no matter what, assign a primary key to everything. Is this necessary when you have a ForeignKey relation? Can the ForeignKey be the unique identifier in the table? --~--~-~--~~~---~--~~ You

Re: datetime 8 hours off

2008-04-02 Thread Simon Oberhammer
anybody? after restartign apache everything is fine again.. i have to do this once or twice a day. On Apr 1, 9:15 pm, Simon Oberhammer <[EMAIL PROTECTED]> wrote: > > What version of Django are you using?, what deployment method > > are you using? (mod_python, fast cgi, mod_wscgi). > > i'm using

Re: Reports

2008-04-02 Thread Marinho Brandao
Sorry, I sent to wrong user group 2008/4/2, Marinho Brandao <[EMAIL PROTECTED]>: > Olá, > > para geração de gráficos, dê uma olhadinha aqui também: > > http://marinho.webdoisonline.com/blog/p/136/ > > 2008/3/27, Justin Lilly <[EMAIL PROTECTED]>: > > > Django handles it as well as Python. > >

Re: Reports

2008-04-02 Thread Marinho Brandao
Olá, para geração de gráficos, dê uma olhadinha aqui também: http://marinho.webdoisonline.com/blog/p/136/ 2008/3/27, Justin Lilly <[EMAIL PROTECTED]>: > Django handles it as well as Python. > > Here are some resources I would suggest checking out: > report lab:

Re: Manipulating request.FILES

2008-04-02 Thread Dmitriy Sodrianov
Yes, that helped, thanks! On 1 апр, 09:55, Cephire <[EMAIL PROTECTED]> wrote: > Dimitri: I assume that you want to modify the name of the file that is > submitted. It can be done in _save_FIELD_file of the model. Here is a > snippet that i use to change the name of the uploaded avatar icon for >

Re: Advanced Form Questions

2008-04-02 Thread Przemek Gawronski
For multiple instances of the same form you should use the 'prefix' parameter in the constructor: > .. > form = SearchForm(request.POST) f1 = SearchForm( prefix='f1', request=request.POST) f2 = SearchForm( prefix='f2', request=request.POST) .. or: FORMS_COUNT=3 forms=[ SearchForm(

Re: JSON serializers.serialize raises DoesNotExist on recursive data structures

2008-04-02 Thread Legioneer
Found a solution. It works when add fields parameter to serialize, but only when without parent field: e.g. serializers.serialize("json", c, fields='name,rank') works perfect, while serializers.serialize("json", c, fields='name,rank,parent') raises DoesNotExist exception where c =

instance needs to have a primary key value before a many-to-many relationship can be used.

2008-04-02 Thread timc3
I have the following model: class GroupsOfUser(models.Model): name = models.CharField(max_length=50) description = models.TextField(blank=True,help_text="Optional") slug = models.SlugField(prepopulate_from=('name',)) group_members = models.ManyToManyField(User,

Re: is Django OK for parallelized computations?

2008-04-02 Thread Valery
Hi Malcolm, many thanks for your reply. Let me give some more details. I use parallelized fetching of database objects like this: my_dictionaries = pprocess.pmap( fetch_object, ["serchterm1", "searchterm2", "searchterm3"]) where fetch_object function is not read-only, but smth like this:

Re: JSON serializers.serialize raises DoesNotExist on recursive data structures

2008-04-02 Thread Legioneer
yes. in admin there are no problems with it. On Apr 2, 4:40 am, 1234 <[EMAIL PROTECTED]> wrote: > Is this model work on in admin? > > 2008/4/1, Legioneer <[EMAIL PROTECTED]>: > > > > > My data model is very similar to your: > > > class Category(models.Model): > > name =

FYI: Random Newline in POST data

2008-04-02 Thread Thomas Guettler
Hi, if you have a lot of post data, you might get random extraneous newline characters. I got it in a select input. It took long to find the problem: http://code.djangoproject.com/ticket/6256 Attention, the mentioned one line patch is broken. It alters uploaded binary data. The python bug:

Re: ***SPAM*** Re: Adding an "invalid" choice to a ChoiceField?

2008-04-02 Thread Thomas Guettler
Michael schrieb: >> TOPIC_CHOICES=[('', '-- pick one --'), ('key1', '...'), ...] >> > > Thanks, using an empty string for the value seems to do the trick. Is > there somewhere in the documentation that explains this behavior? I'm > not able to locate it anywhere. > > >> And required=False

Re: is Django OK for parallelized computations?

2008-04-02 Thread Malcolm Tredinnick
On Wed, 2008-04-02 at 01:21 -0700, Valery wrote: > Hi > > did anyone here use Django in parallelized computations? > > I use for about a year a great parallelization approach based on > 'pmap' function from 'pprocess' module: > http://www.boddie.org.uk/python/pprocess.html > > My own code is

Re: Adding additional needed information in to newforms post

2008-04-02 Thread timc3
The final working form: if request.method == 'POST': f = GroupForm(request.POST) if f.is_valid(): newgroup = f.save(commit=False) newgroup.group_owner = request.user newgroup.groupmembers = request.user.id newgroup.groupadmins =

Re: do Django's models support the aggregated database views?

2008-04-02 Thread Valery
Hi Malcolm, thank you for the answer. I simply re-created my SQL VIEWs with fake/ dummy primary keys and Django became happy with it :) Regards Valery P.S. Sorry, that I have found your answer so late, google's interface to groups doesn't allow intuitively to set up notifications. On Mar

is Django OK for parallelized computations?

2008-04-02 Thread Valery
Hi did anyone here use Django in parallelized computations? I use for about a year a great parallelization approach based on 'pmap' function from 'pprocess' module: http://www.boddie.org.uk/python/pprocess.html My own code is designed to be strongly side-effect-free, however I am experiencing

Re: dictionary rows form database

2008-04-02 Thread Constantin Christmann
Malcolm Tredinnick schrieb: > Wouldn't it be better to ask this question on the psycopg2 mailing list? > Sorry, it's not my intention to misuse this mailing list and I did ask this question to myself before posting. I am trying to keep the django code db-backend independend (which is part of

Re: Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread Szaijan
My mistake. setattr(object, fieldName, value) works perfectly. I had a piece of verification code where I had repeated the non-functional object[fieldName] notation and it was giving an identical error. My apologies, and thanks again! This is what comes from working with a Python based

Re: Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread Malcolm Tredinnick
On Wed, 2008-04-02 at 00:57 -0700, Szaijan wrote: > Wow, fast response. Thank you. > > Unfortunately, the following doesn't work either: > > setattr(object, fieldName, value) > > >> doesn't work... I get TypeError: "modelName object is unsubscriptable." > > Is my syntax incorrect? It seems

Re: inclusion tags and RequestContext

2008-04-02 Thread Daniel Roseman
On Apr 1, 3:40 pm, Panos Laganakos <[EMAIL PROTECTED]> wrote: > I changed the definition of the inclusion tag to accept a second > parameter in the form of: > > def my_function(context, myparam): > ... > > but I didn't get access to the variables in the context, I had to: > > return { >

Re: Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread Szaijan
Thank you for the swift reply, Malcolm. setattr(object, fieldName, value) >> doesn't work. I get TypeError: "modelName object is unsubscriptable". Is my syntax incorrect? Does Django overload the Python object setattr fn? > What you're looking for is the setattr() function (it's a

Re: Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread Szaijan
Wow, fast response. Thank you. Unfortunately, the following doesn't work either: setattr(object, fieldName, value) >> doesn't work... I get TypeError: "modelName object is unsubscriptable." Is my syntax incorrect? It seems to be in line with the base Python setattr fn docs. > What you're

Re: dictionary rows form database

2008-04-02 Thread Malcolm Tredinnick
On Wed, 2008-04-02 at 09:36 +0200, Constantin Christmann wrote: > Hello, > > I am trying to get a sequence of dictionaries instead of a sequence of > tuples from cursor.fetchall() > > When googleing I found some examples doing this by > c =

Re: Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread Malcolm Tredinnick
On Wed, 2008-04-02 at 00:34 -0700, Szaijan wrote: > I am having difficulty updating a model object in a view when the > field to be updated is determined by the data submitted in the > request. For instance, if the model has some arbitrary fields, and > the request submitted includes POST data

dictionary rows form database

2008-04-02 Thread Constantin Christmann
Hello, I am trying to get a sequence of dictionaries instead of a sequence of tuples from cursor.fetchall() When googleing I found some examples doing this by c = conn.cursor(cursor_factory=psycopg2.extras.DictCursor) c.fetchall() But when looking at the source of the psychopg2

Syntax for Updating Arbitrary Model Object Fields

2008-04-02 Thread Szaijan
I am having difficulty updating a model object in a view when the field to be updated is determined by the data submitted in the request. For instance, if the model has some arbitrary fields, and the request submitted includes POST data indicating that one of those fields should be updated, what

Re: issue with the development server

2008-04-02 Thread Malcolm Tredinnick
On Tue, 2008-04-01 at 23:29 -0700, Brot wrote: > Hello, > > I have a problem with the development server. I don't know if this > behavior is right or if there is a problem. > I have a view which is triggered throught an url. In this view I use > urllib2. If I start the view with the development

Re: unique=True doesn't seem to do its job

2008-04-02 Thread Kenneth Gonsalves
On 02-Apr-08, at 12:03 PM, Julien wrote: > get() returned more than one Project -- it returned 2! Lookup > parameters were {'slug__exact': u'hello'} > > I have the same issue on the front end using ModelForm. > > Shouldn't that raise an IntegrityError, and then reload the form page > with an

Re: issue with the development server

2008-04-02 Thread Evert Rol
> I have a problem with the development server. I don't know if this > behavior is right or if there is a problem. > I have a view which is triggered throught an url. In this view I use > urllib2. If I start the view with the development server the process > is never ends. But if I start the view

unique=True doesn't seem to do its job

2008-04-02 Thread Julien
Hi there, I have a slug field which I'd like to be unique, so I do like this: class Project(models.Model): slug = models.SlugField(_('bla'), max_length=50, blank=True, unique=True, help_text=_('blabla')) In admin, if I saved a project with the slug 'hello', and then saved another one with

issue with the development server

2008-04-02 Thread Brot
Hello, I have a problem with the development server. I don't know if this behavior is right or if there is a problem. I have a view which is triggered throught an url. In this view I use urllib2. If I start the view with the development server the process is never ends. But if I start the view