Re: many to many add by ids

2009-09-30 Thread Tom Evans
On Tue, 2009-09-29 at 16:16 -0700, rich.al...@gmail.com wrote: > I have the following I'm trying to optimize. > > Input (from the web) is > > sids = "1,2,3,5" (a list of ids is posted, say they are article ids) > > Now, to add them to a many to many, I'd like to just > > try: > authors.articl

Re: FF3 src error in django admin calendar

2009-09-30 Thread Daniel Roseman
On Sep 29, 11:45 pm, Ron W wrote: > I've been getting thrown 500 errors from someone using the admin from > what looks like Mac Firefox 3.5 with the Huffington Post's Firefox > extension (why on earth..), but its looking for /img/admin/ > icon_calendar.gif/ which isn't from TinyMCE its the Django

Re: Menu managements, current URL

2009-09-30 Thread David De La Harpe Golden
Maksymus007 wrote: > I'm looking for simple way of managing menu - so my question is - how > i can get currently used URL? > I'm presently using a very simple template-based menu scheme, as each view tends to use a separate template. I don't need to worry about the url. Hardly the be-all and end

Send a parameter from a template to another template

2009-09-30 Thread NMarcu
Hello, I need to send a value from a template to another template. In my first template I have something like this: td>Edit The result will be: "/edit/admin" I need to use the value: "admin" in another template. I have in my urls.py: url(r'^operators/edit/(?P\w+)', 'views.edit'), My views.e

Re: Send a parameter from a template to another template

