Re: Scaling django installation
On Mon, Jun 4, 2012 at 12:15 PM, vivek wrote: > > > > > > That's aggregated load time, and not a single page loading time. The test > > comprised of navigating to multiple pages to generate more real life > > scenario. > > > > How many pages? > I guess it was 16. > > > > > > 3. text/html , which is the output of django app, is taking 62.74 % > > > time. > > > > This number might not be bad actually, taking into consideration that I > aim > > to reduce the number of http connections per page to something pretty > low. > > > > Number of connections/page will not bring down this figure. > As I said, I plan to reduce the number of connections per page. I don't plan to reduce this figure. > > > > > What is the payload of your html page ? > > > > 5- 10 Kb (compressed) on avg depending upon page content > > > > > Since you thought the aggregated load time to be of a single page, I > guess > > your perspectives need to change accordingly. :) > > Possibly but that would depend on number of pages in testing. e.g. if > the number of pages about 10+ it seems logical but if its 2-3 pages > then its still on high side. > Also the load time increases near linearly with number of users. Which > doesn't sounds logical e.g. at peak its almost 3 miunutes. > Current single setup server has to handle high number of connections per page. Around 50 - 80 connections on average. Active connections thus linearly rose to around 2.3k. And apache webserver currently is sitting in front of django and static, so you see thus effect. Separation of django and static content is part of the deployment/setup change anyway. > > rgds > vivek > > > > -- > 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. > > -- Thanks, Subhranath Chunder. www.subhranath.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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to perform a simple search ignoring characters with accents (á, é, í, ó, ú)
Hi, if you are using postgreSQL, I released a week ago a library to do just what you need: see: https://github.com/djcoin/django-unaccent/ Once you got the `unaccent` function set up in your postgreSQL db, you can make unaccented search from the Django ORM as usual. Eg: Given a book title of "The book of Café", `Book.objects.filter(title__icontains_unaccent='Cafe')` will match Cheers, Simon On Jun 1, 7:03 pm, Joni Bekenstein wrote: > I need to do a simple search ignoring some characters with accents. The > idea would be that "hola" matches the search term "holá". > > What I'm currently doing is adding a CharField to my model to store the > searchable term. For example: > > class Book(models.Model): > title = models.CharField(max_length=100) > searchable_title = models.CharField(max_length=100) > > When I save a Book I'll replace the accented characters in title with their > non-accented counterparts and store the result in searchable_title. The, > I'll also do the same thing with the search term before actually doing the > query. > > I don't like this approach because if I need to add more searchable fields > things start getting noisy in my models. > > 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Scaling django installation
> I guess it was 16. Sounds good. > Separation of django and static content is part of the deployment/setup > change anyway. Yes that would definitely help. As mentioned before look at varnish. rgds vivek -- 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.
Using the django.contrib.auth User in my model - database error
Part of my application that uses the contrib,auth User from django.db import models from django.contrib.auth.models import *User* class Project(models.Model): name = models.CharField(max_length=200) startdate = models.DateField('Project Started') enddate = models.DateField('Expected end date') manager = models.ForeignKey(*User*,related_name="Expert") users = models.ManyToManyField(*User*,related_name='project_users') Then defined in admin.py from coordination.models import * from django.contrib import admin from django.contrib.auth.models import User class ProjectAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['name']}), ('People', {'fields': ['users'], 'classes' :['collapse']}), ('Date information', {'fields': ['startdate','enddate'] , 'classes' : ['collapse']}),] admin.site.register(Project, ProjectAdmin) I ran syncdb without a problem , then when I used the admin interface I get the following error : Exception Type: DatabaseError at /admin/coordination/project/ Exception Value: no such column: coordination_project.manager_id Kind regards , Jonathan Request Method:GETRequest URL: http://localhost:8000/admin/coordination/project/Django Version:1.4Exception Type:DatabaseErrorException Value: no such column: coordination_project.manager_id Exception Location:C:\Tools\Python2.7.2\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 337Python Executable:C:\Tools\Python2.7.2\python.exePython Version:2.7.2 -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/HaCbZOJzYekJ. 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: Understanding Django for PHP developer
Doug, thanks a lot! I've read the article and it really explains a lot, but what I'm actually looking for is a list of differences like the one you've pointed out (listofstuff lifetime)... anything? ;) On Jun 4, 12:10 am, Doug Ballance wrote: > I should have looked a little harder, I found the blog post. It is > about a much older version of Django. Some of the references to django > internals are surely a bit different now, but the fundamentals are the > same. It really helped me when I first started. I'd love to see it > updated for the current versions and part of the official docs. > > http://www.b-list.org/weblog/2006/jun/13/how-django-processes-request/ -- 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.
Django ForeignKey which does not require referential integrity?
Bump ;-) I know my question is a bit technical but could someone help ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WuyUm2Xs5jYJ. 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: Using the django.contrib.auth User in my model - database error
On Jun 4, 9:49 am, xTalisman wrote: > I ran syncdb without a problem , then when I used the admin interface I > get the following error : > > Exception Type: DatabaseError at /admin/coordination/project/ > Exception Value: no such column: coordination_project.manager_id > syncdb only creates the table if it doesn't yet exist in your db - it will NOT modify an existing table. I guess you ran syncdb a first time before adding the manager field ? if you either have to update your schema manually or (better) use a schema-migration tool like South. -- 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: Using the django.contrib.auth User in my model - database error
Bruno , I thought so , so I deleted the the whole database (sqlite3) and ran the syncdb again , it created the tables as defined by django.contrib.auth and my application - but did not create the foreignkey columns manager and users. Any ideas ? On Monday, June 4, 2012 11:23:33 AM UTC+3, bruno desthuilliers wrote: > > On Jun 4, 9:49 am, xTalisman wrote: > > I ran syncdb without a problem , then when I used the admin interface I > > get the following error : > > > > Exception Type: DatabaseError at /admin/coordination/project/ > > Exception Value: no such column: coordination_project.manager_id > > > > syncdb only creates the table if it doesn't yet exist in your db - it > will NOT modify an existing table. I guess you ran syncdb a first time > before adding the manager field ? if you either have to update your > schema manually or (better) use a schema-migration tool like South. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/PKe7p4-4-cAJ. 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.
Django ForeignKey which does not require referential integrity?
For the record, I've looked deep into django's code to find what needs to be done, but I think that simply subclassing ForeignKey will not be enough. NB: I use South for managing my database schema, so I figure I'll need to do something about that too. But it may be out of the subject here :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Tgn_BUPWNScJ. 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: Using the django.contrib.auth User in my model - database error
Solved : I dropped all the database tables (including the contib.auth ones) and ran syncdb, suddenly everything was fine. odd , but is working now . Jonathan On Monday, June 4, 2012 11:27:44 AM UTC+3, xTalisman wrote: > > Bruno , > I thought so , so I deleted the the whole database (sqlite3) and ran the > syncdb again , it created the tables as defined by django.contrib.auth and > my application - but did not create the foreignkey columns manager and > users. > Any ideas ? > > On Monday, June 4, 2012 11:23:33 AM UTC+3, bruno desthuilliers wrote: >> >> On Jun 4, 9:49 am, xTalisman wrote: >> > I ran syncdb without a problem , then when I used the admin interface >> I >> > get the following error : >> > >> > Exception Type: DatabaseError at /admin/coordination/project/ >> > Exception Value: no such column: coordination_project.manager_id >> > >> >> syncdb only creates the table if it doesn't yet exist in your db - it >> will NOT modify an existing table. I guess you ran syncdb a first time >> before adding the manager field ? if you either have to update your >> schema manually or (better) use a schema-migration tool like South. >> >> -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/bglVN09PO6gJ. 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: Understanding Django for PHP developer
On Jun 3, 12:18 pm, mikegolf wrote: > Hi, > I've started to learn Django recently, however for last 5+ years I've > been developing using PHP (especially Yii) and thus asking if there's > any tutorial / documentation on significant differences in > *thinking*. > What I mean is for example objects' lifecycle - for PHP the life cycle > of object is strictly related to the single request.. > I know that for Python / Django developers these are obvious things, > but not for me. Thus I'd love to see an article / document which > points these base and significant differences. > Any recommendations? Well, the answer may not be as simple as it seems, as it first requires a correct understanding of Python's execution model, namespaces, scopes and bindings (aka "variables") - and this would make for a rather long and technical document. Then you have to know how your django application is deployed. I think the most important points wrt/ "objects lifcycle" are (overly simplified): * a Python module's top-level code is executed once the first time the module is imported * "import", "class" and "function" statements are executable statements * the code at the toplevel of a "class" statement is executed once before the metaclass is called and the class object created * all this will occur for each of your django server processes * you can have multiple processes serving the same django application, and ay request can be mapped to any process (this depends on the front server and gateway so you have no control over this) To make a long story short: remember you are in a long running process, so never modify (mutate or rebind) any module or class attribute when serving a request. As an exemple, I once spent quite a few hours debugging a seemingly intermittent and very very strang problem on a form. The root problem was a younger co-worker wrote code that was mutating some of the form's *class* attributes in the class initializer, and depending on which process would process the form's submission, things would - or not - get totally mixed up. A more common mistake is to initialize a class or module date attribute with the result of a call to datetime.datetime.now() and wonder why it's not updated on each and every request. -- 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: Using the django.contrib.auth User in my model - database error
On Jun 4, 11:01 am, xTalisman wrote: > Solved : > I dropped all the database tables (including the contib.auth ones) and ran > syncdb, suddenly everything was fine. odd , but is working now . Well, nice to know it works now, but yes this _is_ odd. -- 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.
onetoone field in admin
When i select a onetoone field in admin which has already been taken, I get an error message (already exist). This is of course expected behaviour. The problem i have is that the list to select from gets very long because all items are listed. Is there a way to hide all options that are already used/existing? I use version 1.2.3 -- 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.
Sorl thumbnails VS Google
May be it's a stupid question, but i can't find an answer. Using sorl thumbnails and inspecting the page source i notice that images are coded in html in the following way: width="187" height="280" /> but here http://support.google.com/webmasters/bin/answer.py?hl=en&answer=114016 "The filename can give Google clues about the subject matter of the image. Try to make your filename a good description of the subject matter of the image. For example, *my-new-black-kitten.jpg* is a lot more informative than *IMG00023.JPG*. Descriptive filenames can also be useful to users: If we're unable to find suitable text in the page on which we found the image, we'll use the filename as the image's snippet in our search results." So i can't understand if i want to have a better ranking, it is better to not use sorl for this kind of images and use height="{{ pic.picture.height }}" /> that gives width="187" height="280" /> instead of {% thumbnail pic.picture "280x280" as image %} {% endthumbnail %} Is this reasoning correct? Thanks to all Kooliah -- 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: Oracle schema not working
Why is Django strangely quoting column and table names? It gives Oracle syntax errors. DatabaseError at / relation "foo" does not exist LINE 1: ...ty", "foo"."address_country" FROM "foo"."... Of course it exists as foo, not as "foo". I already did the CREATE SYNONYM trick to avoid messing with schemas. -- 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: Oracle schema not working
Exact error: > DatabaseError at / > > relation "foo" does not exist > LINE 1: ...ty", "foo"."address_country" FROM "foo... > -- 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: Oracle schema not working
4.6.2012 14:36, rahajiyev kirjoitti: Why is Django strangely quoting column and table names? It gives Oracle syntax errors. DatabaseError at / relation "foo" does not exist LINE 1: ...ty", "foo"."address_country" FROM "foo"."... Of course it exists as foo, not as "foo". I already did the CREATE SYNONYM trick to avoid messing with schemas. By default Oracle makes following assumption: if given name (column, table, schema etc.) is not quoted it's converted implicitly to uppercase and used as that. Thus clause: select * from SoMeTaBle becomes to select * from "SOMETABLE". If you provide quotes Oracle uses table name as is and thus making it case-sensitive. In theory Django should make all names uppercase regradless how you write it. I recall someone to complain strange behavior in cases with Oracle backend. -- Jani Tiainen - Well planned is half done and a half done has been sufficient before... -- 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.
Retrieve datas from database
hi there, i'm new with Django. What i want is that retrieve some datas from db. First of all, i have a project called mysite and project has an application called blog. Project file has template/ directory which includes html files of site.Additionally, blog application has a model like that class Post(models.Model): title = models.CharField(max_length=100) body = models.TextField() created = models.DateTimeField() tags = TaggableManager() def __unicode__(self): return self.title in this app i have also view.py from django.template import Context, loader from blog.models import Post from django.http import HttpResponse def index(request): latestPosts = Post.objects.all().order_by('-created')[:5] t = loader.get_template('/mysite/templates/index.html') c = Context({ 'latestPosts': latestPosts, }) return HttpResponse(t.render(c)) however, in mysite/template/index.html {% for post in latestPosts %} {{ post.id }} {% endfor %} prints nothing because it could not send data here. How can i send it ? -- 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: Retrieve datas from database
On Mon, 2012-06-04 at 05:23 -0700, by-neron wrote: > i have a project called mysite and project has an application called > blog. Project file has template/ directory which includes html files > of site.Additionally, blog application has a model like that > > class Post(models.Model): > title = models.CharField(max_length=100) > body = models.TextField() > created = models.DateTimeField() > tags = TaggableManager() > > > def __unicode__(self): > return self.title > in this app i have also view.py > > from django.template import Context, loader > from blog.models import Post > from django.http import HttpResponse > > def index(request): > latestPosts = Post.objects.all().order_by('-created')[:5] > t = loader.get_template('/mysite/templates/index.html') > c = Context({ > 'latestPosts': latestPosts, > }) > return HttpResponse(t.render(c)) > however, > > in mysite/template/index.html > > {% for post in latestPosts %} > {{ post.id }} > {% endfor %} > prints nothing because it could not send data here. How can i send > it ? > > looks ok - what about your urlconf? -- regards Kenneth Gonsalves -- 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: Sorl thumbnails VS Google
On 4 Giu, 12:32, kooliah wrote: > So i can't understand if i want to have a better ranking, it is better > to not use sorl for this kind of images and use > > height="{{ pic.picture.height }}" /> > > that gives > width="187" height="280" /> > from a user perspective, I think is much wors load a full size image and scale it down only to use its filename.. the same page you linked says also: " Create great alt text The alt attribute is used to describe the contents of an image file. It's important for several reasons: •It provides Google with useful information about the subject matter of the image. We use this information to help determine the best image to return for a user's query. •Many people-for example, users with visual impairments, or people using screen readers or who have low-bandwidth connections—may not be able to see images on web pages. Descriptive alt text provides these users with important information. " so you should try to add a usefull alt alttrbute, like {% thumbnail pic.picture "280x280" as image %} {% endthumbnail %} Which could render as -- 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 perform a simple search ignoring characters with accents (á, é, í, ó, ú)
One possibility is to use MySQL. By default it indexes things so that a, á, and À are the same thing. There are some gotchas though: you have to make sure that it’s using an appropriate character set for the languages you’re using. (UTF-8 is a good choice.) There’s not a good similar solution for PostgreSQL. While it is possible to write a function, and create an index on that function, I haven’t found a way of searching on that index in Django. If anyone knows of a way to do it, I’d love to here it. On Jun 1, 2012, at 11:41 AM, Kurtis Mullins wrote: > Maybe you could just build a simple index? It'd basically be a set of > keywords, each with a set of matching books. > So in your example, you'd have two keywords: > > hola (with accent) -> book1, book2, etc.. > hola (without accent) -> (same as previous) > > And then just write some sort of functionality to run through your data and > index it to a table. I can't vouch that this is the best approach - but I > think it'd at least solve the problem. > > On Fri, Jun 1, 2012 at 1:03 PM, Joni Bekenstein > wrote: > I need to do a simple search ignoring some characters with accents. The idea > would be that "hola" matches the search term "holá". > > What I'm currently doing is adding a CharField to my model to store the > searchable term. For example: > > class Book(models.Model): > title = models.CharField(max_length=100) > searchable_title = models.CharField(max_length=100) > > When I save a Book I'll replace the accented characters in title with their > non-accented counterparts and store the result in searchable_title. The, I'll > also do the same thing with the search term before actually doing the query. > > I don't like this approach because if I need to add more searchable fields > things start getting noisy in my models. > > Any ideas? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/tdIUkptWpZgJ. > 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. Peter of the Norse rahmc...@radio1190.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: django 1.4, wsgi, flex deploy best practices
That's a nice clean solution requiring only a minimal edit on a redeploy(server move). I had previously tried to semi-automate this using the javascript code below; but that did not provide a host or hostname; however I'm not really a javascript guru and may have missed something. var flashvars = {}; flashvars.hostname = window.location.hostname; flashvars.host = window.location.host; flashvars.port = window.location.port; flashvars.mode = "fred put this in to test"; var params = {}; params.quality = "high"; params.bgcolor = "${bgcolor}"; params.allowscriptaccess = "sameDomain"; params.allowfullscreen = "true"; var attributes = {}; attributes.id = "${application}"; attributes.name = "${application}"; attributes.align = "middle"; swfobject.embedSWF( "${swf}.swf", "flashContent", "${width}", "${height}", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes); From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Joni Bekenstein Sent: Friday, June 01, 2012 9:40 AM To: django-users@googlegroups.com Subject: Re: django 1.4, wsgi, flex deploy best practices You can configure a basePath through flashvars as you said, but you don't have to make django serve the index.html to set that dynamically. You can put it by hand, allowing you to deploy on different servers in a decoupled manner. Maybe I'm missing something here but I don't see anything wrong with that approach. I almost always use flashvars to specify at least one location, probably for a configuration file, which contains the paths to the backend services, external assets, etc. Another thing you could do is configure a CNAME record so that backend.frontendserver.com points to backendserver.com. El jueves, 31 de mayo de 2012 15:54:35 UTC-3, fred escribió: I use Flex for the client side and XML between client and server. I am a "one man team" and so elegance sometimes gets sacrifices for "it works". My typical deploy has been /var/www/html/my flex swf and html code And /home/projectname/current/djangositename This works well, except that I have to use absolute URL's in Flex (including the server name) because Flex will use either absolute or relative to the location of the .swf file. This means I have to rebuild for different servers. Are there any recommendations of "best practices" 1. I could have the django view return the html page that includes the swf file. This has the advantage of allowing django to pass in some flashvars to the application, the disadvantage is closer coupling (at least for deploy) of client and server; or 2. I could use the url redirect to allow a relative reference to get redirected to my django home. I'm not an Apache expert and so I defer to the community which is more experienced with these issues for a clean, generic solution I can use going forward as I port to Django 1.4 and CentOs 6. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/KqN3HWLknioJ. 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: Retrieve datas from database
On Jun 4, 2:23 pm, by-neron wrote: > however, > > in mysite/template/index.html > > {% for post in latestPosts %} > {{ post.id }} > {% endfor %} > prints nothing because it could not send data here. How can i send it ? You pass them as a Context object to the render() method of the template - which is what your code is doing. IOW : the problem is probably elsewhere. I assume that 1/ you are running the builtin dev server with the DEBUG flag set to True in your settings, 2/ you do have some posts in your database, 3/ you already made sure your code was using the right template (like by editing something in your template and reloading the url to check if you see the edit). -- 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: uploading images via API
take a look at gist w/ base64 file upload solution: https://github.com/toastdriven/django-tastypie/issues/42 it works great, you can add Base64FileField implementation to your app (it's only ~15 lines of code) and you can upload from anything that can open a file and encode it. you can also use flash/swf if you need to make it work in older browsers. Aljosa -- 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: Oracle schema not working
On Monday, June 4, 2012 5:36:32 AM UTC-6, rahajiyev wrote: > > Why is Django strangely quoting column and table names? It gives > Oracle syntax errors. > > DatabaseError at / > > relation "foo" does not exist > LINE 1: ...ty", "foo"."address_country" FROM "foo"."... > > Of course it exists as foo, not as "foo". > > I already did the CREATE SYNONYM trick to avoid messing with schemas. What does the db_table in your model definition look like? It should just be: db_table = 'foo' # Django will take foo and change it to "FOO", which is how Oracle interprets foo not: db_table = '"foo"' # Since this is already quoted, I think Django won't change it, and then Oracle won't be able to find the table because it is explicitly the wrong case. Cheers, Ian -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/GJh1mmeq6KMJ. 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.
Question regarding cloud deployment and bash automatization
Hey Gang, I have created a juju charm to deploy multiple django apps to ec2. Currently, I am working on multiple site control and need help with the django_site table. When am instance is destroyed, the database remains but django is re-installed. The problem arises when old database is kept around and reused with a fresh django install. This new django install has the same settings but the django_site table can get funky. Here is the start of my script to at least set the correct database id, name, and domain. It is hack right here, so I am ask for your thoughts or suggestions. Thank you. NOTE: the regular expressions are simply parsing the settings.py file for site_id and if django.contib.sites is un-commented. site_domain="www.example.com" site_name="example.com" site_id="$(cat $(find . -name 'settings.py') | grep -xv " *#.*" | grep ".*SITE_ID\ *=.*" | sed 's/#.*//g' | sed "s/.*SITE_ID *\= *\(.*\) */\1/g" | sed "s/'//g")" #echo "from django.contrib.sites.models import Site; Site.objects.create(pk=$site_id, domain='here.example.com', name='example.com')" | python manage.py shell # For now, just gonna put in a place holder if the user has listed it in installed_apps sites_used="$(cat $(find . -name 'settings.py') | grep -xv " *#.*" | grep ".*django.contrib.sites.*" | sed 's/#.*//g')" if [ -n "$sites_used" ]; then juju-log "Found django.contrib.sites in installed apps. Creating single table as defined in this script." echo "from django.contrib.sites.models import Site; entry = Site.objects.get(pk=$site_id); entry.objects.all().delete(); Site.objects.create(pk=$site_id, domain='$site_domain', name='$site_name')" | python manage.py shell fi Here are my mysteries: 1) The python manage.py shell comand is giving me this error --> AttributeError: Manager isn't accessible via Site instances 2) How can I retrieve the site_name and site_domain varables with bash scripting for the project. Keep in mind that there can be no user input in the script but I do have all username and passwords available. -- Bust0ut, Surgemcgee: Systems Engineer --- PBDefence.com BudTVNetwork.com RadioWeedShow.com "Bringing entertainment to Unix" -- 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: Django session and Dojo dnd.
Hello Hendrik, Thank you for your help! I can get the 'ok' in the alert with your code. However, how do I show the response in the alert? For some reason I am unable to pass the message back from the view; I keep getting an empty alert(response). My view looks like: def new_session(request): if not request.is_ajax() or not request.method=='POST': return HttpResponseNotAllowed(['POST']) else: request.session['key'] = json.loads(request.POST.get('details', '[]')) return HttpResponse(request.session['key']) I've also tried "return HttpResponse('ok')", but the 'ok' still didn't get passed to the load function. What do I do wrong? Any hints would be much appreciated! voss On Saturday, June 2, 2012 8:46:38 AM UTC-5, henzk wrote: > > Hi, > > i haven't tested the code and never used dojo before, but sth. like > this should work: > > var source1 = new dojo.dnd.Source("itemListNode"); > var source2 = new dojo.dnd.Target("selectedListNode"); > dojo.connect( source1, "onDndDrop", > function(source, nodes, copy, target){ > //gather items and details > var details = []; > for( i=0; i < nodes.length; i++){ > var item = this.getItem(nodes[i].id); > details.push(item.data); > } > //send details to server via AJAX POST request > dojo.xhrPost({ > url: "/save_details/", > content: {details: JSON.stringify(details)}, > // The success handler > load: function(response) { > alert('ok'); > }, > // The error handler > error: function() { > alert("error"); > } > }); > }); > > Explanation: > > - changed 'item' to 'var item' ... without the 'var' item will be > global, which is probably not what you want. > - to get around making multiple requests to the server(one for each > dropped node), put the detail of each node in the details array. > - then json-encode and send this array to your django view (assumed to > be at '/save_details/') > - in the view, access the list as > json.loads(request.POST.get('details', '[]')) and place it into > request.session > > As mentioned, the code is completely untested. > > Good luck! > > Yours, > > Hendrik Speidel > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/lm_o18pvCe8J. 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.
django site upload
I am a newbie to django and i need help on site upload -- 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: Django session and Dojo dnd.
Hi Hendrik, I forgot to mention in my previous message that the debug shows the following: code 400, message Bad request syntax ("\x16\x03\x01\x00\x8b\x01\x00\x00\x87\x03\x01O\xcc\xd8\xc0\x18hZ\x7f\xa3h\xb9l\xaf\xdb\xfbp}(\xc1\xc6\xa5g\x18\xe5!\x87\xd4\xe2`_'\x90\x00\x00H\x00\xff\xc0") Thank you! voss On Saturday, June 2, 2012 8:46:38 AM UTC-5, henzk wrote: > > Hi, > > i haven't tested the code and never used dojo before, but sth. like > this should work: > > var source1 = new dojo.dnd.Source("itemListNode"); > var source2 = new dojo.dnd.Target("selectedListNode"); > dojo.connect( source1, "onDndDrop", > function(source, nodes, copy, target){ > //gather items and details > var details = []; > for( i=0; i < nodes.length; i++){ > var item = this.getItem(nodes[i].id); > details.push(item.data); > } > //send details to server via AJAX POST request > dojo.xhrPost({ > url: "/save_details/", > content: {details: JSON.stringify(details)}, > // The success handler > load: function(response) { > alert('ok'); > }, > // The error handler > error: function() { > alert("error"); > } > }); > }); > > Explanation: > > - changed 'item' to 'var item' ... without the 'var' item will be > global, which is probably not what you want. > - to get around making multiple requests to the server(one for each > dropped node), put the detail of each node in the details array. > - then json-encode and send this array to your django view (assumed to > be at '/save_details/') > - in the view, access the list as > json.loads(request.POST.get('details', '[]')) and place it into > request.session > > As mentioned, the code is completely untested. > > Good luck! > > Yours, > > Hendrik Speidel > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/zZ3H9Me5W7AJ. 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 suppress ForeignKey related query
I have a class class PlayerSoul(ModelAbstract, ModelBatchSaveHelper): player = models.ForeignKey(Player) .. When I call PlayerSoul.objects.all() PlayerSoul.objects.get() there is always an additional query for Player. Can I delay the query for Player until I really use it. -- 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 suppress ForeignKey related query
Related objects are lazy by default, unless you're using select_related() or prefetch_related(): https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_related So if you're seeing a player query and you're not using one of those methods, then I would double check your code (and templates) to make sure you're not using the player relation somewhere. _Nik On 6/4/2012 10:42 AM, Zheng Li wrote: > I have a class > class PlayerSoul(ModelAbstract, ModelBatchSaveHelper): > player = models.ForeignKey(Player) > .. > > When I call > PlayerSoul.objects.all() > PlayerSoul.objects.get() > there is always an additional query for Player. > > Can I delay the query for Player until I really use it. > -- > 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.
Now I know I solved this before, but...
Can anyone explain this on to me. It seams like an easy fix, but I can't get my fingers on it. Any help is appreciated. In template /home/sites/radio_show/radio/serve/templates/registration/activation_email.txt, error at line 5 unindent does not match any outer indentation level 1 {% load i18n %} 2 3 {% trans "Simply follow the link below to complete your Activation at" %} {{ site.name }}: 4 5 http://{{ site.domain }}{% url registration_activate activation_key %} 6 7 {% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %} 8 -- Bust0ut, Surgemcgee: Systems Engineer --- PBDefence.com BudTVNetwork.com RadioWeedShow.com "Bringing entertainment to Unix" -- 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: Now I know I solved this before, but...
The problem is likely in your Python code somewhere. That error usually means that you have some incorrectly (un)indented code. _Nik On 6/4/2012 11:16 AM, Robert Steckroth wrote: > Can anyone explain this on to me. It seams like an easy fix, but > I can't get my fingers on it. Any help is appreciated. > > In template > /home/sites/radio_show/radio/serve/templates/registration/activation_email.txt, > error at line 5 > unindent does not match any outer indentation level > > 1 {% load i18n %} > 2 > 3 {% trans "Simply follow the link below to complete your Activation > at" %} {{ site.name }}: > 4 > 5 http://{{ site.domain }}{% url registration_activate activation_key %} > 6 > 7 {% blocktrans %}Link is valid for {{ expiration_days }} days.{% > endblocktrans %} > 8 > > > > -- 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: PyPm / Django 1.4?
On Sun, Jun 3, 2012 at 9:48 AM, Aaron C. de Bruyn wrote: > On Sat, Jun 2, 2012 at 9:43 AM, Bill Freeman wrote: >> Have you considered running under a virtualenv and pip installing >> exactly what you need? Windows is such a nightmare. PyPm doesn't have sqlite packages--they all show a failure to compile on ActiveState's site. Apparently they've always failed for every version of Windows ever. Pip wasn't much help as I need to install Visual Studio to compile the sqlite libraries. Pass. I'll give it a shot with MySQL and hope I have better luck. What do Windows Django developers use for small local databases? MySQL seems overkill if you're just doing local development on a Windows box--or as in my case, installing a single-user app that is shown as a web front-end. -A -- 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.
List viewable on the website
Hello, Would like to ask I have Django website and would like to do following: I know I can view LIST in mailchimp and also can download csv from mailchimp and upload to my host and view on the website. What I want to do, how can I make it automatic, best would be CSV or LIST sync with website DB and I would read my data from my DB? I dont want every week manually downlaod CVS and upload to my DB to be synced. Is there a some nice way to do that also in Django? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/1Wcs6H5DltEJ. 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: List viewable on the website
Have you seen this? https://github.com/ojii/django-mailchimp _Nik On 6/4/2012 1:02 PM, rentgeeen wrote: > Hello, > > Would like to ask I have Django website and would like to do following: > > I know I can view LIST in mailchimp and also can download csv from > mailchimp and upload to my host and view on the website. > > What I want to do, how can I make it automatic, best would be CSV or > LIST sync with website DB and I would read my data from my DB? > > I dont want every week manually downlaod CVS and upload to my DB to be > synced. > > Is there a some nice way to do that also in Django? > > Thanks > -- > You received this message because you are subscribed to the Google > Groups "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/1Wcs6H5DltEJ. > 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: PyPm / Django 1.4?
I just use MySQL. Better the devil you know ... -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Aaron C. de Bruyn Sent: Monday, June 04, 2012 3:41 PM To: django-users@googlegroups.com Subject: Re: PyPm / Django 1.4? On Sun, Jun 3, 2012 at 9:48 AM, Aaron C. de Bruyn wrote: > On Sat, Jun 2, 2012 at 9:43 AM, Bill Freeman wrote: >> Have you considered running under a virtualenv and pip installing >> exactly what you need? Windows is such a nightmare. PyPm doesn't have sqlite packages--they all show a failure to compile on ActiveState's site. Apparently they've always failed for every version of Windows ever. Pip wasn't much help as I need to install Visual Studio to compile the sqlite libraries. Pass. I'll give it a shot with MySQL and hope I have better luck. What do Windows Django developers use for small local databases? MySQL seems overkill if you're just doing local development on a Windows box--or as in my case, installing a single-user app that is shown as a web front-end. -A -- 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.
Appropriate way to override Model __getattr__ in 1.4
What's the appropriate way of overriding the a Model class's __getattr__ in Django 1.4? I have a model structure like: class Main(models.Model): [blah] class Detail(models.Model): main = models.ForeignKey(Main) name = models.CharField(max_length=255) value= models.CharField(max_length=255) I had overridden my Main._getattr__ so I could reference Detail records as though they were normal Main attributes. e.g. a simple meta- model pattern like >>> m = Main.objects.create() >>> Detail.objects.create(main=m, name='name', value='value') >>> print m.name 'value' To do this, my pre-1.4 __getattr__ looked like: def __getattr__(self, attrname): qs = self.details.filter(name=attrname) c = len(qs) if c == 0: raise AttributeError elif c == 1: return qs[0].value else: return [d.value for d in qs] This worked perfectly until I upgraded to 1.4. Now I get all types "attribute X does not exist" errors. I tried something like the following, but had no luck. It seems to especially conflict with the "_*_cache" attributes Django generates for ForeignKey references. def __getattr__(self, attrname): try: return super(Main, self).__getattr__(attrname) except AttributeError: pass qs = self.details.filter(name=attrname) c = len(qs) if c == 0: raise AttributeError elif c == 1: return qs[0].value else: return [d.value for d in qs] How do I resolve 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: django site upload
Upload to where? What's confusing you? On 5 June 2012 02:17, AJAYI THEOPHILUS wrote: > I am a newbie to django and i need help on site upload > > -- > 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: List viewable on the website
Yes but thats like 2 years ago it was like django 0.96 that wont work On Monday, 4 June 2012 16:32:32 UTC-4, Nikolas Stevenson-Molnar wrote: > > Have you seen this? https://github.com/ojii/django-mailchimp > > _Nik > > On 6/4/2012 1:02 PM, rentgeeen wrote: > > Hello, > > > > Would like to ask I have Django website and would like to do following: > > > > I know I can view LIST in mailchimp and also can download csv from > > mailchimp and upload to my host and view on the website. > > > > What I want to do, how can I make it automatic, best would be CSV or > > LIST sync with website DB and I would read my data from my DB? > > > > I dont want every week manually downlaod CVS and upload to my DB to be > > synced. > > > > Is there a some nice way to do that also in Django? > > > > Thanks > > -- > > You received this message because you are subscribed to the Google > > Groups "Django users" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/django-users/-/1Wcs6H5DltEJ. > > 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 view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/vmNqiZw7-H0J. 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.
editable option for model field?
The description of editable says: > If False, the field will not be editable in the admin or via forms > automatically generated from the model class. To me, this sounds like it will be shown in the admin, just not as an editable field (i.e. readonly). However, when I try setting it to False, my field it omitted entirely from the admin. What's the intent of editable? Is this a bug, or is the description in the docs just misleading? -- Roy Smith r...@panix.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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django session and Dojo dnd.
Hi Voss, i forgot about django's CSRF protection. You can use the csrf_exempt decorator on the view function to disable django's CSRF protection - however, i wouldn't recommend that. There is a script at https://docs.djangoproject.com/en/dev/ref/contrib/csrf/ To use the script with dojo instead of jquery, you will need to adapt it a little: -copy the getCookie function to your code then, every time you make a POST request to your application using dojo.xhrPost, add this to the arguments object: headers: {'X-CSRFToken': getCookie('csrftoken')} If you are still getting HTTP 400 errors, verify that the request looks sane in firebug and check that it contains a X_HTTP_REQUESTED_WITH header set to XMLHttpRequest (but i am pretty sure dojo adds this one automatically). hendrik Am Montag, 4. Juni 2012 18:33:21 UTC+2 schrieb voss: > > Hi Hendrik, > > I forgot to mention in my previous message that the debug shows the > following: > > code 400, message Bad request syntax > ("\x16\x03\x01\x00\x8b\x01\x00\x00\x87\x03\x01O\xcc\xd8\xc0\x18hZ\x7f\xa3h\xb9l\xaf\xdb\xfbp}(\xc1\xc6\xa5g\x18\xe5!\x87\xd4\xe2`_'\x90\x00\x00H\x00\xff\xc0") > > Thank you! > > voss > > > > On Saturday, June 2, 2012 8:46:38 AM UTC-5, henzk wrote: >> >> Hi, >> >> i haven't tested the code and never used dojo before, but sth. like >> this should work: >> >> var source1 = new dojo.dnd.Source("itemListNode"); >> var source2 = new dojo.dnd.Target("selectedListNode"); >> dojo.connect( source1, "onDndDrop", >> function(source, nodes, copy, target){ >> //gather items and details >> var details = []; >> for( i=0; i < nodes.length; i++){ >> var item = this.getItem(nodes[i].id); >> details.push(item.data); >> } >> //send details to server via AJAX POST request >> dojo.xhrPost({ >> url: "/save_details/", >> content: {details: JSON.stringify(details)}, >> // The success handler >> load: function(response) { >> alert('ok'); >> }, >> // The error handler >> error: function() { >> alert("error"); >> } >> }); >> }); >> >> Explanation: >> >> - changed 'item' to 'var item' ... without the 'var' item will be >> global, which is probably not what you want. >> - to get around making multiple requests to the server(one for each >> dropped node), put the detail of each node in the details array. >> - then json-encode and send this array to your django view (assumed to >> be at '/save_details/') >> - in the view, access the list as >> json.loads(request.POST.get('details', '[]')) and place it into >> request.session >> >> As mentioned, the code is completely untested. >> >> Good luck! >> >> Yours, >> >> Hendrik Speidel >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/o9ogPPvIya0J. 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: editable option for model field?
On 5/06/2012 10:06am, Roy Smith wrote: The description of editable says: If False, the field will not be editable in the admin or via forms automatically generated from the model class. To me, this sounds like it will be shown in the admin, just not as an editable field (i.e. readonly). However, when I try setting it to False, my field it omitted entirely from the admin. If it isn't editable there is no need to include it in the Admin. Make it editable (in models.py) and then (in admin.py) make it read-only. https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields What's the intent of editable? Is this a bug, or is the description in the docs just misleading? You should perhaps adjust the docs to the extent necessary. Seeing as it mentions the admin it might help to include a link to the above read-only reference. -- Roy Smith r...@panix.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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: PyPm / Django 1.4?
On 5/06/2012 10:32am, Dennis Lee Bieber wrote: On Mon, 4 Jun 2012 12:41:10 -0700, "Aaron C. de Bruyn" declaimed the following in gmane.comp.python.django.user: What do Windows Django developers use for small local databases? MySQL seems overkill if you're just doing local development on a Windows box--or as in my case, installing a single-user app that is shown as a web front-end. I use PostgreSQL on Windows. For me, anything else isn't worth the brainspace now. If you are looking for something nicely self-contained and cross-platform I think Firebird is probably worth a look. I haven't looked at it for some time now but when I was looking for a dbms which would be seamlessly stand-alone for single-user apps and client-server in a network it was the only sensible solution. Everything else required separate installation and setup for the dbms in a single-user environment. It would probably work on a smartphone. I don't know how the Firebird Django backend is progressing but when I last looked it seemed well advanced. Well... I've not done much Django (just deleted my first attempt, which goes back to Django 1.1 or so; and never did get beyond the admin interface)... But I tend to do a lot of scratch work using the SQLite3 that is part of the standard Windows Python binary installer (though I use ActiveState's binary install of Python). I'm not configured to build from sources. OTOH: I do have MySQL running as a server on my desktop machine -- primarily using the old CherryPy/CherryTemplate system to generate static pages for upload to the Bestiaria web-site. -- 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: Retrieve datas from database
Hey.. I am working for project, in that the back-end code is return in perl and am working for front-end part i.e UI using Django, Can any one can tell me how to access back-end database which is return in perl or any othere languages .?? Pls help Thank You On Mon, Jun 4, 2012 at 7:21 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On Jun 4, 2:23 pm, by-neron wrote: > > > however, > > > > in mysite/template/index.html > > > > {% for post in latestPosts %} > > {{ post.id }} > > {% endfor %} > > prints nothing because it could not send data here. How can i send it ? > > You pass them as a Context object to the render() method of the > template - which is what your code is doing. IOW : the problem is > probably elsewhere. > > I assume that > 1/ you are running the builtin dev server with the DEBUG flag set to > True in your settings, > 2/ you do have some posts in your database, > 3/ you already made sure your code was using the right template (like > by editing something in your template and reloading the url to check > if you see the edit). > > > -- > 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: Oracle schema not working
My bad, folks, late in the day I forgot to add the using() clause as I'm using tiny local postgres and huge remote oracle (read mostly) and oracle won't be default. Foo.objects.using('svfe').all().order_by('-udate', '-time')[:5]; can I somehow configure it using the model? Something like in the Meta: using = 'svfe' so it sticks to future queries? I couldn't find such a possibility, only writing complicated decisions made by a router, or do it manually as above. There's really no reason for "using" to be dynamic in my case. -- 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: Oracle schema not working
BTW, simple db_table = 'foo' worked fine. -- 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: django site upload
The same question bother me too , now I trying to figure out today ! 2012/6/5 Mario Gudelj > Upload to where? What's confusing you? > > > On 5 June 2012 02:17, AJAYI THEOPHILUS wrote: > >> I am a newbie to django and i need help on site upload >> >> -- >> 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. > -- 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.
list of year form
Hi All, I want to create list of year select form. I know that i can generate the value using html. Is there a way to generate the value using forms API. For example, i want to generate select field that display year from 1970-2011. 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: list of year form
On Tue, 2012-06-05 at 10:04 +0700, subtitle indo wrote: > I want to create list of year select form. > I know that i can generate the value using html. > Is there a way to generate the value using forms API. > > For example, i want to generate select field that display year from > 1970-2011. I do not know if this is pythonic def currentyear(): return datetime.today().year BIRTH_YEARS = [(x,y) for x,y in enumerate(range(1970,currentyear()+1))] -- regards Kenneth Gonsalves -- 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: list of year form
On Monday, June 4, 2012, 11:04:58 PM, you wrote: > Hi All, > I want to create list of year select form. > I know that i can generate the value using html. > Is there a way to generate the value using forms API. > For example, i want to generate select field that display year from 1970-2011. > Thanks What about using the 'SelectDateWidget' widget from 'django.forms.extras.widgets'? You could so something like: You can pass a list of years to the constructor. Something like: from django.forms.extras.widgets import SelectDateWidget class MyForm(forms.Form): ... date = forms.DateField(widget=SelectDateWidget(years=range(1970, datetime.today().year))) ... Take a look at the source code of the widget. For example, some time ago I created my own SelectDateWidget to override the 'none_value' it places by default (---). -- Oscar Mederos omede...@gmail.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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: PyPm / Django 1.4?
On Mon, Jun 4, 2012 at 2:48 AM, Aaron C. de Bruyn wrote: > On Sat, Jun 2, 2012 at 9:43 AM, Bill Freeman wrote: >> Have you considered running under a virtualenv and pip installing >> exactly what you need? > > Yes--that's what I may end up doing. Just trying to remove a few > steps from the 'install procedure' for a user that already doesn't > like the CLI. > > Thanks, > > -A > If the CLI is the only thing stopping others from setting up the server, then why not write up a neat little installer with a desktop shortcut to run the Django server? Easiest method would be to use NSIS to create the installer, bootstrapping on the packages needed from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/ Alternatively if you have a bit more time on hand (or your compilers and whatnot are already setup) bootstrap MinGW onto your NSIS and set the PATH and modify the necessary Python files accordingly. Then you wouldn't need to bootstrap anything but distribute (http://packages.python.org/distribute/) and then you can just silently run all the pip's and have it virtualenv'd all the way down to a Desktop shortcut :) -- 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.