SVN7049 - bug with development server ?
Hello, On my Debian Lenny box, with Python 2.5.1, I have the following error the first time I generate a page. When I refresh the page, I have the normal output (ie listing css, html, images files) Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 278, in run self.finish_response() File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 317, in finish_response self.write(data) File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 396, in write self.send_headers() File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 460, in send_headers in self.send_preamble() File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 378, in send_preamble 'Date: %s\r\n' % http_date() File "/usr/lib/python2.5/socket.py", line 262, in write self.flush() File "/usr/lib/python2.5/socket.py", line 249, in flush self._sock.sendall(buffer) error: (32, 'Broken pipe') Nicolas --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Complex relationship for user profile
Hi list! (first post) I've created a small application to suit a new project I am working on, however I have a question regarding using the user profile feature. I have the setup working properly according to the documentation and it works, what I need to know is if I can create a field in my user profile model that will mimic or update fields on the users table. For example, when I add a model for the profile, I would like to create a relationship so I can display and update the user's email on my admin page for the profile model, and not have to go to the users edit page to do so (and actually it would be handy for a couple fields...) Not sure how to pull this off, I'm only a couple days into Django (and loving it!) Thanks for the help, Aaron --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Technocrafter
http://www.technocrafter.com --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: url tag and reverse()
Am Freitag, 1. Februar 2008 06:53 schrieb Eric Abrahamsen: > This is kind of an extension of an earlier (mostly unresolved) issue I > had brought up here: > http://groups.google.com/group/django-users/browse_thread/thread/63beb7566d >c352a8/1e6e137f5b5a434a > > Here's my current url conf (I've commented out everything else): > > url(r'^(johndoe|janedoe)/$', 'translator', name="translator"), > url(r'^(johndoe|janedoe)/(?P[\w\d-]+)/$', 'entry', > name="entry"), > Have you tried this: (?Pjohndoe|janedoe) Thomas --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Image upload in user's directory
is just a sample.. I want auth.user.username there... On Feb 1, 12:16 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Am Freitag, 1. Februar 2008 07:57 schrieb django_user: > > > Hi, > > I am using the following in my Image model: > > file = models.ImageField(upload_to='/%y/%m/%d') > > > I want every image to be uploaded in the users directory like '// > > %y/%m/%d' instead of all files in default location. > > > Is it possible ? > > Where does the variable 'user' come from? > > Maybe this patch does help you:http://code.djangoproject.com/ticket/5361 > > HTH, > Thomas --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Image upload in user's directory
Am Freitag, 1. Februar 2008 07:57 schrieb django_user: > Hi, > I am using the following in my Image model: > file = models.ImageField(upload_to='/%y/%m/%d') > > I want every image to be uploaded in the users directory like '// > %y/%m/%d' instead of all files in default location. > > Is it possible ? Where does the variable 'user' come from? Maybe this patch does help you: http://code.djangoproject.com/ticket/5361 HTH, Thomas --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Image upload in user's directory
Hi, I am using the following in my Image model: file = models.ImageField(upload_to='/%y/%m/%d') I want every image to be uploaded in the users directory like '// %y/%m/%d' instead of all files in default location. Is it possible ? Thanks --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Looking for a security/encryption programmer for small contract
Hi, Thank you for all the information, it seems like you think it easy to do, as everyone accept to help me for free :-) The solution used before was to send to encrypted string in clear in a email. It used a perl impletation of the one-time pad. Emanuele, your said : As for safety, nothing is safer than OTP, but are we sure that your customer is able to go to great lengths to distribute long key streams over a perfectly safe channel to the sales representatives? Isn't the encrypted string secure? The method to send the string can't be secure. It is sent by email. The point is to encrypt it on the server, send it over an unsecure network. Then, when the sales rep. receive it, he will decrypt it. I tried tonight the gnupg. It works fine on my mac with thunderbird, but my client use outlook (gpg plugin is quite old), so I think I'll have to try with python-crypto. But pycrypto need to be compiled, I don't know if I can host it where I want. I'll check this out. Thank you Francis On 23 jan, 11:25, Francis <[EMAIL PROTECTED]> wrote: > Hi, > > I'm building a web application for one of my clients with django. But > I need to do something that I have never did before and I am somehow > really short on time to learn it. > > So I am looking for someone who has experience withencryption/ > security in python. It is to be incorporated into my django app. > > What's need to be done : > - Take a message, encrypt it using a secure method (should be better > or equal than OTP), return the encrypted message. > > What should be considered: > - The user who receives the encrypted message, should be able to > uncrypt it into his Windows workstation. I'm looking for a existing > software that can do the job. > > If you're are up to the task and want to make extra money just let me > know. > What I want from you is : > Your experience in the matter at hand > If you want to make a package (fixe price) just let me know when you > can finish it and your price. > If you want to be paid per hour, give me a time estimate and your > hourly rate. Plus when you can finish it. > > Thank you > > Francis --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
url tag and reverse()
This is kind of an extension of an earlier (mostly unresolved) issue I had brought up here: http://groups.google.com/group/django-users/browse_thread/thread/63beb7566dc352a8/1e6e137f5b5a434a Here's my current url conf (I've commented out everything else): url(r'^(johndoe|janedoe)/$', 'translator', name="translator"), url(r'^(johndoe|janedoe)/(?P[\w\d-]+)/$', 'entry', name="entry"), I would be using named groups on the first segment match, but named groups and the | still don't seem to be working. These two views accept their arguments like so: def translator(request, translatorName): ... def entry(request, translatorName, entryName=None): I can't get {% url %} tags based on these views to work -- they fail silently on most everything. Using reverse() to see what's going on, I find that: reverse('translator', args=['johndoe']) Gets me the correct url, while this fails: {% url translator johndoe %} Looking into the url tag code, I don't see why that would happen. When I try reverse() on the 'entry' view, like this: reverse('entry', args=['johndoe'], kwargs={'entryName':'blogentry'}) I get this traceback: Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.5/site-packages/django/core/ urlresolvers.py", line 297, in reverse return iri_to_uri(u'/' + get_resolver(urlconf).reverse(viewname, *args, **kwargs)) File "/Library/Python/2.5/site-packages/django/core/ urlresolvers.py", line 283, in reverse return u''.join([reverse_helper(part.regex, *args, **kwargs) for part in self.reverse_dict[lookup_view]]) File "/Library/Python/2.5/site-packages/django/core/ urlresolvers.py", line 88, in reverse_helper result = re.sub(r'\(([^)]+)\)', MatchChecker(args, kwargs), regex.pattern) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/re.py", line 142, in sub return _compile(pattern, 0).sub(repl, string, count) File "/Library/Python/2.5/site-packages/django/core/ urlresolvers.py", line 128, in __call__ if not re.match(test_regex + '$', force_unicode(value), re.UNICODE): File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/re.py", line 129, in match return _compile(pattern, flags).match(string) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/re.py", line 233, in _compile raise error, v # invalid expression error: nothing to repeat *** Changing the url conf so that both of the arguments are positional, rather than one positional and one named, and then calling reverse('entry', args=['johndoe','blogentry']), gets me the same error. What am I not understanding about url configuration and reverse()!!?? Thanks in advance, Eric --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
allow user to update his record
Is there a built in way for users to update their own user record? I currently have a page that displays user data to any other user. I was hoping to re-use that for allowing a user to edit his own. If it matters, I am useing a user_profile as described: http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/ Carl K --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
newforms file-upload troubleshooting
I've been trying unsuccessfully to implement a file-upload form. I put up the code from models.py, forms.py, and views.py, as well as the form template code and the generated form html at . I'd appreciate and welcome pointers to where I'm going wrong. Relevant info... - When I add a file from the admin interface, all works as expected. The file name appears in the db table's 'name' field; the path 'test_uploads/filename' appears in the 'originalfile' field; and the file is actually uploaded to the 'test_uploads' directory. - When I add a file (using my own newforms form) via the 'Choose File' button, the file appears to be properly selected. When I 'Submit', the file name *does* appear as expected in in the db table's 'name' field. However, in the 'originalfile' field, only 'filename' appears (i.e. 'house_pic.png'), not preceeded by 'test_uploads/' as above -- and the file is not uploaded to the 'test_uploads' directory or anywhere. - I'm running version 6401. Thanks much in advance. /birkin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Why the default Django transaction way doesn't work?
I found that the problems comes because I am using a middleware of perform_bench... so no problem here, just write this info. in case any other people falls the same trap. ;) On Jan 13, 2:41 pm, pength <[EMAIL PROTECTED]> wrote: > Thanks for your reply. > > I am using MySQL 5.0.24, with InnoDB engine. Actually I am not > familiar with MySQL settings, but as far as I understand, as when I > use the decorator @transaction.commit_on_success, thetransaction > works well, does that means my database backend has no problem in > supporttransaction? or I am wrong on this point? > > On 1月13日, 上午3时06分, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > > >Transactionbehaviour depends on database backend. What backend do you > > use and have you setuptransactionsupport for it? > > > On 12 янв, 20:45, pength <[EMAIL PROTECTED]> wrote: > > > > At first, I tried to search in this group, but only got an un-answered > > > question similar to > > > mine:http://groups.google.com/group/django-users/browse_thread/thread/7677... > > > > in my settings.py, i am using TransactionMiddleware. and my testing > > > views.py as following: > > > > def index(request): > > > c=Myobject.objects.get(pk=45) ###Myobject with a field 'isUpdate' > > > whichdefaultvalue is False. > > > c.isUpdate = True > > > c.save() > > > raise NameError > > > > after a request to this index view, I found in database that object's > > > 'isUpdate' was set to True... > > > > then I added an decorator: > > > @transaction.commit_on_success > > > def index(request): > > > c=Myobject.objects.get(pk=45) > > > . > > > > Then the object won't be changed. > > > > I am confused about this, because according to the Django document > > > abouttransaction, I think thedefaultway is just commit_on_success? > > > or what mistake I have made? > > > > Thanks!- 隐藏被引用文字 - > > > - 显示引用的文字 -- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Persistent data (other than sessions)
I have a view that works something like this: def graph_search(request): g = build_graph() result = search_graph(g, some_parameters_from_request) return render_to_response('template.html',{'result': result}) build_graph() queries the DB and builds the graph in memory, which takes about 2 or 3 seconds. Note that the data structure built is independent of the request. The request dependent part, searching the graph, is much faster. Is there anyway I can make g persistent? In other words, I want to build it once, and then search that copy for each additional request. I can't put the graph in the session, because it pickles them, and the data structure uses some ctypes that can't be pickled. Also, the data structure does not need to specific to a session. Any request could use this data structure. Any ideas? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: trouble with mod_python configuration
I am not sure I understand your setup. What is the world is / dashboard/? Why is Apache looking for that? What is the path of your reviews project? Is it actually in /var/www/? On Jan 31, 3:00 pm, pouakai68 <[EMAIL PROTECTED]> wrote: > I am trying to get a handle on how to configure django/reviewboard > under mod_python. > I want to setup reviewboard not in the root directory but a sub > directory say /reviews/ > I saw the comment: > > > Note > > If you deploy Django at a subdirectory -- that is, somewhere deeper > than "/" -- Django won't trim the URL prefix off of your URLpatterns. > So if your Apache config looks like this: > > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > PythonDebug On > > > then all your URL patterns will need to start with "/mysite/". For > this reason we usually recommend deploying Django at the root of your > domain or virtual host. Alternatively, you can simply shift your URL > configuration down one level by using a shim URLconf: > > urlpatterns = patterns('', > (r'^mysite/', include('normal.root.urls')), > ) > > > in the DJango book (ch20) but I haven't seen any other reference to > placing django apps deeper than '/' > This is my first django setup so I can only hope I'm on the right > path, anyway I have the following in my apache config: > === > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings > PythonPath "['/var/www', '/var/www/reviewboard' ] + sys.path" > PythonDebug On > > === > reviewboard.settings contains the line: > >ROOT_URLCONF = 'reviewboard.myurls' > > and reviewboard.myurls conatins: > > urlpatterns = patterns('', (r'^reviews/', > include('urls')), ) > > which is how I interpreted the comment about a 'shim URLconf' from the > book. > > Given the above config if I ask forhttp://10.64.9.131/reviews/apache > tells me: > > 'The requested URL /dashboard/ was not found on this server.' > > so the python handler is working but I have a problem with the shim > URLconf or the 'REVIEWBOARD_ROOT' > > I am confident this setup it just one step away from bursting into > life, if anyone can share a little experience I'd appreciate it... > > P. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: can't view my app in the admin page
Did it actually add tables for that app when you synced the db? Did you add the app to your INSTALLED_APPS? On Jan 31, 8:44 pm, aym35 <[EMAIL PROTECTED]> wrote: > hey Guys, > > * warning: this is a beginner question! > > I created a django project and a simple app... I added a simple class > in models.py (I put in an inner Admin class), synced the db, and > visited the admin page... > > however, I cannot see a field on the admin page related to my new > class... only the three default links are on this page...i.e. sites, > users,groups... > > I really don't understand what is going wrong... what do you guys > suggest in terms of debugging (I get no errors by the way) > > Aydin. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: form for display, not edit
Yes, I suppose if you wanted you could create a custom form that added the attribute disabled to all of them, however I am not aware of any other way, someone else might be able to explain how to alter all the fields in the __init__ method but I'm not sure how. On Jan 31, 7:13 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Using SVN you could SVN use modelforms, on .96 use the form_for > > helpers. > > but modelforms still puts everything in tags, right? > > Carl K > > > > > On Jan 31, 6:34 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: > >> newforms is great for creating forms. I need something similar to > >> generate a > >> display form from a model. > > >> I looked at subclassing form, but what I would need to override is in the > >> widgets. which is probably why my hope isn't a good one. but for what I > >> need, > >> I only am using char fields, so I don't have to worry about widgets. > > >> So, is there some way to render a form as just text? > > >> Carl K --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: can't view my app in the admin page
Is your app in the installed apps list in settings? On Jan 31, 8:46 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote: > You'll need to paste some code so we can see the problem. > Debugging advice: Double check everything! > > Jeff Anderson > > aym35 wrote: > > hey Guys, > > > * warning: this is a beginner question! > > > I created a django project and a simple app... I added a simple class > > in models.py (I put in an inner Admin class), synced the db, and > > visited the admin page... > > > however, I cannot see a field on the admin page related to my new > > class... only the three default links are on this page...i.e. sites, > > users,groups... > > > I really don't understand what is going wrong... what do you guys > > suggest in terms of debugging (I get no errors by the way) > > > Aydin. > > > > > > signature.asc > 1KDownload --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: can't view my app in the admin page
You'll need to paste some code so we can see the problem. Debugging advice: Double check everything! Jeff Anderson aym35 wrote: hey Guys, * warning: this is a beginner question! I created a django project and a simple app... I added a simple class in models.py (I put in an inner Admin class), synced the db, and visited the admin page... however, I cannot see a field on the admin page related to my new class... only the three default links are on this page...i.e. sites, users,groups... I really don't understand what is going wrong... what do you guys suggest in terms of debugging (I get no errors by the way) Aydin. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~--- signature.asc Description: OpenPGP digital signature
can't view my app in the admin page
hey Guys, * warning: this is a beginner question! I created a django project and a simple app... I added a simple class in models.py (I put in an inner Admin class), synced the db, and visited the admin page... however, I cannot see a field on the admin page related to my new class... only the three default links are on this page...i.e. sites, users,groups... I really don't understand what is going wrong... what do you guys suggest in terms of debugging (I get no errors by the way) Aydin. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: User permissions
On Jan 31, 2008 5:06 PM, Chris <[EMAIL PROTECTED]> wrote: > I've been reading up on user permissions and I have found that user > permissions are on a per-model basis. My question: If I have a photo > gallery application, and I have several uses who can post their > galleries to this application. Is there a way to create permission on > a per-user basis. Example maybe I created a gallery called 'The > Rockies' but I only want Bob, Susan, and Tim to see it, Is this > possible with the built in permissions? or would I have to create a > table column similar to is_public = models.booleanField(). If all you're worrying about is the public display and/or non-admin forms, it's fairly simple to do the necessary check in your own code based on data stored in the model object. Depending on the exact nature of the check, you might even be able to write a decorator to handle it for you. In the admin it's basically not possible right now, but will become very easy in the not-too-distant future. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: form for display, not edit
[EMAIL PROTECTED] wrote: > Using SVN you could SVN use modelforms, on .96 use the form_for > helpers. but modelforms still puts everything in tags, right? Carl K > > On Jan 31, 6:34 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: >> newforms is great for creating forms. I need something similar to generate a >> display form from a model. >> >> I looked at subclassing form, but what I would need to override is in the >> widgets. which is probably why my hope isn't a good one. but for what I >> need, >> I only am using char fields, so I don't have to worry about widgets. >> >> So, is there some way to render a form as just text? >> >> Carl K > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: form for display, not edit
Using SVN you could SVN use modelforms, on .96 use the form_for helpers. On Jan 31, 6:34 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: > newforms is great for creating forms. I need something similar to generate a > display form from a model. > > I looked at subclassing form, but what I would need to override is in the > widgets. which is probably why my hope isn't a good one. but for what I > need, > I only am using char fields, so I don't have to worry about widgets. > > So, is there some way to render a form as just text? > > Carl K --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
form for display, not edit
newforms is great for creating forms. I need something similar to generate a display form from a model. I looked at subclassing form, but what I would need to override is in the widgets. which is probably why my hope isn't a good one. but for what I need, I only am using char fields, so I don't have to worry about widgets. So, is there some way to render a form as just text? Carl K --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problem getting new project started
Hi, I have had some problms installing Django in Windows XP. I have finally got it to work, in a fashion. I can go to the command prompt and type "django-admin.py startproject mysite" I set path variables, etc so this command is semi-valid. The only problem is that instead of creating a 'mysite' folder in the current directory, it displays a list of possible commands. startproject is one of those commands, but no matter whatI do, it won't work. Thanks for all the help --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: User permissions
No, just now django doesn't support row level permissions. Look at this branch http://code.djangoproject.com/wiki/RowLevelPermissions On 1 фев, 02:06, Chris <[EMAIL PROTECTED]> wrote: > I've been reading up on user permissions and I have found that user > permissions are on a per-model basis. My question: If I have a photo > gallery application, and I have several uses who can post their > galleries to this application. Is there a way to create permission on > a per-user basis. Example maybe I created a gallery called 'The > Rockies' but I only want Bob, Susan, and Tim to see it, Is this > possible with the built in permissions? or would I have to create a > table column similar to is_public = models.booleanField(). --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: User permissions
> gallery application, and I have several uses who can post their > galleries to this application. Is there a way to create permission on > a per-user basis. There apparently was some work on a per-object permissions branch in the past, but it looks pretty dead: http://code.djangoproject.com/wiki/RowLevelPermissions Michael --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Admin page url reference problem
I had the same problem. I think the problem is that you are referencing a non-existent (view) function named 'viewer' in your urls.py. This wasn't a problem in previous versions, but with the addition of the reverse url lookup, non-existent views now cause problems. What I gather is happening is that on the first (admin) request, all urls and consequently views are introspected. Since one or more of the views (defined in the urls.py) don't exist an exception is raised. However, the results are cached and subsequent loading of the page don't cause an error (but the links are now incorrect). So check your urls.py and see if that clears up the problem. -Curt On Jan 27, 12:43 pm, paceman <[EMAIL PROTECTED]> wrote: > I seem to be having a problem with the django Admin facility. I have > used it quite some time with no problems, however, I ran into a > problem and it may relate to how I tried to solve some other > problems. So here is some background that may be important. > > Background: > * > Initially, I was using Django 0.96 in Debian, but I wanted to reduce > the amount of code needed to be written by using Generic Views - in > particular the Create / Update / Delete (CRUD) Generic Views. > > I found that using the 0.96 version did not facilitate automatic form > creation (this is provided in newforms). So, I wanted to try what was > described in the Django Book - Appendix D. I found Patch #3639 which > modifies the above Generic View for use with newforms - and hence > automatic form generation. It worked to a degree, but it did not > produce select boxes in the form for some reason. > > I installed the Django 0.97~svn6996-1 in Debian Experimental, then > applied Patch #3639 to it, and the result was much better for the > Generic View - select boxes are being rendered properly. However, a > niggling problem (unrelated to this problem) is that the model foreign > key to the Admin User table is not rendering the User table in the > Generic Update view - don't know how to do that yet (maybe you can't). > > Finally, I get to the problem that hopefully I can get some help > with. In progressing from 0.96 to 0.97 I carried patch #3185 with me > - this allows the Admin facility to be available in the url > ashttp://mysite/myapp/admininstead ofhttp://mysite/admin. I liked it > because it related the admin to the application in the url - which is > want the user sees. The django default is to reference the admin in > the project url.py, not in the app url.py. I had moved it to the app > and applied the patch. It worked great in 0.96. However, in 0.97 > when first accessed it fails with 'cannot find viewer in /mysite/ > myapp: > > ViewDoesNotExist at /mysite/myapp/admin/ > Tried viewer in module mysite.myapp.views. Error was: 'module' object > has no attribute 'viewer' > > Exception Location: /var/lib/python-support/python2.4/django/core/ > urlresolvers.py in _get_callback, line 184 > > Template error > > In template /var/lib/python-support/python2.4/django/contrib/admin/ > templates/admin/base.html, error at line 28 > ** > It refers to contrib/admin/templates/admin/base.html. Specifically, > the line (and 2 similar ones below it): > > {% trans > 'Documentation' %} > > If you refresh the url again, it does not fail, but you find that the > Doc, Change Password, and Logout does not work. The reason is that > the url template tag does not fully find the url it only picks up / > mysite/myapp/admin and misses the doc/ that should be on the end of > it. > > When I looked up the code on the Django site for base.html, it refers > to Revision 3091, and says it was last modified 2 years ago by hugo. > I notice that the corresponding line, line 23 contains a different > href, not using the url templatetag, but just 'doc/'. I tried this > modification, and the error dissappeared, but the Doc, Change > Password, and Logout links only work in the top Admin page. So, I > know it is not really the solution. I checked the code in 0.96, and > that is also how the href is done - only thing is it works in 0.96 > regardless of which Admin page you are on. > > I realize that the svn versions of django are not guarenteed bug free > - I tried to search for a similar bug, but could not find one. I also > checked out the most recent Django version using svn and still got the > same problem. Is anyone aware of this bug? Or, did I make some wrong > assumptions in the above leading to a problem of my own making? I > know that the Django Book says that the url template tag is undergoing > reconstruction - could this be negatively affecting the Admin > facility? That code is a bit of a mystery to me. > > I really appreciate any help offered. I have used this forum once > before with amazingly helpful responses. Man
Re: sudo under django or better solutions?
On Feb 1, 9:46 am, Alessandro Dentella <[EMAIL PROTECTED]> wrote: > On Thu, Jan 31, 2008 at 02:30:02PM -0800, Graham Dumpleton wrote: > > > On Feb 1, 4:27 am, sandro dentella <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > i'd like to make an application that should execute commands with > > > permission that are not normally for www-data (eg: create user). Of > > > course > > > I know I could use sudo and execute the command via subprocess or > > > similar. But it happens that the command is a python script so i'd > > > prefer > > > to use the python library directly. > > > > Is there any reccomanded way/ a sudo-module or similar? > > > You could use daemon mode of mod_wsgi instead and configure it to have > > your whole application run as the target user rather than Apache, then > > you don't have to worry about it at all. FASTCGI solutions also > > generally allow the application to run as a different user to Apache > > as well. > > mm... sudo is a much more fine grained way of granting permission. I don't > really like do give all power to a web application. > > What I would have liked was a sort of sudo module, so execute certain > *configured* funcions with more power. Using mod_wsgi daemon mode you can actually run up multiple process groups running as different users. Each would run the Django application, but you can then configure specific URLs to be delegated to the different process groups. Thus you can control user rights down to the level of URL. If you want, you can still use embedded mode (ie., like mod_python) to run the bulk of your code and use the daemon process just for the restricted URL set. For example: Alias /media/ /usr/local/django/mysite/media/ Order deny,allow Allow from all WSGIScriptAlias / /usr/local/django/mysite/apache/django.wsgi Order deny,allow Allow from all WSGIDaemonProcess django-admin \ user=django-admin group=django-admin \ processes=1 threads=5 WSGIProcessGroup django-admin In this scenario, all URLs of the Django application except stuff under '/admin' would continue to run in the Apache child processes just like when using mod_python. The user that that code runs as would be whatever Apache is configured to run as. For URLs under '/admin', they would be proxied through to a distinct daemon process running as the distinct user 'django-admin'. Thus, using the Location directive, you can selective indicate which URLs execute code which needs to run as the user 'django-admin'. No changes are required to the Django application for this to work, mod_wsgi automatically handles all the differences between running in embedded mode and daemon mode for you. Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
User permissions
I've been reading up on user permissions and I have found that user permissions are on a per-model basis. My question: If I have a photo gallery application, and I have several uses who can post their galleries to this application. Is there a way to create permission on a per-user basis. Example maybe I created a gallery called 'The Rockies' but I only want Bob, Susan, and Tim to see it, Is this possible with the built in permissions? or would I have to create a table column similar to is_public = models.booleanField(). --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
most popular adjacent tags
dear list, let's say i have many tagged items (eg images or bookmarks). if i select one of them, and then i select a tag of the item, i would like to find all the items with this tag (including the selected one) and make a histogram out of the tags of found items (exluding the selected one), ie to count and to sort how many times a certain tag appears jointly with the selected tag. for example: -- image: an apple -- tags: red, sphere, fruit -- image: a pear -- tags: green, fruit -- image: an orange -- tags: orange, sphere, fruit if i select the apple and then fruit the result should be *: sphere(2), red(1), green(1), orange(1) * i don't need the tags which are found only once, if that would speed up the things a bit i probably know that i need 2 classes (image, tag) comming from models.model and a many to many relationship from image to tag. the things i don't really know how to get done is the query. i would be thankful for any help! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: sudo under django or better solutions?
On Thu, Jan 31, 2008 at 02:30:02PM -0800, Graham Dumpleton wrote: > > On Feb 1, 4:27 am, sandro dentella <[EMAIL PROTECTED]> wrote: > > Hi, > > > > i'd like to make an application that should execute commands with > > permission that are not normally for www-data (eg: create user). Of > > course > > I know I could use sudo and execute the command via subprocess or > > similar. But it happens that the command is a python script so i'd > > prefer > > to use the python library directly. > > > > Is there any reccomanded way/ a sudo-module or similar? > > You could use daemon mode of mod_wsgi instead and configure it to have > your whole application run as the target user rather than Apache, then > you don't have to worry about it at all. FASTCGI solutions also > generally allow the application to run as a different user to Apache > as well. mm... sudo is a much more fine grained way of granting permission. I don't really like do give all power to a web application. What I would have liked was a sort of sudo module, so execute certain *configured* funcions with more power. thanks sandro *:-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on MacOS X Leopard
On Feb 1, 2:05 am, omat <[EMAIL PROTECTED]> wrote: > When I install Django on Leopard, py files went into: > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > site-packages/django/ If you are running Python 2.5.1 that ships with Leopard,then the directory: /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages should not exist and Python will not look in there. > And template htmls, etc. went into: > /Library/Python/2.5/site-packages/django/ Instead Python will look here in: /Library/Python/2.5/site-packages So, if you have a site-packages under: /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5 something has screwed up your installation. Did you create the site-packages directory in that location, or do you know what created it? Graham > This resulted in some weird behavior such as templates of contrib > applications such as admin not being located. > > My patch for this was to create a symlink as follows: > sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/site-packages /Library/Python/2.5/site-packages > > and then install Django. > > Thought this may save some time for ones having this problem. > > I would like to hear if there are any better approaches. > > oMat --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: A slug question
Cool Thanks for the replies. I think that Luke's snippet find is going to work. Unique is also a good way thanks. On Jan 31, 5:15 pm, "James Punteney" <[EMAIL PROTECTED]> wrote: > > My question: what if I > > have a weblog title that is identical to a post that I made 3 years > > ago and I didn't realize it? when saving, is the slugfield smart > > enough to acknowledge that there is a duplicate entry. > > The slug field itself doesn't force uniqueness, but you can use > "unique=True" to ensure > this.http://www.djangoproject.com/documentation/model-api/#unique --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: sudo under django or better solutions?
On Feb 1, 4:27 am, sandro dentella <[EMAIL PROTECTED]> wrote: > Hi, > > i'd like to make an application that should execute commands with > permission that are not normally for www-data (eg: create user). Of > course > I know I could use sudo and execute the command via subprocess or > similar. But it happens that the command is a python script so i'd > prefer > to use the python library directly. > > Is there any reccomanded way/ a sudo-module or similar? You could use daemon mode of mod_wsgi instead and configure it to have your whole application run as the target user rather than Apache, then you don't have to worry about it at all. FASTCGI solutions also generally allow the application to run as a different user to Apache as well. Graham --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: A slug question
> My question: what if I > have a weblog title that is identical to a post that I made 3 years > ago and I didn't realize it? when saving, is the slugfield smart > enough to acknowledge that there is a duplicate entry. The slug field itself doesn't force uniqueness, but you can use "unique=True" to ensure this. http://www.djangoproject.com/documentation/model-api/#unique --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: A slug question
Found this... http://www.djangosnippets.org/snippets/512/ On Jan 31, 1:50 pm, Chris <[EMAIL PROTECTED]> wrote: > I have a blog that has a slug field that gets pre-populated from the > title of the blog. I then use the slug name as a part of the url. eg > -www.xyz.com/weblog/weblog-title-goes-here/. My question: what if I > have a weblog title that is identical to a post that I made 3 years > ago and I didn't realize it? when saving, is the slugfield smart > enough to acknowledge that there is a duplicate entry. If so how would > it correct the problem (www.xyx.com/weblog/weblog-title-goes- > here-2/)? If no how do I correct that problem. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
A slug question
I have a blog that has a slug field that gets pre-populated from the title of the blog. I then use the slug name as a part of the url. eg - www.xyz.com/weblog/weblog-title-goes-here/. My question: what if I have a weblog title that is identical to a post that I made 3 years ago and I didn't realize it? when saving, is the slugfield smart enough to acknowledge that there is a duplicate entry. If so how would it correct the problem (www.xyx.com/weblog/weblog-title-goes- here-2/)? If no how do I correct that problem. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
trouble with mod_python configuration
I am trying to get a handle on how to configure django/reviewboard under mod_python. I want to setup reviewboard not in the root directory but a sub directory say /reviews/ I saw the comment: Note If you deploy Django at a subdirectory -- that is, somewhere deeper than "/" -- Django won't trim the URL prefix off of your URLpatterns. So if your Apache config looks like this: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On then all your URL patterns will need to start with "/mysite/". For this reason we usually recommend deploying Django at the root of your domain or virtual host. Alternatively, you can simply shift your URL configuration down one level by using a shim URLconf: urlpatterns = patterns('', (r'^mysite/', include('normal.root.urls')), ) in the DJango book (ch20) but I haven't seen any other reference to placing django apps deeper than '/' This is my first django setup so I can only hope I'm on the right path, anyway I have the following in my apache config: === SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings PythonPath "['/var/www', '/var/www/reviewboard' ] + sys.path" PythonDebug On === reviewboard.settings contains the line: ROOT_URLCONF = 'reviewboard.myurls' and reviewboard.myurls conatins: urlpatterns = patterns('', (r'^reviews/', include('urls')), ) which is how I interpreted the comment about a 'shim URLconf' from the book. Given the above config if I ask for http://10.64.9.131/reviews/ apache tells me: 'The requested URL /dashboard/ was not found on this server.' so the python handler is working but I have a problem with the shim URLconf or the 'REVIEWBOARD_ROOT' I am confident this setup it just one step away from bursting into life, if anyone can share a little experience I'd appreciate it... P. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Using send_mail seems slow
When trying to send email to one user it seems that the send_mail command takes about 6 seconds. Does anyone have any suggestions on how to improve the response time. Also, it seems consistent whether or not I use the development environment or my production web site. Thanks, Jeff --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie sqlite3 dbshell confusion
On Jan 31, 2008 2:27 PM, bobhaugen <[EMAIL PROTECTED]> wrote: > > Installed the latest Django package from the Synaptic package manager > on Ubuntu 7.10. I understand the Django version to be 0.96.1 (package > says 0.96-1ubuntu0.1). > > I'm on the first django tutorial: > http://www.djangoproject.com/documentation/tutorial01/ > > Got my sqlite database set up. Now trying to "run the command-line > client for your database". > > I understand the way to do that is $ python manage.py dbshell > > I get an error message saying "No such file or directory". > > Googling for this situation, I find http://code.djangoproject.com/ticket/6338 > Which says I need to Sqlite3. > > But I thought sqlite3 came along with Python 2.5. No? > > Any clues to what am I missing here? Need to install something else? What you have installed is the SQLite library and the Python bindings, both pieces come now included in Python 2.5 (if you were using an older Python version you would have to install Ubunto packages named libsqlite3 and python-sqlite3 or similar). But what dbshell does is to execute tue command line client for your backend (mysql for MySQL, etc,...) aleady configured to work with the database of your Django project, and for SQLite that command line client application is sqlite3 that in Debian/Ubuntu comes in the sqlite3 package: http://packages.ubuntu.com/cgi-bin/search_packages.pl?searchon=names&version=all&exact=1&keywords=sqlite3 Note the "A command line interface for SQLite 3" part. Install it using the package management tool of the distribution and try again. Regards, -- Ramiro Morales --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie sqlite3 dbshell confusion
On Jan 31, 10:38 am, Jeff Anderson <[EMAIL PROTECTED]> wrote: > The link you pasted assumes you are using the development version, which > has some differences. My personal recommendation is to remove 0.96 and > use django-svn. You are correct. I just tried some of the tutorial steps that determine if I have the latest version, and I don't. Followup question: I understand some adjustments were made to the ubuntu package to make it run better on ubuntu. Does anybody know what those are, and what I wd need to do to recreate them if I uninstalled 0.96.1 (which at least seems to work) and installed django-svn? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error Messages
The design pattern is a toaster popup. You can achive this using CSS + JavaScript, for example with jQuery. For example, you could use this CSS to hide your message area: .messages { position:absolute; z-index:5; top: -300px; left: 300px; width: 250px; margin: 0 auto; height:150px; padding: 10px; opacity:0; } This will position the box outside the screen area, you can then use jquery to detect if it's on screen, if a message has been passed to the view: function($) { $(document).ready(function() { $('.message').find(function(), { $(this).animate({top: 10, opacity: 1}, 1000, function() { $(this).animate({ top: -150, opacity: 0 }, 1000, function(){ $(this).remove(); }); }); }); }); })(jQuery); This will animate the message on the screen, and then remove it again, and then remove it from the DOM. Hope that helps On Jan 31, 2008 6:33 PM, jacoberg2 <[EMAIL PROTECTED]> wrote: > > Hey, > I was wondering if anyone had a neat way to take a list of errors > created in a template view and put it into an error box that would pop > up over the webpage should the user cause an issue. Any help would be > appreciated. Thanks for your time. > Jacob > > > -- Tane Piper Blog - http://digitalspaghetti.me.uk Wii: 4734 3486 7149 1830 This email is: [ ] blogable [ x ] ask first [ ] private --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error Messages
Well im using that API for an error message already, it doesn't create a new box, but it lists the error underneath the form. I am going to have long lists of names that i would like to display in an orderly fashion, and listing them in a box with the error message seems like the best method to me, I just dont know how to possibly combine the listof names with a javascript pop up box other some other type of box. On Jan 31, 1:40 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote: > Would the user messaging system work for you? > > http://www.djangoproject.com/documentation/authentication/#messages > > On Jan 31, 2008 12:33 PM, jacoberg2 <[EMAIL PROTECTED]> wrote: > > > > > Hey, > > I was wondering if anyone had a neat way to take a list of errors > > created in a template view and put it into an error box that would pop > > up over the webpage should the user cause an issue. Any help would be > > appreciated. Thanks for your time. > > Jacob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error Messages
Would the user messaging system work for you? http://www.djangoproject.com/documentation/authentication/#messages On Jan 31, 2008 12:33 PM, jacoberg2 <[EMAIL PROTECTED]> wrote: > > Hey, > I was wondering if anyone had a neat way to take a list of errors > created in a template view and put it into an error box that would pop > up over the webpage should the user cause an issue. Any help would be > appreciated. Thanks for your time. > Jacob > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Error Messages
Hey, I was wondering if anyone had a neat way to take a list of errors created in a template view and put it into an error box that would pop up over the webpage should the user cause an issue. Any help would be appreciated. Thanks for your time. Jacob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
sudo under django or better solutions?
Hi, i'd like to make an application that should execute commands with permission that are not normally for www-data (eg: create user). Of course I know I could use sudo and execute the command via subprocess or similar. But it happens that the command is a python script so i'd prefer to use the python library directly. Is there any reccomanded way/ a sudo-module or similar? thanks in advance sandro *:-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to attach multiple images to a blog post?
Hello, I'm trying to write simple blog tool but I ran into some problems. I would like to attach multiple images to a post. Here's my models: class Entry(models.Model): title = models.CharField(max_length=200) date = models.DateTimeField(auto_now=True) body = models.TextField() class Photo(models.Model): entry = models.ForeignKey(Entry, edit_inline=models.TABULAR, num_in_admin=10) photo = models.ImageField(upload_to='photos/%Y/%m/%d', core=True, blank=True) Now, when I create very new Entry via admin, I can add 10 images, ok. So I add some. Then, when I would like to add another ones or to change the ones already in, it goes wild: all the pictures are deleted and it is not even possible to add anything. Please, any help? I read somewhere that perhaps edit_inline is broken or something, is there another way how to attach multiple images to a post via admin? Thanks! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie sqlite3 dbshell confusion
Hello, An unrelated note to your question... If you are using 0.96, you need to use the 0.96 docs. http://www.djangoproject.com/documentation/0.96/ The link you pasted assumes you are using the development version, which has some differences. My personal recommendation is to remove 0.96 and use django-svn. Just thought I'd let you know! Jeff Anderson bobhaugen wrote: Installed the latest Django package from the Synaptic package manager on Ubuntu 7.10. I understand the Django version to be 0.96.1 (package says 0.96-1ubuntu0.1). I'm on the first django tutorial: http://www.djangoproject.com/documentation/tutorial01/ Got my sqlite database set up. Now trying to "run the command-line client for your database". I understand the way to do that is $ python manage.py dbshell I get an error message saying "No such file or directory". Googling for this situation, I find http://code.djangoproject.com/ticket/6338 Which says I need to Sqlite3. But I thought sqlite3 came along with Python 2.5. No? Any clues to what am I missing here? Need to install something else? Path problems? Generic newbiness? Thanks, Bob Haugen --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~--- signature.asc Description: OpenPGP digital signature
Re: Optimistic Locking
> Could you explain how this works, please? > > It looks - to my uneducated eyes - if this leaves open a potential race > condition where the mtime field could yet be changed in the database by > another process within the "decision time" of this method. Do I > misunderstand? It seems to me that this can only be reliably caught by > the database itself (probably using a rule or trigger). > > Thanks, > Michael t=time p=process t1 p1 read mtime t2 p2 read mtime t3 p2 write mtime t4 p1 write mtime AFAIK the database should raise an exception. Process1 does a 'dirty read': http://www.postgresql.org/docs/8.2/static/transaction-iso.html But you need to use transaction management. The read and write must be in one transaction. The edit form has hidden value which contains the current mtime of the model instance. If the form is valid, check if the mtime has not changed. If it changed, you need reload the form (All previous form input must be reset, otherwise the user can't see what the other person has changed). HTH, Thomas --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie sqlite3 dbshell confusion
Hello, > But I thought sqlite3 came along with Python 2.5. No? > > Any clues to what am I missing here? Need to install something else? > Path problems? > Generic newbiness? I don't think so. Anyway, it is as simple as installing package "sqlite3" on your Ubuntu. If it's already there, even better. You might also need the "python-sqlite2" package, which provide the Python bindings for SQLite 3 (yeah, the version numbers look confusing at first). I'm not sure how Django works with SQLite, but those are the steps I took when installing Trac (I use Django with MySQL). Shouldn't be much different, as both are written in Python. Hope it helps, Eduardo. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Any way to know if a value has changed before saving?
def save( self ): if self._get_pk_val(): old = MyModel.objects.get( pk = self._get_pk_val() ) if self.field != old.field: print "Values do not match" super( MyModel, self ).save() On 31 янв, 10:54, Julien <[EMAIL PROTECTED]> wrote: > Hi there, > > I'd like to override the save() method and within it I'd like to test > if a value has changed, that is, if that value as stored in the object > (in memory) is different from what is actually stored in database. > Something like: > > class A: > stuff = models.blabla > > def save(self): > if self.stuff != > magic_function_that_tells_what_is_in_database_for('stuff') > do_this() > super(A, self).save() > > Any idea? > > Thanks! > > Julien --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Newbie sqlite3 dbshell confusion
Installed the latest Django package from the Synaptic package manager on Ubuntu 7.10. I understand the Django version to be 0.96.1 (package says 0.96-1ubuntu0.1). I'm on the first django tutorial: http://www.djangoproject.com/documentation/tutorial01/ Got my sqlite database set up. Now trying to "run the command-line client for your database". I understand the way to do that is $ python manage.py dbshell I get an error message saying "No such file or directory". Googling for this situation, I find http://code.djangoproject.com/ticket/6338 Which says I need to Sqlite3. But I thought sqlite3 came along with Python 2.5. No? Any clues to what am I missing here? Need to install something else? Path problems? Generic newbiness? Thanks, Bob Haugen --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Order a ManyToManyField with form_for_instance
Hi django users, I have 2 db-classes: class Writer(models.Model): name = models.CharField(max_length=255, unique=True) class Admin: pass def __unicode__(self): return self.name class Book(models.Model): name = models.CharField(max_length=255, unique=True) writer = models.ManyToManyField(Game, related_name="rel_writer") # ManyToMany on my view i create a form like this: MyForm = form_for_instance(name, writer)) This works perfect for me, but the field writer (m2m) have no ordering, it looks like that the ordering is by ID or date. Is it possible to order the ManyToMany with form_for_instance by name? thank you all, regards michel. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: sort order
On 31 Jan, 16:52, "Jacob Kaplan-Moss" <[EMAIL PROTECTED]> wrote: > On 1/31/08, Nianbig <[EMAIL PROTECTED]> wrote: > > > I would like to add the functionality to be able to manually sort > > these objects in the Django-admin... I´ve tried doing this by just > > adding a integerfield... but it is not so user friendly... are there > > any built-in functions for this in Django ? > > Nothing built-in, though this is a common need and will likely get > added to the admin at some point in the future. > > In the meantime, you may want to check > outhttp://www.djangosnippets.org/snippets/568/-- it's a clever little > hack to expose an ordering field in the changelist view. I've not > tried it myself, but it looks like it'd work. Ok, thank you! /Nianbig --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Any way to know if a value has changed before saving?
> I'd like to override the save() method and within it I'd like to test > if a value has changed, that is, if that value as stored in the > object (in memory) is different from what is actually stored in > database. Another approach is using __getattr__ to monitor changes. It saves you a query, but it also makes it more likely that the actual database value might have changed in the meantime. Michael --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problems with Primary Key when I've copied a DB
Dear All, I've copied a MySQL db (using mysqldump) and then loaded it into a new DB. I've also altered the structure slightly (I've added 6 columns). However, the problem is that when I try and use the db to add more data, the primary key starts from 0 again. Since the number for the first current item is 1, the first item goes in ok, but the second gives me a key error. I've tried using the setting the table auto increment to a safe value using alter table_name AUTO_INCREMENT = 300 (there being 264 items in there already) but it doesn't work. I've also tried doing it with set last_increment_id = 300, and the db is happy, but django still counts from 0. Doing a direct insert in the DB (using mysql) works fine, and it auto_increments ok. It _seems_ as though Django is missing the fact that these keys already exist, which is why I get the clash. I'm using 0.96 (as I couldn't get the newer mysql module to compile). Any ideas? Thanks, Matt --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: sort order
On 1/31/08, Nianbig <[EMAIL PROTECTED]> wrote: > I would like to add the functionality to be able to manually sort > these objects in the Django-admin... I´ve tried doing this by just > adding a integerfield... but it is not so user friendly... are there > any built-in functions for this in Django ? Nothing built-in, though this is a common need and will likely get added to the admin at some point in the future. In the meantime, you may want to check out http://www.djangosnippets.org/snippets/568/ -- it's a clever little hack to expose an ordering field in the changelist view. I've not tried it myself, but it looks like it'd work. Jacob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
translation trouble: gettext-error
when typing "/bin/make-messages.py -l de" from within my app- directory, I get this error: errors happened while running xgettext on __init__.py /bin/sh: line 1: xgettext: command not found "which gettext" tells me that gettext is installed. any ideas? thanks, patrick --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on MacOS X Leopard
On Jan 31, 11:15 pm, Thomas <[EMAIL PROTECTED]> wrote: > I keep both django versions/branches and projects at the same level. > My directory structure looks like: > > django_gis > django_0.97-pre > etc ... > Project1 > Project2 > etc ... > > I symlink then an apropriate django version from within a project as > "django". This allows me flexibility in both switching python and/or > django versions. > > Not sure if this is the best way to do it. > > Regards, Thomas > > On Jan 31, 4:05 pm, omat <[EMAIL PROTECTED]> wrote: > > > When I install Django on Leopard, py files went into: > > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > > site-packages/django/ > > > And template htmls, etc. went into: > > /Library/Python/2.5/site-packages/django/ > > > This resulted in some weird behavior such as templates of contrib > > applications such as admin not being located. > > > My patch for this was to create a symlink as follows: > > sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/ > > lib/python2.5/site-packages /Library/Python/2.5/site-packages > > > and then install Django. > > > Thought this may save some time for ones having this problem. > > > I would like to hear if there are any better approaches. > > > oMat I keep all the Django files under /Library/Python/2.5/site-packages/, admin templates and code and everything, and that's never given me any trouble. Static content I serve from the built-in Apache, symlinking to the admin static stuff in the django package, and then my actual projects live in various places in my home directory. Running the development server out of those project directories works perfectly. It seems simple enough, though I had a bear of a time getting everything working at first, can't quite remember why, now... Eric --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Simultaneous edits
Thomas Guettler wrote: > Am Mittwoch, 30. Januar 2008 16:18 schrieb Michael Hipp: >> Does Django have any built-in way to handle or prevent simultaneous, >> incompatible edits to a database record? > > > Some days ago there was a thread about optimistic locking: > I wrote an second answer some minutes ago. > > http://groups.google.com/group/django-users/browse_thread/thread/e9db1349014aa1f4 Thank you. I'm moving my questions to that thread. Michael --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Optimistic Locking
Thomas Guettler wrote: > Am Donnerstag, 24. Januar 2008 13:08 schrieb Tim Sawyer: >> Hi Folks, >> >> I'm just evaluating django for use on a project. I have a multiuser >> application where many users can be changing data at once. >> >> What's the status of hibernate style optimistic locking, where each object >> has a version and update/deletes are prevented if the last saved version of >> that object is newer than the one being saved? > > Hi, > > I use this solution: > > The model class has an field mtime which get's updated automatically: > > class MyObject(models.Model): > mtime=models.DateTimeField(verbose_name=u'Letzte Änderung am', >editable=False, auto_now=True) > > > def mtime_has_changed(self, request): > mtime=request.POST['mtime'] > mtime=datetime.datetime(*[int(i) for i in re.findall(r'[\d]+', > mtime)]) > return self.mtime!=mtime Could you explain how this works, please? It looks - to my uneducated eyes - if this leaves open a potential race condition where the mtime field could yet be changed in the database by another process within the "decision time" of this method. Do I misunderstand? It seems to me that this can only be reliably caught by the database itself (probably using a rule or trigger). Thanks, Michael --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on MacOS X Leopard
I keep both django versions/branches and projects at the same level. My directory structure looks like: django_gis django_0.97-pre etc ... Project1 Project2 etc ... I symlink then an apropriate django version from within a project as "django". This allows me flexibility in both switching python and/or django versions. Not sure if this is the best way to do it. Regards, Thomas On Jan 31, 4:05 pm, omat <[EMAIL PROTECTED]> wrote: > When I install Django on Leopard, py files went into: > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > site-packages/django/ > > And template htmls, etc. went into: > /Library/Python/2.5/site-packages/django/ > > This resulted in some weird behavior such as templates of contrib > applications such as admin not being located. > > My patch for this was to create a symlink as follows: > sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/site-packages /Library/Python/2.5/site-packages > > and then install Django. > > Thought this may save some time for ones having this problem. > > I would like to hear if there are any better approaches. > > oMat --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django on MacOS X Leopard
When I install Django on Leopard, py files went into: /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ site-packages/django/ And template htmls, etc. went into: /Library/Python/2.5/site-packages/django/ This resulted in some weird behavior such as templates of contrib applications such as admin not being located. My patch for this was to create a symlink as follows: sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/ lib/python2.5/site-packages /Library/Python/2.5/site-packages and then install Django. Thought this may save some time for ones having this problem. I would like to hear if there are any better approaches. oMat --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trying to dynamically generate labels in newforms
> Use fields instead of base_fields : > > 1. > class TestForm(forms.Form): > def __init__(self, *args, **kwargs): > super(ArrivalForm, self).__init__(*args, **kwargs) > self.fields['somefield'].label = 'foo' > > somefield = forms.IntegerField() Yells "d'oh!" and slaps forehead. Thanks! -- Kirk Strauser signature.asc Description: This is a digitally signed message part.
sort order
I have a simple model like this: class Events( models.Model ): fname = models.CharField( maxlength=100, verbose_name='Firstname' ) lname = models.CharField( maxlength=100, verbose_name='Lastname' ) I would like to add the functionality to be able to manually sort these objects in the Django-admin... I´ve tried doing this by just adding a integerfield... but it is not so user friendly... are there any built-in functions for this in Django ? Thanks in advance! /Nianbig --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
SPEEDO -pełna oferta
co sądzicie, czy te http://sporthit.pl/-c-154_162.html"; target="_blank">stroje kąpielowe, okularki pływackie, czepki pływackie, kąpielówki, stroje pływackie są dobre? jeśli tak to dlaczego. Czy warto jest wydać tyle kasy na nie? jednocześnie chciałem się dowiedzieć co sądzicie o firmie Wilson czy http://sporthit.pl/-c-144.html"; target="_blank">rakieta do tenisa, rakiety do tenisa, torby tenisowe, piłki tenisowe, buty do tenisa są dobrze zrobione? chciałbym sobie zakupić http://sporthit.pl/-c-208_209.html"; target="_blank">rakiety do squasha, rakieta do squasha --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Decimal separator
Mauro, On Jan 31, 2008 10:23 AM, Mauro Sánchez <[EMAIL PROTECTED]> wrote: > > Hello. > How can I establish the comma ',' as the decimal separator? > Is there any config file where I should set it up? > Thanks. You can try with the decimalfmt filter of Christopher Lenz's [1]Babel [2]Django plugin that includes template filters and a context processor. You can find additional information at: http://www.cmlenz.net/archives/2007/09/djangobabel-integration#more Regards, -- Ramiro Morales 1. http://babel.edgewall.org/ 2. http://babel.edgewall.org/wiki/BabelDjango --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Decimal separator
Mauro Sánchez wrote: > Hello. > How can I establish the comma ',' as the decimal separator? > Is there any config file where I should set it up? > Thanks. > Mauro. > > > > > You should look at the locale configuration ARIEL --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trying to dynamically generate labels in newforms
> Yes, but I won't know the value of 'foo' until runtime. There's no > other way to set it? I don't want to hardcode a bunch of entries like > "self.somefield = whatever" in __init__, either, because I'm trying to > consolidate a bunch of ad-hoc code into a single inheritable class. Use fields instead of base_fields : 1. class TestForm(forms.Form): def __init__(self, *args, **kwargs): super(ArrivalForm, self).__init__(*args, **kwargs) self.fields['somefield'].label = 'foo' somefield = forms.IntegerField() 2. class TestForm(forms.Form): def __init__(self, *args, **kwargs): super(ArrivalForm, self).__init__(*args, **kwargs) self.fields['somefield'] = forms.IntegerField(label = 'foo') ArrivalForm in 'super' should be TestForm second is better eg. if you're using i18n and defining a form and views in one file. Because if you use: ugettext as _ this will work in __init__ but not for a class attribute. Using ugettext_lazy will work with field defined as a class attribute but may break some other code in views. -- Maciej Wisniowski --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Decimal separator
Hello. How can I establish the comma ',' as the decimal separator? Is there any config file where I should set it up? Thanks. Mauro. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How can I parse and process the contents of an URL?
Thank you all! Indeed, it was because I was using Django's internal server (runserver). When I tried any other url, it worked. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: *Idea-Share* How to secure auth
On Jan 31, 2008 2:49 PM, Steven Armstrong <[EMAIL PROTECTED]> wrote: > > Maybe something like this in your apache config? > > RedirectMatch permanent /(login|securepage) https://www.example.com/$1/ > > One idea is to redirect user login to HTTPS in same django apps but in different apache virtual than HTTP (80). This way two django instances would be running, that is why I don't want to use that method. Another thing is, i am not sure, but sessions will not be same for user in django when a user logins in HTTPS(443) and apps would not be able to use that session to recognize user on http(80). I would check the session implememtation in Django, if PORT number too is considered in generating session-id. Is there any thing, like initiating the SSL just for login on port 80 than changing it. -=Ravi=- --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: *Idea-Share* How to secure auth
Ravi Kumar wrote on 01/31/08 06:45: > Hi, > I have developed a Django project with 3 apps. Now, I have to implement > authentication for 2 apps, while one app will be public without any > authentication. > But I don't want to run two virtual servers with HTTP and HTTPS differently. > The condition is, when a page requiring authentication, it should forward to > Login page with very secure implementation (quite afraid of wire sniffer > dogs in my network). I should have used HTTPS but i already put the problem. > How how can I proceed? Can i have SSL/HTTPS just for login authentication > anyway, else all other page just check user is_authenticated and serves the > pages on plain. > Maybe, If i could not make the question clear, please let me know, I will > revise it. Maybe something like this in your apache config? RedirectMatch permanent /(login|securepage) https://www.example.com/$1/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Iterating over very large queryset
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I've had pretty good results with SQLAlchemy on large datasets, that might be a painless way to solve the problem.. Ben Jarek Zgoda wrote: > Jacob Kaplan-Moss napisał(a): > Can you share any hints on how to reduce the memory usage in such situation? The underlying database structure is rather complicated and I would like to not do all queries manually. >>> At this level -- hundreds of thousands of objects per query -- I doubt >>> that any ORM solution is going to deliver decent performance. >> That may be true, but in this case it's actually a bug in Django: >> under some (many?) circumstances QuerySets load the entire result set >> into memory even when used with an iterator. The good news is that >> this has been fixed; the bad news is that the fix is on the >> queryset-refactor branch, which likely won't merge to trunk for at >> least a few more weeks, if not longer. Also note that values() won't >> really help you, either: the overhead for a model instance isn't all >> that big; the problem you're running into is simply the shear number >> of results. >> >> In your situation, I'd do one of two things: either switch to the qsrf >> branch if you're a living-on-the-edge kind of guy, or else look into >> using an ObjectPaginator to churn through results in chunks. > > Ah, thanks. The application is in production state, so I cann't use any > other Django version we have installed on the machines. I'll try with > ObjectPaginator, leaving raw SQL as last resort. Thank you all for the > hints. > -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHoYwWLxxSB2Q99Z0RArl/AJ9zVgBoSh1vB1WOpNW/GUX2LtB2UwCbB1w5 V2+Q2xpUuQ50fAVUMHf6Uh8= =Z6Dq -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Simultaneous edits
Am Mittwoch, 30. Januar 2008 16:18 schrieb Michael Hipp: > Does Django have any built-in way to handle or prevent simultaneous, > incompatible edits to a database record? Some days ago there was a thread about optimistic locking: I wrote an second answer some minutes ago. http://groups.google.com/group/django-users/browse_thread/thread/e9db1349014aa1f4 --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Optimistic Locking
Am Montag, 28. Januar 2008 10:16 schrieb Alistair Lattimore: > Thomas, > > Do you use a custom manager to select out the row before issuing the > save to make sure that the in memory timestamp matches that of the > database? > No, since I don't use caching the mtime should be 'fresh'. Since I use one transaction for one request, I should get a database error, if the mtime was changed during reading and writing it back. I have not tested this, but I think it should be like that. Thomas --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Any way to know if a value has changed before saving?
Yep, I should have thought of that. Cheers! On Jan 31, 7:13 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > def save(self): > > if self.stuff != > > magic_function_that_tells_what_is_in_database_for('stuff') > > do_this() > > super(A, self).save() > > This 'magic function' is > self.__class__.objects.get(id=self.id).stuff > > if self.stuff != self.__class__.objects.get(id=self.id).stuff: > do_this() --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Iterating over very large queryset
Jacob Kaplan-Moss napisał(a): >>> Can you share any hints on how to reduce the memory usage in such >>> situation? The underlying database structure is rather complicated and I >>> would like to not do all queries manually. >> At this level -- hundreds of thousands of objects per query -- I doubt >> that any ORM solution is going to deliver decent performance. > > That may be true, but in this case it's actually a bug in Django: > under some (many?) circumstances QuerySets load the entire result set > into memory even when used with an iterator. The good news is that > this has been fixed; the bad news is that the fix is on the > queryset-refactor branch, which likely won't merge to trunk for at > least a few more weeks, if not longer. Also note that values() won't > really help you, either: the overhead for a model instance isn't all > that big; the problem you're running into is simply the shear number > of results. > > In your situation, I'd do one of two things: either switch to the qsrf > branch if you're a living-on-the-edge kind of guy, or else look into > using an ObjectPaginator to churn through results in chunks. Ah, thanks. The application is in production state, so I cann't use any other Django version we have installed on the machines. I'll try with ObjectPaginator, leaving raw SQL as last resort. Thank you all for the hints. -- Jarek Zgoda Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 "We read Knuth so you don't have to." (Tim Peters) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Any way to know if a value has changed before saving?
> def save(self): > if self.stuff != > magic_function_that_tells_what_is_in_database_for('stuff') > do_this() > super(A, self).save() This 'magic function' is self.__class__.objects.get(id=self.id).stuff if self.stuff != self.__class__.objects.get(id=self.id).stuff: do_this() --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---