2009-09-30 Thread Daniel Roseman
On Sep 30, 11:23 am, NMarcu wrote: > Hello, > >    I need to send a value from a template to another template. > In my first template I have something like this: > td>Edit > The result will be: "/edit/admin" > I need to use the value: "admin" in another template. > I have in my urls.py: > >  url(

add my blog to django community (django blogs aggregator)

2009-09-30 Thread nabucosound
Does anybody know where to apply or send or whatever has to be done to have the feed for my django blog http://nomadblue.com/ listed in the official Django Community http://www.djangoproject.com/community/ ??? At the bottom right of the page it is supposed that you send an e-mail to Jacob, and so

Re: What JavaScript framework do you use and why?

2009-09-30 Thread Jani Tiainen
Joshua Russo kirjoitti: > On Mon, Sep 28, 2009 at 4:00 AM, Jani Tiainen > wrote: > > > Joshua Russo kirjoitti: > > Great links guys, thanks. I'm still in the mindset of frameworks just > > making JavaScript less painful too and I'm looking for ways to mov

database design

2009-09-30 Thread max kalinski
hi djangos, i switched from symfony to django :) its fun, thanks! but i am stuck with my database/model design. now it gets OT (sorry) but i need an opinion on how to design a typical order process: class Order(models.Model): user = models.ForeignKey(User, verbose_name=_("Customer"), relat

Re: database design

2009-09-30 Thread Tim Chase
> products_ordered = models.ManyToManyField(Product) > > i don't like it (as i would have to create my own "through" table/ > class) > for saving the recent price, qty, date etc. I'm not sure what your complaint about the "through" table is -- is it that you'd have to create it (which you do be

How do I require login before accessing FormWizard forms?

2009-09-30 Thread JimR
OK, so I've searched the group and the Internet looking for the answer to this questions, and the common answer seems to be "wrap the formwizard in a view." But I don't see any examples of how to do this. I currently have the formwizard embedded in the URLconf, and my attempt at "wrapping the fo

Re: add my blog to django community (django blogs aggregator)

2009-09-30 Thread Russell Keith-Magee
On Wed, Sep 30, 2009 at 7:03 PM, nabucosound wrote: > > Does anybody know where to apply or send or whatever has to be done to > have the feed for my django blog http://nomadblue.com/ listed in the > official Django Community http://www.djangoproject.com/community/ ??? > At the bottom right of th

How to include template with current tag definitions

2009-09-30 Thread Arnaud Delobelle
Hi all, I would like to be able to include a template from another template so that the included template understands the tag definitions defined in the including template, but I can't think of a simple way to do it. E.g. say that mytags defines a tag called "mytag". I would like the following

Re: Which compressor / packer for CSS and JS?

2009-09-30 Thread David Ziegler
There are several django apps out there that do this. Here is a chart comparing some of them: http://www.qompr.com/charts/59;django-asset-managers/ Two not mentioned on there are django-compressor and django-css. I wrote django-css, so I guess I'm pretty partial to that over the others. I've nev

Re: database design

2009-09-30 Thread mart
On Sep 30, 2009, at 1:54 PM, Tim Chase wrote: > >> products_ordered = models.ManyToManyField(Product) >> >> i don't like it (as i would have to create my own "through" table/ >> class) >> for saving the recent price, qty, date etc. > > I'm not sure what your complaint about the "through" table i

Re: create a method that only one user can access in the same time

2009-09-30 Thread Kristaps Kūlis
Create locks and store them at cache as keys. Or implement counter as cache.incr('users_online') On Wed, Sep 30, 2009 at 3:52 AM, Nan wrote: > > Any particular reason you can't just use User.objects.count() ? > > On Sep 29, 7:16 pm, gustavo Cardoso wrote: > > Hello Folks, > > > > I need to impl

Re: QuerySet hang

2009-09-30 Thread Michael
On Wed, Sep 30, 2009 at 2:12 AM, Waqas wrote: > > Thanks for ur reply Micheal. > It is hanging exactly on following line: > > rs = InqueuePing.objects.filter(processed = 0).order_by('-timestamp') > > If I remove order_by function then it works fine. > > I think this is not django issue. I debug t

Re: database design

2009-09-30 Thread Thomas Guettler
In OrderDetail you have a ForeignKey to Product. But you need to *copy* the price. Example: if someone orders something at day1 for 1 dollar, and you set the price on day2 to 3 dollar, you need to ship your product cheap for all who odered before day2. max kalinski wrote: > hi djangos, > > i swi

Re: syndication feed framework - how to reverse the urls?

2009-09-30 Thread anentropic
Anyone? Is it possible to reverse those urls? The feeds framework implementation seems like a dirty hack to urls.py (but otherwise works great!) On Sep 29, 4:57 pm, anentropic wrote: > I've been setting up feeds using the syndication feed framework. > > I have a line like this in my urls.py: >

Keeping request.GET keys

2009-09-30 Thread bax...@gretschpages.com
I'm passing through a testcookie function and would like to keep the request.GET keys so if the original URL is /testcookie/?foo=1&bar=2 When testcookie works, I want to redirect to the new URL with foo and bar intact. How? --~--~-~--~~~---~--~~ You received t

Re: database design

2009-09-30 Thread mart
On Sep 30, 2009, at 4:17 PM, Thomas Guettler wrote: > > In OrderDetail you have a ForeignKey to Product. But you need to > *copy* > the price. Example: if someone orders something at day1 for 1 dollar, > and you set the price on day2 to 3 dollar, you need to ship your > product cheap for all w

'NoneType' object has no attribute 'widget'

2009-09-30 Thread dijxtra
I'm getting "'NoneType' object has no attribute 'widget'" exception and I just can't figure out where is the problem. Here is my error: Django Version: 1.1 Traceback: File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in get_response 92. response = callback(reque

Re: Help on query

2009-09-30 Thread Jay
Use the aggregation way: user.report_set.annotate(count = Count('report_set')).filter(count = 1) On Sep 29, 10:39 pm, luismmontielg wrote: > yeah, something like that is what I want, but to me, that is not the > best way of doing it ... > Maybe there's a simpler way? > > thanks in advance > > On

% extends %

2009-09-30 Thread luca72
Hello i have made a base template like this: http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> {% block title %}{% endblock %} < Please make your selection http://www.pppi.com";>Go To O.F.B. Home Page Go To Download Draw. Page

Re: 'NoneType' object has no attribute 'widget'

2009-09-30 Thread Karen Tracey
On Wed, Sep 30, 2009 at 10:53 AM, dijxtra wrote: > > I'm getting "'NoneType' object has no attribute 'widget'" exception > and I just can't figure out where is the problem. Here is my error: > > Django Version: 1.1 > > Traceback: > [snip] > In this form: 1. class DiaryEntryForm(ModelForm):

Re: Keeping request.GET keys

2009-09-30 Thread Jay
I do not quite follow your statement. Do you mean redirect (request.get_full_path())? On Sep 30, 10:47 pm, "bax...@gretschpages.com" wrote: > I'm passing through a testcookie function and would like to keep the > request.GET keys > > so if the original URL is /testcookie/?foo=1&bar=2 > > Whe

Re: developing and deploying django with zc.buildout

2009-09-30 Thread Chris Withers
andreas schmid wrote: > then i wanted to try my apps which i have on my subversion repository > and i added a [site-packages] section to the buildout.cfg using Why not turn your apps into python packages and serve them from a private egg server? > to the [django] section. now i have my project

Re: % extends %

2009-09-30 Thread Karen Tracey
On Wed, Sep 30, 2009 at 10:58 AM, luca72 wrote: > > Hello i have made a base template like this: > > [snip] > > Than i have made this template: > {% extends "t_base.html" %} >{% block title %}Request Of Quotation{% endblock %} > > This line is outside of any block. It has no place to

Re: Is Django thread safe?

2009-09-30 Thread Chris Withers
Torsten Bronger wrote: >> Why are you asking? > > Can it be safely used with Apache's Worker MPM? I guess that would depend on a lot of things, not least of all whether you use mod_python or mod_wsgi to deploy. Certainly if it's the latter, you're likely to get better help on the mod_wsgi list

Re: database design

2009-09-30 Thread Thomas Guettler
mart wrote: > > On Sep 30, 2009, at 4:17 PM, Thomas Guettler wrote: > >> In OrderDetail you have a ForeignKey to Product. But you need to >> *copy* >> the price. Example: if someone orders something at day1 for 1 dollar, >> and you set the price on day2 to 3 dollar, you need to ship your >>

Pass a non-pickable object in between pages without using the session

2009-09-30 Thread Gabriel Rossetti
Hello everyone, how can I pass an object in between pages without using the session? The problem is that the object can be pickled so it can be put in a session, any ideas? Thank you, Gabriel --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: Pass a non-pickable object in between pages without using the session

2009-09-30 Thread Christophe Pettus
On Sep 30, 2009, at 8:59 AM, Gabriel Rossetti wrote: > how can I pass an object in between pages without using the session? > The > problem is that the object can be pickled so it can be put in a > session, > any ideas? Could you store it in the database? -- -- Christophe Pettus x...@th

Passing arguments on redirect (Django 1.1)

2009-09-30 Thread Matt
I'm using the redirect() function provided in Django 1.1: http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#django.shortcuts.redirect I have a view: my_editing_view(request, id, args={}) for which the URL is: url(r'^/edit/(?P.+)$', 'views.my_editing_view') And I'd like to redirect to

django-filebrowser throw out an exception "WindowsError"

2009-09-30 Thread workingbird
i am new to learn django and try to use django-filebrower and django- tinymce, and have some troubles. it happens when i click the filebrowser icon of image(field) in django admin site, the popup window show the errors. exception information: WindowsError at /admin/filebrowser/media/uploads/ (3

Re: Incorrect Python path in Apache FCGI deployment

2009-09-30 Thread W.P. McNeill
Because this appears to be a problem with load paths, I inserted code at the top of phonemechart/urls.py just above the import statements to write out the system path. import sys f = open('/tmp/pypath', 'w') f.write("Path is: %s" % sys.path) f.close from django.conf.urls.defaults import * ...

Re: Passing arguments on redirect (Django 1.1)

2009-09-30 Thread Daniel Roseman
On Sep 30, 5:05 pm, Matt wrote: > I'm using the redirect() function provided in Django > 1.1:http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#django.sh... > > I have a view: > my_editing_view(request, id, args={}) > > for which the URL is: > url(r'^/edit/(?P.+)$', 'views.my_editing_vi

Re: Pass a non-pickable object in between pages without using the session

2009-09-30 Thread Daniel Roseman
On Sep 30, 4:59 pm, Gabriel Rossetti wrote: > Hello everyone, > > how can I pass an object in between pages without using the session? The > problem is that the object can be pickled so it can be put in a session, > any ideas? > > Thank you, > Gabriel Why can't it be pickled? Clearly, since ever

Re: Incorrect Python path in Apache FCGI deployment

2009-09-30 Thread Karen Tracey
On Wed, Sep 30, 2009 at 12:47 PM, W.P. McNeill wrote: > > Because this appears to be a problem with load paths, I inserted code > at the top of phonemechart/urls.py just above the import statements to > write out the system path. > > import sys > > f = open('/tmp/pypath', 'w') > f.write("Path is:

MultiValueField required=False problem

2009-09-30 Thread eka
Hi All. When using MultiValueField if I set required=False in my field Any of the form fields can be empty, but if required is default to True, None of the field can be empty or blank... isn't there a middle ground? In the case where I'm using 2 fields and I wan't only the first to allow blank v

hiding the delete button

2009-09-30 Thread patcoll
In the "admin/submit_line.html" template I can see options such as "show_delete_link", etc but cannot for the life of me figure out a programmatic way to set these values to False. Ideally, I would only like to display the "Save" button. (I realize I could override the "change_form" template for

Re: MultiValueField required=False problem

2009-09-30 Thread eka
Update: If I pass required=False to the field that belongs to a MultiValueFields it doesn't take that into account since only sees for the required in the MultiValueField instance. As I see in the MultiValueField.clean method forms/fields.py line 801 of django 1.1 stable if self.required and f

Django 1.1, cx_oracle 5.0.2, Oracle 9i, NCLOB Textfield

2009-09-30 Thread Thomas
Hello, OS : windows Python : 2.6.2 I have an issue with Textfield in django models. The textfield are created as NCLOB in the Oracle 9i DB. When I try to save a textfield from the django admin it works fine if the limit of 1128 character is kept. If I try to insert a bigger text the characters a

Re: hiding the delete button

2009-09-30 Thread rajeesh
Hi, I think the problem lies in ModelAdmin.render_change_form. Watch out the line of 'has_delete_permission' It reads as.. 'has_delete_permission': self.has_delete_permission(request, obj). It just don't know anything about the context variable 'show_delete'. Change the above line to .. 'has_de

Re: MultiValueField required=False problem

2009-09-30 Thread eka
Also found in the __init__ of MultiValueField: def __init__(self, fields=(), *args, **kwargs): super(MultiValueField, self).__init__(*args, **kwargs) # Set 'required' to False on the individual fields, because the # required validation will be handled by MultiValueField, n

Re: Incorrect Python path in Apache FCGI deployment

2009-09-30 Thread W.P. McNeill
I figured out the first problem listed above. It wasn't related to file permissions, but I want to document it here since if I hit it someone else is likely to hit it too. The problem was because I was writing application import statements incorrectly. For example, I was saying: from phone

Re: Pass a non-pickable object in between pages without using the session

2009-09-30 Thread Gabriel Rossetti
Christophe Pettus wrote: > On Sep 30, 2009, at 8:59 AM, Gabriel Rossetti wrote: > >> how can I pass an object in between pages without using the session? >> The >> problem is that the object can be pickled so it can be put in a >> session, >> any ideas? >> > > Could you store it in the

Re: Pass a non-pickable object in between pages without using the session

2009-09-30 Thread Gabriel Rossetti
Daniel Roseman wrote: > On Sep 30, 4:59 pm, Gabriel Rossetti > wrote: > >> Hello everyone, >> >> how can I pass an object in between pages without using the session? The >> problem is that the object can be pickled so it can be put in a session, >> any ideas? >> >> Thank you, >> Gabriel >>

Re: hiding the delete button

2009-09-30 Thread patcoll
I was able to come up with a patch to solve the issue. With my patch, by passing {'show_delete': False} in with extra_context in the ModelAdmin change_view method, the delete button/icon is no longer shown. http://code.djangoproject.com/ticket/10057 On Sep 30, 1:40 pm, rajeesh wrote: > Hi, > I

Re: create a method that only one user can access in the same time

2009-09-30 Thread gustavo Cardoso
Acctually, I need to do a SELECT in a table. In this table has a flag field. if the flag field has 0 so I can update de flag field to 1. In other words I need to do a SELECT by verifing if the flag field is 0. And after, I can update to 1 the flag field. But the problem is: More than one access o

Re: Passing arguments on redirect (Django 1.1)

2009-09-30 Thread Matt
No, that's a good point. You fundamentally can't give someone a forced POST request on a redirect (essentially what I was trying to do) through Django because That's Not How the Internet Works (TM). I just made the save() function be called by an ajax request, and if there are errors, the displa

Is there a workaround for MySQLdb's failure to handle unicode?

2009-09-30 Thread W.P. McNeill
Some of the fields in my application's database contain unicode strings. I serialized this database into a fixture. When I try to load that fixture into a machine running MySQL I get an warning from MySQLdb/cursors.py about an "Incorrect string value" and my database is left incomplete. The sam

Re: Is there a workaround for MySQLdb's failure to handle unicode?

2009-09-30 Thread W.P. McNeill
The problem is worse than I initially thought. Not only are unicode characters are unsupported during deserialization from a fixture, they are not supported at all. If I try to manually enter unicode characters through the Django database admin UI, I get the same error message. So currently my

Re: hiding the delete button

2009-09-30 Thread patcoll
Rajeesh, I forgot to thank you for the inspiration for the patch I submitted, so thanks! For future reference, it is also possible to disable the delete button by hard-coding the return value of "has_delete_permission" to False. An example from my code: class MenuAdmin(admin.ModelAdmin): #

InlineModelAdmin

2009-09-30 Thread Marek Pietrucha
Hello, Could someone help me how can i add inlines to a admin.StackedInline? On the django web page it is written that: "The InlineModelAdmin class is a subclass of ModelAdmin so it inherits all the same functionality as well as some of its own: (...)" But when i add "inlines" to a StackedModel

Re: Django 1.1, cx_oracle 5.0.2, Oracle 9i, NCLOB Textfield

2009-09-30 Thread Ian Kelly
On Sep 30, 11:35 am, Thomas wrote: > Hello, > > OS : windows > Python : 2.6.2 > > I have an issue with Textfield in django models. > The textfield are created as NCLOB in the Oracle 9i DB. > When I try to save a textfield from the django admin it works fine if > the limit of 1128 character is kep

App/Project naming - best practices

2009-09-30 Thread David Koblas
Just currious what people are doing for "best practices" in the realm of building apps. Specifically I have a tendency to create a lot of "one-off" websites (e.g. Django App) and use a few standard apps across all of them. What catches me up all of the time is naming systems. If I was to cre

Re: create a method that only one user can access in the same time

2009-09-30 Thread Dan Ostrowski
Sounds like you need an atomic operation. Instead of doing a SELECT, do an UPDATE and then check the affected rows, such as: UPDATE table SET flag = 1 WHERE flag = 0; Then check if the operation succeeded. Cheers, Dan On Sep 30, 11:38 am, gustavo Cardoso wrote: > Acctually, > > I need to do

Re: create a method that only one user can access in the same time

2009-09-30 Thread gustavo Cardoso
Thanks a lot Dan, It's exactly what I was looking for. It was so easy. Now I can see. Thanks Again. On Wed, Sep 30, 2009 at 3:50 PM, Dan Ostrowski wrote: > > Sounds like you need an atomic operation. > > Instead of doing a SELECT, do an UPDATE and then check the affected > rows, such as: > > U

Re: Django 1.1, cx_oracle 5.0.2, Oracle 9i, NCLOB Textfield

2009-09-30 Thread alphacc
Hello Ian, > This sounds like a character set encoding problem.  The first thing I > would try, if possible, is to 1) recompile cx_Oracle with the > WITH_UNICODE option enabled and 2) switch to Django trunk (Django 1.1 > does not support this option).  This allows Django to send unicode > strings

Queryset.delete() - docs missing?

2009-09-30 Thread ringemup
>From [1]: "You can also delete objects in bulk. Every QuerySet has a delete() method, which deletes all members of that QuerySet." This suggests that there is a Queryset.delete() method for bulk deletion, but this method is not documented at [2]. Is there any reason for this? Thanks! [1] ht

curry to add dynamic methods to admin.ModelAdmin (for admin actions)

2009-09-30 Thread J
Hello, I am attempting to add dynamic actions to the admin actions list. Using the code below, the dynamic actions are added, but when I run any of the dynamic ones, I am getting the error: _set_ACCOUNT() got multiple values for keyword argument 'accountnum' I know I'm doing something wrong, b

Trouble with Messages feature in django.contrib.auth

2009-09-30 Thread willfe
Greetings! I'm trying to follow through the example shown at http://docs.djangoproject.com/en/dev/topics/auth/#messages to pass one or more messages to a user when saving a form. I'm using the 1.1 release. I've made sure the view calls: request.user.message_set.create(message = u"Hi there!") a

Re: Pass a non-pickable object in between pages without using the session

2009-09-30 Thread Karen Tracey
On Wed, Sep 30, 2009 at 1:49 PM, Gabriel Rossetti < gabriel.rosse...@arimaz.com> wrote: > > Why can't it be pickled? > > Because it has a socket open > > > Clearly, since every request is independent, > > if it really can't be pickled there is no way of passing it from one > > to the next. Could y

Re: Is there a workaround for MySQLdb's failure to handle unicode?

2009-09-30 Thread Karen Tracey
On Wed, Sep 30, 2009 at 2:56 PM, W.P. McNeill wrote: > > The problem is worse than I initially thought. Not only are unicode > characters are unsupported during deserialization from a fixture, they > are not supported at all. If I try to manually enter unicode > characters through the Django da

Re: Is Django thread safe?

2009-09-30 Thread Graham Dumpleton
On Oct 1, 1:19 am, Chris Withers wrote: > Torsten Bronger wrote: > >> Why are you asking? > > > Can it be safely used with Apache's Worker MPM? > > I guess that would depend on a lot of things, not least of all whether > you use mod_python ormod_wsgito deploy. Certainly if it's the latter, > yo

Re: Trouble with Messages feature in django.contrib.auth

2009-09-30 Thread Karen Tracey
On Wed, Sep 30, 2009 at 4:14 PM, willfe wrote: > > Greetings! > > I'm trying to follow through the example shown at > http://docs.djangoproject.com/en/dev/topics/auth/#messages to pass one > or more messages to a user when saving a form. I'm using the 1.1 > release. > > I've made sure the view ca

Re: Queryset.delete() - docs missing?

2009-09-30 Thread Daniel Roseman
On Sep 30, 9:17 pm, ringemup wrote: > From [1]: > > "You can also delete objects in bulk. Every QuerySet has a delete() > method, which deletes all members of that QuerySet." > > This suggests that there is a Queryset.delete() method for bulk > deletion, but this method is not documented at [2].

Re: Trouble with Messages feature in django.contrib.auth

2009-09-30 Thread willfe
On Sep 30, 5:43 pm, Karen Tracey wrote: > On Wed, Sep 30, 2009 at 4:14 PM, willfe wrote: > > The infuriating part is the debug toolbar actually *shows the message* > > in the template context, in an attribute called 'messages'. > > If this template snippet is contained in a child template, is it

Re: Queryset.delete() - docs missing?

2009-09-30 Thread Nan
That's a good reason. If I get some time, I'll give it a shot. On Sep 30, 5:58 pm, Daniel Roseman wrote: > On Sep 30, 9:17 pm, ringemup wrote: > > > From [1]: > > > "You can also delete objects in bulk. Every QuerySet has a delete() > > method, which deletes all members of that QuerySet." > >

Re: Trouble with Messages feature in django.contrib.auth

2009-09-30 Thread Karen Tracey
On Wed, Sep 30, 2009 at 6:28 PM, willfe wrote: > > *sigh* I was just about to post this as-is, and tried one more thing, > which fixed it. I hadn't added context_instance=RequestContext > (request) to the end of the render_to_response() return in the > specific method I was working with. I'd adde

Peepcode like screencasts for Django

2009-09-30 Thread hrishy
Hi Rails programmers have many screencasts like http://railscasts.com/ to bring newbie programmers upto speed is there anything like tahat available for Django regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Peepcode like screencasts for Django

2009-09-30 Thread Benjamin Buch
I especially enjoyed Eric Florenzano's excellent screencast series 'Django From the Ground Up'. You'll find it here: http://thisweekindjango.com/screencasts/ There are no screencasts on http://djangodose yet, but I think this is a good place to look out for screencasts in the future. -benja