Re: uber weird access problem from windows
On Sat, May 21, 2011 at 10:37 AM, Kenneth Gonsalves wrote: > > The form is no different from any other form - in fact it is cut and > pasted from another form which works perfectly. Has anyone faced a > problem like this? Any clues on how to diagnose? > Clear cache and try. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
uber weird access problem from windows
hi, I have a django app running on a lan. The server is linux and setup is apache/mod_wsgi. There are windows and linux clients that access the app and also the app is accessible from the server itself. Everything works fine from the client machines and from the server, except one form. In this form, from the windows machine, on clicking submit nothing happens. Apache logs show no click. When the same person logs in to the server machine, that form works. The windows machine has firefox on it. The form is no different from any other form - in fact it is cut and pasted from another form which works perfectly. Has anyone faced a problem like this? Any clues on how to diagnose? -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
failing to pass model objects to template for some reason....
I have a model class called Message with an attribute called text. ** When I pass a list of these objects called messages to my template, it doesn't show up. ** When I instead create this derivative called fred, that *does* work... fred = [e.text for e in messages] Why would fred work fine in template but not messages? Here is my template code for messages that doesn't show anything on page.. {% for e in messages %} {{e.date}}: {{e.text}} {% endfor %} Here is the fred code that does work.. {% for e in fred %} {{e}} {% endfor %} cs -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: weird error with MS Excel 2010 exports
hi gabe - response = render_to_response('reports/trackingdump.html',{'trs':trs,}) filename='trackingdump.xls' response['Content-Disposition'] = 'attachment; filename=' + filename response['Content-Type'] = 'application/vnd.ms-excel; charset=utf-8' that's how we're dumping it to excel... it works fine in open office and non ms 2010 versions of excel. On 05/20/2011 08:17 PM, Gabriel Gunderson wrote: On Thu, May 19, 2011 at 1:44 PM, Bobby Roberts wrote: hi. Regardless of how we try to export from a view into an excel file, we get a weird msgbox reading: "The file you are trying to open, 'filenamehere.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before openin gthe file. Do you want to open the file now?" YES NO HELP" What are you doing with your mime types? Gabe -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Update a user profile after LInkedin Oauth
I am trying to update a user profile of an existing user with a LinkedIn profile. My problem is I need an email address, but LinkedIn does not give you that information. So I have a user create an account with their email address and ask if they want to link their profile to their LinkedIn profile. The problem is that the way Oauth works is that it uses a call back and there is no way to link the user who initiated the Oauth call to the call back coming from LinkedIn. If you look at the request.user its Anonymous. Does anyone have an idea how to get around 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: weird error with MS Excel 2010 exports
On Thu, May 19, 2011 at 1:44 PM, Bobby Roberts wrote: > hi. Regardless of how we try to export from a view into an excel > file, we get a weird msgbox reading: > > "The file you are trying to open, 'filenamehere.xls', is in a > different format than specified by the file extension. Verify that > the file is not corrupted and is from a trusted source before openin > gthe file. Do you want to open the file now?" YES NO HELP" What are you doing with your mime types? Gabe -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
Agree, Komodo is the best source editor on the planet. I recently started writing macros (in python) for Komodo; and it's so powerful; you can also create a simple shell command pass filename (being edited) as %F, also user input as %ask. On May 20, 3:19 pm, W Craig Trader wrote: > On 05/20/2011 05:54 AM, BobX wrote: > > > Pretty obvious question, but is there any recommended HTML editor that > > won't munch the Django template codes? I was using Amaya to form my > > pages, but after a couple of what-the-heck moments, I discovered that > > it sporadically "eats" the template codes - ones in table definitions > > being particularly vulnerable. > > > Notepad2 is very usable - but unfortunately that's just syntax > > highlighting the raw HTML codes. So at the moment I'm generating the > > templates with Amaya and then switching to Notepad2 once the template > > codes are added. > > > I've also got SeaMonkey but haven't had a chance to try it yet. > > Platforms I've got available are Linux or Windows. > > > Thanks. Bob. > > The Aptana packaging of Eclipse for Python Development includes an HTML > editor that is Django-aware. > > - Craig - -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
On 05/20/2011 05:54 AM, BobX wrote: Pretty obvious question, but is there any recommended HTML editor that won't munch the Django template codes? I was using Amaya to form my pages, but after a couple of what-the-heck moments, I discovered that it sporadically "eats" the template codes - ones in table definitions being particularly vulnerable. Notepad2 is very usable - but unfortunately that's just syntax highlighting the raw HTML codes. So at the moment I'm generating the templates with Amaya and then switching to Notepad2 once the template codes are added. I've also got SeaMonkey but haven't had a chance to try it yet. Platforms I've got available are Linux or Windows. Thanks. Bob. The Aptana packaging of Eclipse for Python Development includes an HTML editor that is Django-aware. - Craig - -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: multiple instances of form (with distinctive identifiction) on same page?
http://docs.djangoproject.com/en/1.3/topics/forms/formsets/ There you go. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
multiple instances of form (with distinctive identifiction) on same page?
hi there, first poster and django beginner here.. I've been unsuccessfully looking for an answer to this for a while now, so I'm finally posting it myself. I'm writing an app that allows users to place bets on soccer matches. several matches are listed on the same site consisting each of two opposing teams and a form (basically two fields to enter score) to place a bet. this is where I ran into issues. I need multiple instances of the same form on one page that can be distinctively identified. 1st attempt: I just pass my form from the view and let the template render multiple instances using a for-loop. Problem: The forms lack a unique identifier. > not a problem when saving since I am passing the match id in a hidden field. > but if validation errors occur it sends them back to the respective field of > all forms instead of just the one where an error happened. 2nd attempt: using 'prefix', I create a form for each match with its own prefix in the view and collect them in a list to pass to the template. Problem: In the template I cannot iterate over the list items using a variable but have to use the explicit index numbers which I want to avoid since the number of forms needed may vary. any suggestions on how I could approach this? really appreciate all feedback, thanks in advance. pascal -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
On Fri, May 20, 2011 at 07:51:06AM -0400, Brian Bouterse wrote: > +1 for vim I'll second that motion. I've tried numerous other editors and keep sticking with vim for almost everything. I do use emacs for my e-mail editor, with Mutt as my mail client. -- Kevin http://www.RawFedDogs.net http://www.WacoAgilityGroup.org Bruceville, TX What's the definition of a legacy system? One that works! Errare humanum est, ignoscere caninum. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
+1 on Komodo Edit (I use the free one for almost all of my coding). I don't know exactly to what extent it handles Django template tags in HTML, but it's never tripped me up, which is something, anyway. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
Use Komodo Edit. It's free and it is the best source code editor on the planet. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: learning Django after a break -- site tutorials, examples
On 05/20/2011 04:38 AM, BobX wrote: The top page question . . . the_simplest_ option (from my experience) is to generate a small stub routine that has index.html as a template and use render_to_response to shoot that out when the user goes to URL http//mysite/ (or whatever you want). Just because you're using index.html as a template doesn't mean that it needs to contain anything other than normal HTML. The site I'm developing at the moment has "dummy" placeholders that do exactly that, so I know it works. On 05/19/2011 11:41 PM, Mike Dewhirst wrote: > Creating a "home" page is fairly simple. In urls.py you need to recognise a "non-link" which just means www.mydomain.com/ all by > itself and make that call a view which renders the particular template which you want displayed. Thanks! Very helpful, John Griessen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: (extendable) social network plugin
Excerpts from Leon van der Ree's message of Fri May 20 11:21:15 -0300 2011: > Hi all, Hi, > First a short intro, since this is my first post > > Last few years I have been working on and with Symfony (Php) a lot, > but since I am done with the ugly bugs within Php I decided to switch > to another development environment. I have always been interested in > other languages and frameworks and Python and Django always looked > very promising to me. Now that I have a new job I was able to make > this switch so I dived into Python and Django. I think I now have a > basic understanding of how to optimally use the dynamic capabilities > of Python (something that you can't properly meke use of in Php if you > ask me) and I understand the design of Django. Untill now all seems > brilliant! Welcome! > My first assignment in Django is to develop a social-media powered > website, so I started to explore the community plugins but now got a > bit disappointed. I haven't found anything that is capable to handle > several different social networks. Am I missing something or isn't it > there yet? > > So far I found several social-authorization applications, but most of > them where tightly coupled with the social networks they can handle so > there is no easy way of adding different networks from outside the > application (by E.G. adding an extra application for another network > and provide it to the generic-app through your project > configuration). > Other social media plugins that I found are capable of doing more than > only authorization, but are build specifically for one social network. > Django is so nicely organised, and capable of being extended with all > kind of functionality, so I would have expect social-media apps that > where designed this way as well? You might have found http://github.com/omab/django-social-auth/ already, as you can see it's easy to extend adding more and more authentication backends, they can be on a separated module even. But, it only take care of authentication, that's because there are plenty of projects that handle user data retrieval and each project have different needs. And I prefer the do-one-single-thing principle. Anyway It's easy to extend using the defined signals, there you can easily retrieve user data from the different social-media sites. > My idea of a social media application is that it should be extendable > and capable of doing more than only handling authorisation. Depending > on the social network you have more or less functionality that can be > used. E.G. Facebook and Twitter both support posting messages, but > only Facebook supports liking things. But you have thinkgs like Orkut > (and in Holland Hyves) as well, which could make use of the same > generic interface to support like-ing and sending messages, while > others, like e.g. gmail only support authorisation. This could be a interesting side project, but it should do only that, no more IMO. > I think there can be a generic interface with functionality and > specialised classes per social network that implement this > functionality. Than in your project settings you should be able to > simply (configure and) enable these networrks.These specialised > classes for all the different networks can be provided in different > apps, so anyone can build new connections without modifying the > generic social-app. In these specialised apps you can choose how to > implement the connection to the network yourself (use the entire > python facebook library, or write a custom facebook authroisation > module yourself). I think a good base for this is the implementation > of django-allauth although it currently has some hardcoded > configuration (urls, templatetags, etc) and is limited to only > authorisation. > > Any feedback about this would be greatly appreciated! > Leon Thanks, Matías -- Matías Aguirre -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Problem reversing urls when calling templates from another project
ok ... still struggling. While in Public_site.views I can call functions from within the Extranet_site.views ... but I can't even do a: return HttpResponseRedirect(reverse('Extranet_site.application_name.views.function_name', args=(999,))) Within my Public_site.settings I have installed Extranet_site.application_name ... I have also appended the Extranet_site to the sys.path so what have I forgotten? Gaaah! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
I am not affiliated with them, but I find Wing IDE to work extremely well. William On Fri, May 20, 2011 at 11:28 AM, Graeck wrote: > http://e-texteditor.com/ > > And use TextMate's Django bundle. > > More info: http://code.djangoproject.com/wiki/TextMate > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
http://e-texteditor.com/ And use TextMate's Django bundle. More info: http://code.djangoproject.com/wiki/TextMate -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Problem reversing urls when calling templates from another project
@Shawn Cheers. I'm such a c*ck. I am so used to using named URL patterns that I just assumed that that was how you did it. So yes, I've had a look at the documentation, although still struggling to get it to find the reverse, even when using the full path. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to model multi-customer app (each needing own administrative access)
On Fri, May 20, 2011 at 7:55 AM, Michael Giarlo wrote: > I suspect we would go with #3 definitely #3. it's called multi-tenancy, and it's a mess to add to an existing application, much better to design from the start. for the most part, it means most of your tables will need a 'tenant' foreign key. I usually also add a decorator that adds the tenant to the request object (much like the @login_required and friends set request.user), and most of the queries inside the views start like request.tenant.book_set.filter. instead of the usual Book.objects.filter. google around for multitenancy, you'll find lots of similar cases. the most repeated discussion is if you should use one DB per tenant, or a single DB for everybody. some people argue that a DB per tenant provides some 'poor man sharding'; but most conclude that the most scalable way is a single DB for everybody. -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
On Fri, May 20, 2011 at 4:54 AM, BobX wrote: > Platforms I've got available are Linux or Windows. Kate does it. and hence, _every_ KDE application -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Problem reversing urls when calling templates from another project
Does this help? http://docs.djangoproject.com/en/1.3/topics/http/urls/#topics-http-reversing-url-namespaces I found it here (where a usage example is given): http://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
(extendable) social network plugin
Hi all, First a short intro, since this is my first post Last few years I have been working on and with Symfony (Php) a lot, but since I am done with the ugly bugs within Php I decided to switch to another development environment. I have always been interested in other languages and frameworks and Python and Django always looked very promising to me. Now that I have a new job I was able to make this switch so I dived into Python and Django. I think I now have a basic understanding of how to optimally use the dynamic capabilities of Python (something that you can't properly meke use of in Php if you ask me) and I understand the design of Django. Untill now all seems brilliant! My first assignment in Django is to develop a social-media powered website, so I started to explore the community plugins but now got a bit disappointed. I haven't found anything that is capable to handle several different social networks. Am I missing something or isn't it there yet? So far I found several social-authorization applications, but most of them where tightly coupled with the social networks they can handle so there is no easy way of adding different networks from outside the application (by E.G. adding an extra application for another network and provide it to the generic-app through your project configuration). Other social media plugins that I found are capable of doing more than only authorization, but are build specifically for one social network. Django is so nicely organised, and capable of being extended with all kind of functionality, so I would have expect social-media apps that where designed this way as well? My idea of a social media application is that it should be extendable and capable of doing more than only handling authorisation. Depending on the social network you have more or less functionality that can be used. E.G. Facebook and Twitter both support posting messages, but only Facebook supports liking things. But you have thinkgs like Orkut (and in Holland Hyves) as well, which could make use of the same generic interface to support like-ing and sending messages, while others, like e.g. gmail only support authorisation. I think there can be a generic interface with functionality and specialised classes per social network that implement this functionality. Than in your project settings you should be able to simply (configure and) enable these networrks.These specialised classes for all the different networks can be provided in different apps, so anyone can build new connections without modifying the generic social-app. In these specialised apps you can choose how to implement the connection to the network yourself (use the entire python facebook library, or write a custom facebook authroisation module yourself). I think a good base for this is the implementation of django-allauth although it currently has some hardcoded configuration (urls, templatetags, etc) and is limited to only authorisation. Any feedback about this would be greatly appreciated! Leon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Problem reversing urls when calling templates from another project
I have two projects that work together. Lets call them Extranet_site and Public_site. Most of the functionality was developed for Extranet_site, but we wanted to capture requests from the public, so we set up Public_site and then just attached to some of the functionality in Extranet_site. A scenario would be that : 1. Someone creates a request on the Extranet_site or via the Public_site 2. This then gets processed using the code within Extranet_site, regardless of where the request came from. 3. An email gets sent to the relevant field manager to deal with it. The email templates are stored in Extranet_site, in the same place that the processing code it. However, the requests that come via the Public_site break the template URL lookups, because they are looking at the Public_site URLs.py rather than the Extranet_site URLs.py. What is the best way for dealing with situations like these? I could just hard code the templates with the url. Some other solution? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to model multi-customer app (each needing own administrative access)
Hi, My department has two customers who have identical needs, currently served by separate applications. They both need an app w/ a public side and an administrative side, and we had hoped to make use of the built-in Django admin interface for the latter. We're wondering how to model this in the most Django-ish way. Here are some of the options we've considered and the challenges each raises. 1. Two separate Django projects -- this is the situation we're already in, though the app we are using currently is outdated and unmanageable. This setup "works" for our customers but since the codebases are separate, it can be a pain to ensure each has the same functionality available as the other. Additionally, we would like to add more customers eventually who have similar needs, and we're looking for a more lightweight way to add them than to bring up an entirely new stack, if possible. 2. One Django project w/ two apps (one per customer) -- the question about this setup is how to have identical models (and views and forms, etc.) for each app (without relying on a crude hack, e.g. symlinks). For the heck of it, I tried maintaining the models in a separate file and giving each app a models.py containing one line importing the separate models module, but this confuses south and syncdb since there are no actual model declarations in each app. 3. One Django project w/ one app -- this setup would work if we could roll out row-level permissions for the built-in admin interface. The approaches we've found via the googles for row-level perms, though, feel more like hacks than best practices and, again, we want to model this in the most Djangoish way. I'm sure there are other options. I suspect we would go with #3, disabling the built-in administrative interface, and building a couple of AdminSites (one per customer). Your thoughts? Are there any best practices here? Much obliged, -Mike -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to save image in postgreSQL database
On Fri, May 20, 2011 at 3:00 AM, ramnivas indani wrote: > ok but how can i achieve it in Django means how can i store images in > Django python using URI Read Django documentation (it is part of studying in college): * http://docs.djangoproject.com/en/1.3/topics/http/file-uploads/ * http://docs.djangoproject.com/en/1.3/ref/models/fields/#filefield * http://docs.djangoproject.com/en/1.3/ref/models/fields/#imagefield -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Json serialization for use in JS
> > class Serializer(PythonSerializer): > def end_object(self, obj): > self.objects.append({ > "fields" : self._current > }) > self._current = None > > I've made a small mistake I was importing PythonSerializer while It should've been JsonSerializer Corrected code bellow: from django.core.serializers.json import Serializer as JsonSerializer class Serializer(JsonSerializer): def end_object(self, obj): self.objects.append({ "fields" : self._current }) self._current = None -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Json serialization for use in JS
> > Your idea of overriding the Serializer class sounds like a better idea to me. > It should be possible (and will be interesting) ,I'll think I'll look into > that tonight. Overwriting django's default serializers is possible. This is how I've done it: In the root of my django project: mkdir serializers touch serializers/__init__.py create serializers/json.py and add the following (I've just removed the pk and model fields which I don't like , but can of course be modified to your liking) from django.core.serializers.python import Serializer as PythonSerializer class Serializer(PythonSerializer): def end_object(self, obj): self.objects.append({ "fields" : self._current }) self._current = None I've only tested this interactively but it seems to work In [15]: from serializers.json import Serializer as JsonSerializer In [16]: json_serializer = JsonSerializer() In [17]: json_serializer.serialize(Item.objects.all()) Out[17]: [{'fields': {'name': u'foobar'}}] -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
On Fri, 2011-05-20 at 07:51 -0400, Brian Bouterse wrote: > +1 for vim I am trying out emacs - is pretty good for both python and django. -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
+1 for vim On Fri, May 20, 2011 at 6:51 AM, Tom Evans wrote: > On Fri, May 20, 2011 at 10:54 AM, BobX wrote: > > Pretty obvious question, but is there any recommended HTML editor that > > won't munch the Django template codes? I was using Amaya to form my > > pages, but after a couple of what-the-heck moments, I discovered that > > it sporadically "eats" the template codes - ones in table definitions > > being particularly vulnerable. > > > > Notepad2 is very usable - but unfortunately that's just syntax > > highlighting the raw HTML codes. So at the moment I'm generating the > > templates with Amaya and then switching to Notepad2 once the template > > codes are added. > > > > I've also got SeaMonkey but haven't had a chance to try it yet. > > Platforms I've got available are Linux or Windows. > > > > Thanks. Bob. > > > > vim foo.html "+set ft=htmldjango" > > Cheers > > Tom > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Brian Bouterse ITng Services -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: [help]django's FloatField can't insert the mysql's double type data.
OK,Thank you for your reply. I have resolved this problem, That a fileld name in my models.py is "save" resulting this problem. But I don't know why. the "save" can't be used as the filed name? because it's not within Python keywords and just be a method name in django. I 'll keep it in mind. Thanks to all. 2011/5/20 Karen Tracey > The error is occurring on the same line of code as it was before, only now > it's reporting that a decimal isn't callable where before it was saying that > a float isn't callable. So whatever was causing that problem is still > afflicting the project, changing float to decimal didn't fix that. I don't > know what it is because I don't recall anyone reporting this kind of error > before and all you've posted of your code is your model and model admin > definitions. If you take just those definitions and cut-and-paste them into > a new project, they work fine. So I suspect there is something beyond what > you have posted that is causing this. > > I'd start with what I just said: take that code you posted and verify that > if you cut-and-paste it into a new test project, it works. Then start adding > bits from the project you have that shows the weird error and see when it > breaks. If it isn't immediately obvious then why that newly-added bit causes > the error, if you post the code in question here someone will likely be able > to help with the why of it. > > > Karen > -- > http://tracey.org/kmt/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- "OpenBookProject"-开放图书计划邮件列表 详情: http://groups.google.com/group/OpenBookProject 维基: http://wiki.woodpecker.org.cn/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: session handling
On Fri, May 20, 2011 at 12:56 AM, man_kum wrote: > Hello , > > I am new to Django and trying to handle signin/ signout request > according to following documentation > > http://docs.djangoproject.com/en/1.3/topics/auth/#how-to-log-a-user-in > > > I am using fiddler tool on windows for testing the get/post requests > > > Problem : > when I make a post request with username and password to > http://localhost:8000/signin/ > I am getting a row in mysql django_session table. > > when I make a POST request to http://localhost:8000/signout/ > I am again getting a row in mysql django_session table. where i > suppose it should delete my earlier row in database. > Your supposition is incorrect. When you log out, your session id is cycled, so that you get a new session id, and hence new session. Django will not remove the old session until it's expiry date is reached _and_ you run the admin command cleanup. All of this is documented: Logout flushes the session: http://docs.djangoproject.com/en/1.3/topics/auth/#django.contrib.auth.logout Flushing session cycles the session key: http://docs.djangoproject.com/en/1.3/topics/http/sessions/#django.contrib.sessions.backends.base.SessionBase.flush Django doesn't auto clean session table http://docs.djangoproject.com/en/1.3/topics/http/sessions/#clearing-the-session-table Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to get hold of the failed db query
I am running a site using Django 1.2.5 and postgres. I just upgraded Django and Django CMS to their latest versions using South. And now I get a MOD_PYTHON error. Here is an excerpt: MOD_PYTHON ERROR (...) File "/home/wsc2/lib/Django-1.2.5/django/db/backends/__init__.py", line 56, in _savepoint self.cursor().execute(self.ops.savepoint_create_sql(sid)) File "/home/wsc2/lib/Django-1.2.5/django/db/backends/util.py", line 15, in execute return self.cursor.execute(sql, params) File "/home/wsc2/lib/Django-1.2.5/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) DatabaseError: current transaction is aborted, commands ignored until end of transaction block >From what I have read about this on the internet, it is caused by one query failing, and then trying to make another query without doing a rollback of the transaction. 1) Even if my database schema is inconsistent with the model, shouldn't Django handle this situation better? I.e. actually informing me of the error in the first query, and not attempting to execute any more queries? 2) I don't know much about the flow behind the Django scenes. But I need to find out which query is initially failing, to see what the db problem is. How can I find the query initially failing? Please tell me if I misunderstood something, or if I am off track. 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there an HTML editor that's Django-aware
On Fri, May 20, 2011 at 10:54 AM, BobX wrote: > Pretty obvious question, but is there any recommended HTML editor that > won't munch the Django template codes? I was using Amaya to form my > pages, but after a couple of what-the-heck moments, I discovered that > it sporadically "eats" the template codes - ones in table definitions > being particularly vulnerable. > > Notepad2 is very usable - but unfortunately that's just syntax > highlighting the raw HTML codes. So at the moment I'm generating the > templates with Amaya and then switching to Notepad2 once the template > codes are added. > > I've also got SeaMonkey but haven't had a chance to try it yet. > Platforms I've got available are Linux or Windows. > > Thanks. Bob. > vim foo.html "+set ft=htmldjango" Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Virtualized Django app image for dev replication?
On Thu, May 19, 2011 at 3:30 AM, ydjango wrote: > I am thinking of creating a virtualized image of my complete django > app with mysql so that I can clone/copy it on developers, qa and demo > laptops. That way I do not have to do greenfield install on each > developer computer which can take many hours. > > Any suggestions on what should I use - 1) vmware server, 2) vmware > desktop 3) Xenserver or any other . Any experiences? > > I have not used any of these VM technologies. > > Note: It is only for dev and testing use and it is not for production > use. So free products are preferred. > I wouldn't use any of them, I would setup my project with virtualenv, a requirements file for pip and a bootstrap script to run it all. Even for large projects, with lots of dependencies, virtualenv + pip bootstrap will have your environment and project set up in the amount of time it takes to make a coffee, rather than wasting your time getting to grips with a virtual machine instance. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Is there an HTML editor that's Django-aware
Pretty obvious question, but is there any recommended HTML editor that won't munch the Django template codes? I was using Amaya to form my pages, but after a couple of what-the-heck moments, I discovered that it sporadically "eats" the template codes - ones in table definitions being particularly vulnerable. Notepad2 is very usable - but unfortunately that's just syntax highlighting the raw HTML codes. So at the moment I'm generating the templates with Amaya and then switching to Notepad2 once the template codes are added. I've also got SeaMonkey but haven't had a chance to try it yet. Platforms I've got available are Linux or Windows. Thanks. Bob. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
AW: Advice needed: more advanced user capability
Maybe you should take look at this: https://django-userena.org/ The role- and profile- thing could be realized via the normal groups in django. pat . . . . . . . . . . . . . . . . . . . . . . . . . . Patrick Szabo XSLT Developer LexisNexis Marxergasse 25, 1030 Wien mailto:patrick.sz...@lexisnexis.at Tel.: +43 (1) 534 52 - 1573 Fax: +43 (1) 534 52 - 146 -Ursprüngliche Nachricht- Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im Auftrag von BobX Gesendet: Freitag, 20. Mai 2011 11:49 An: Django users Betreff: Advice needed: more advanced user capability Got a question about my Django development that I'd appreciate some sage "best practices" advice on. My Django app needs more user capability than is available in the default middleware. Specificially I need to be able to: o "age" passwords; o do checks on validity of new passwords - make sure they're not reused, are greater than a minimum length and are "strong"; o lock out accounts after a certain number of failed attempts; o have a capability like the "roles" or "profiles" one - so user A needs to be able to just view data, user B needs to be able to acknowledge login warning messages and reset locked users, user C needs to have full access to user admin features, etc. I figure that the best way to do this is to use the sessions features in Django, but avoid the in-built user capability. I'm more than happy to generate all the screens and code that are needed, but I obviously don't want to do that if there's a simpler/better way. For obvious reasons I really don't want to end up patching/extending the Django code (and then have to redo my changes when Django 1.4 comes out). Thanks. Bob -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Advice needed: more advanced user capability
Got a question about my Django development that I'd appreciate some sage "best practices" advice on. My Django app needs more user capability than is available in the default middleware. Specificially I need to be able to: o "age" passwords; o do checks on validity of new passwords - make sure they're not reused, are greater than a minimum length and are "strong"; o lock out accounts after a certain number of failed attempts; o have a capability like the "roles" or "profiles" one - so user A needs to be able to just view data, user B needs to be able to acknowledge login warning messages and reset locked users, user C needs to have full access to user admin features, etc. I figure that the best way to do this is to use the sessions features in Django, but avoid the in-built user capability. I'm more than happy to generate all the screens and code that are needed, but I obviously don't want to do that if there's a simpler/better way. For obvious reasons I really don't want to end up patching/extending the Django code (and then have to redo my changes when Django 1.4 comes out). Thanks. Bob -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: learning Django after a break -- site tutorials, examples
On May 20, 4:35 am, John Griessen wrote: > I've gone through the Django 1.2 tutorial to the point of creating an admin > site, > then had to switch to other work for months. What are some good simple > example sites > or tutorials for creating a top page ( index.html ) and using templates with > css? > > John Like you, I'm a Django n00b. What I'd recommend is a quick tour through the tutorial again (in case there's any changes from 1.2 to 1.3 that'll effect you, plus it's always good to have that warm "I remember that" feeling). I'd recommend that Django book from Apress, even though that's covering 1.1 - but make sure to get the 2nd edition (pub date 2009) rather than the older release - I've seen both on Amazon, which is quite confusing. The top page question - if you want a static page (ye olde index.html) then probably best to get the web server to skirt around Django and deliver that as a normal HTML page. But the _simplest_ option (from my experience) is to generate a small stub routine that has index.html as a template and use render_to_response to shoot that out when the user goes to URL http//mysite/ (or whatever you want). Just because you're using index.html as a template doesn't mean that it needs to contain anything other than normal HTML. The site I'm developing at the moment has "dummy" placeholders that do exactly that, so I know it works. I only started Django about two weeks ago, and yesterday I generated my first app-specific template filter with few troubles, so I'm _REALLY_ impressed with the power and flexibility of the Django framework. :D Regards, Bob. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Json serialization for use in JS
Hi ! I have written a small library that (among other transformations) can serialize django objects to dict (then you can just use 'json' to make your dict to a json string) : Docs on readthedocs : http://readthedocs.org/docs/any2any/en/latest/doc_pages/djangocast.html Pypi page : http://pypi.python.org/pypi/any2any/0.1 You can achieve very easily the format you need. Please ask if you need help ! Cheers, Sébastien On May 19, 5:05 pm, Tom Evans wrote: > On Thu, May 19, 2011 at 1:23 PM, Jonas Geiregat wrote: > > Hello, > > I'm also finding the built in serialization a bit overhead. > > Me too! I use a simple HttpResponse subclass for generating JSON though: > > from django.http import HttpResponse > from django.utils import simplejson > > class JsonResponse(HttpResponse): > def __init__(self, data): > super(JsonResponse, self).__init__(content=simplejson.dumps(data), > mimetype='application/json') > > Use it like this: > > return JsonResponse({'id': foo.id, 'some_list': [ 1,2,3,4 ]}) > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.