Re: Test response context & template always as lists?
Right! Meant to but hit the wrong list. Please ignore this thread... On Jul 14, 9:42 pm, theju <[EMAIL PROTECTED]> wrote: > Probably this post would be best answered on the Django-developers > list. > > Cheers > Thejaswi Puthraya --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: SQL VIEWs as Django Models for aggregation --- delete() issues with django.db.models.query: delete_objects
On 7/13/07, JeffH <[EMAIL PROTECTED]> wrote: > > This post relates to two separate Django issues that intertwined for > me: > 1. Lack of aggregation support in Django's ORM > (I am delighted to see > http://groups.google.com/group/django-developers/browse_thread/thread/f433edf7b0ebdbcb/ > ) For the record, I'm still keen to get aggregates supported in Django. After a few distractions along the way (the unicode and oracle branch merges), I believe Malcolm is currently working on the Query rewrite that is the prerequisite for aggregates. Hopefully I will get a chance to get some aggregates happening in the near future (but I've said that before... :-) > I would like to hear from others how they are dealing with #1 and what > their thoughts are about #2. When I need aggregates at the moment, I'm generally falling back into raw SQL, or occasionally using the extra() clause on a queryset. Using the 'extra' clause can get you where you want (annotated rows in a database) by adding items to the select clause, which will appear as extra attributes on objects from the query set. The difficulty comes in getting GROUP BY and HAVING clauses into your query. This is because Django doesn't currently have support for these clauses inside Q objects. You can cheat a little by exploiting the fact that WHERE clauses are the last in the chain, but it's not particularly robust approach to the problem. > Here goes: > Experimenting with ways to add aggregated database information into my > Django models, I came across a blog entry several weeks ago where the > author (my apologies for not having the reference to cite) said they > used VIEWs as Django Models, simply putting in the SQL code to drop > the table and create a like-named VIEW in sql/model_name as discussed > at > http://www.djangoproject.com/documentation/0.96/model-api/#providing-initial-sql-data > for providing initial data. This is certainly a novel approach. On the general topic - adding Django support for DB-level views is something I have had banging around in my brain for a while. Its an obvious blind spot in the existing functionality of Django, and it should be a relatively clean extension of the existing Model/metamodel framework. However, I haven't looked at the problem in detail, and probably won't have time to for a while. If someone else were to have a go at implementing support for Views, I'm sure it would be looked upon favorably. > My fix for this specific problem was to patch > django.db.models.query.delete_objects() to see if the related model > overrides the delete() method, and if so, use it instead of the > existing batch SQL DELETE approach: I'm not sure I'm wild about this as a solution to the problem. Deleting via a queryset is a 'bulk delete' operation, which is handled quite separately from a normal delete. Django deliberately doesn't call delete on individual objects in this case. If you are deleting a lot of objects, calling delete on each object to be deleted can easily be a very expensive operation, especially when you look at the signalling and processing overhead. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: python.py deserialization and handling foreign key fields ?
On 7/14/07, Etienne Robillard <[EMAIL PROTECTED]> wrote: > > Hi Russell, > > Thanks for responding to this thread. You were right > for the data not matching the model. The assumption that > some_model_instance.__dict__.keys() would return the fields names > is simply wrong. :) You can get the list of model fields from: some_model_instance._meta.fields and some_model_instance._meta.many_to_many This gives you the Field instance, which can tell you the field name, the data type, and provides handles for some datatype conversion (e.g., string to Python type, via to_python). > The issue is that it returns some ProgrammingErrors like: ... > ProgrammingError: invalid input syntax for integer: "0.1" > Looks like your data file contains a value of "0.1", but the field says it should be an integer. 0.1 isn't an integer, so Django throws an error. > I dont know if this thread should be in django-users, but my apologies > if this isnt the appropriate list for posting :) This is not a discussion of how to fix/improve Django itself, so django-users is the right forum. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: URL design for security?
On 7/14/07, Rogelio <[EMAIL PROTECTED]> wrote: > yet. I guess I was > thinking that even if the user was logged in, the URL still would be > showing potentially > sensitive info. I was thinking maybe I needed to create some random > sequence of > letters/numbers, store that in a model field and use it as the pk Use the default: http://www.djangoproject.com/documentation/model-api/#automatic-primary-key-fields A student's row number isn't sensitive. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Test response context & template always as lists?
Probably this post would be best answered on the Django-developers list. Cheers Thejaswi Puthraya --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Test response context & template always as lists?
Hi all, Playing around with the test client I found it frustrating that "context" can either be a single context or a list, depending on how the template is rendered. My feeling is they should always return lists. Likewise for the "template" field. I can see that no matter what there is a chance of the test breaking unexpectedly but I think it would happen less & coding would be simpler if those always returned lists. Should I write up a patch for this or is there a benefit to the current approach that I can't see? -rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Usernames with spaces?
I was more hoping for a solution that didn't require modifying the Django codebase. Perhaps I'll tinker and submit a patch if this is the only viable solution. On Jul 14, 1:38 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > I've noticed that within the admin interface, if you try to > > edit or add a username that has spaces in it, you get a > > validation error stating that there can be no spaces in > > usernames. However, if I edit the actual table data manually > > and try to login or perform other actions, everything seems > > to work fine. This seems to suggest that there might not be > > any problem with spaces in usernames. Is there a configuration > > directive for settings.py to allow spaces in usernames? Is > > there any way that one could be added if there isn't already? > > The Django auth module is just a standard Django app. If you > look in django/contrib/auth/models.py you'll see that the > User.username field is defined with a validator_list of > "[validators.isAlphaNumeric]". > > In theory, you should be able to remove this validator to allow > for any random characters your users want to masochistically > choose. I don't know if there are any ripple-down effects of > this, so you'll want to test the results. My first hunting would > be for places that a username is validated with a regexp, and > ensure that it matches whatever validator your username's > CharField describes. > > -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
newforms-admin: admin related field options
I am using the newforms-admin branch, which is really great. But I realized I still have admin specific fields options in my model, e.g. blank, choices. I am wondering where they really belong. Thanks, David S. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is there any host servers that supports Django based sites?
> Webfaction django hosting rocks. I second that. Truly professional, responsive, and helpful. Peace, David S. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: URL design for security?
Thanks for the replies. No, I haven't incorporated authentication yet. I guess I was thinking that even if the user was logged in, the URL still would be showing potentially sensitive info. I was thinking maybe I needed to create some random sequence of letters/numbers, store that in a model field and use it as the pk which would then up in the URL params. Probably overkill with my limited experience. I'll take a look at the authentication module and try some tests. Thanks again. Rog --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
www.OutpatientSurgicare.com/video/
www.OutpatientSurgicare.com/video/ Outpatient Doctors Surgery Center is committed to offering the healthcare the community needs. We offer patients a meaningful alternative to traditional surgery. This state-of-the-art outpatient surgery center, located in the heart of Orange County, at 10900 Warner Avenue, Suite 101A, Fountain Valley, Ca 92708, offers the latest innovations in outpatient surgery and technology. Please Call For Our Special Cash Discount Toll Free: 1-877-500-2525 Please Visit Our Websites: We offer extreme cosmetic surgery makeover packages. http://www.SurgeonToTheStars.com http://www.1cosmeticsurgery.com Specializing in the cure of hyperhidrosis, sweaty palms, underarm and foot sweating. http://www.CuresweatyPalms.com http://www.ControlExcessiveSweating.com No. 1 Weight Loss Surgery Center http://www.ControlWeightLossNow.com http://www.FreeLapBandSeminar.com Hernia Treatment Center http://www.HerniaDoc.com Take care of your feet http://www.CureFootPain.com The Experts in CARPAL TUNNEL SYNDROME http://www.CureHandPain.com Accidental Urine Leaks ? End Urinary Incontinence http://www.WomanWellnessCenter.com Hemorrhoid Treatment Center http://www.hemorrhoidtreatmentcenter.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Updating multiple rows with Django DB API?
On 7/14/07, Steven Hilton <[EMAIL PROTECTED]> wrote: > > I'm working on a web app where if a particular conditions is met in > particular object, a number of objects in another class/table need to > be altered. Basically a trigger, but I'm trying to keep all my logic > in the app for the time being. I'm wondering if there's a way to do > this with the Django DB API w/o falling back to raw sql. I did a quick search around, I think this is what you're looking for: http://www.mercurytide.co.uk/whitepapers/django-signals/ I read it, and sounds very cool! I don't know why there is no mention about it on the main documentation page. Miguel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: JavaScript in template
On 14 Lug, 23:20, Nathan Ostgard <[EMAIL PROTECTED]> wrote: > If you're using an SVN copy (not 0.96), there is already a context > processor for this. Add 'django.core.context_processors.media' to > TEMPLATE_CONTEXT_PROCESSORS in settings.py and you will be able to use > {{ MEDIA_URL }} in your templates. > > On Jul 14, 6:43 am, skam <[EMAIL PROTECTED]> wrote: > > > It's better to have the MEDIA_URL settings available in the request > > context. Write your own template context processor, so you could have > > {{ media_url }}/js/foo.js instead of hardcoding urls in templates. If > > you need to serve admin media from a separate server or change media > > directory you'll be able to change only the MEDIA_URL setting. Thank you, currently I'm not using the latest svn checkout for production sites Bye, Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is there any host servers that supports Django based sites?
It's a question of value to the customer. Of course they don't necessarily care about Django -- they care about the product. It's up to you to illustrate to them, using Django, that you can deliver a better product to them than the competition, and that the costs are worth it. I've found that the easiest way to do this with Django is through the rapid development process and the admin interface. If you don't want to deal with making them sign up for a new host, you could always sign up for the host yourself and pass the costs on to the customer. On Jul 14, 10:00 am, Michael <[EMAIL PROTECTED]> wrote: > > what i do is host on my own server until they are hooked on django > > and then they either twist their provider's arms or get a new provider] > > but how I can convince them to change provider? I mean, they could > hire some PHP programmer instead... > they don't really care about the Django advantages, they just want > their project to be done in time.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: JavaScript in template
If you're using an SVN copy (not 0.96), there is already a context processor for this. Add 'django.core.context_processors.media' to TEMPLATE_CONTEXT_PROCESSORS in settings.py and you will be able to use {{ MEDIA_URL }} in your templates. On Jul 14, 6:43 am, skam <[EMAIL PROTECTED]> wrote: > It's better to have the MEDIA_URL settings available in the request > context. Write your own template context processor, so you could have > {{ media_url }}/js/foo.js instead of hardcoding urls in templates. If > you need to serve admin media from a separate server or change media > directory you'll be able to change only the MEDIA_URL setting. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: About create a database table dynamicly
Generally, creating a table dynamically is the wrong thing to do. How will these tables differ from each other? For example, what user information is used to create the table? If each of the tables has the same structure, then you should create one table with an extra column to distinguish the different "tables". And what code will read and write the records in the table? Don't you need Django model classes to go with the new table? --Ned. nick feng wrote: > Hi, > > I had to create a table in the database according to the users' input > imformation. > Django seems has no topic about this, anyone has any idea on it?Thank you > > Best wishes, > Nick > > > -- Ned Batchelder, http://nedbatchelder.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Email processing
On 14 Lug, 21:43, Joe Beharriell <[EMAIL PROTECTED]> wrote: > Has anyone worked with processing inbound email messages through > Django? If so, can you offer any tips, tricks, or examples that may > help me with developing this further? Hello Joe, The email module of the python standard library allows to parse e-mail messages very easily. Currently I'm working in the spare time on a django-based webmail IMAP4 client using imaplib. The code is not very clean but you could have a look at http://code.google.com/p/django-mail/ to see how I'm doing email message parsing. IMAP has got some advantages over POP3 cause messages are stored directly on the mail server and you should be able to get parts without downloading the whole message. If you are looking to get SMSs you must have a direct connection to a SMSC gateway or an access to a SMS aggregator like Clickatell, MBlox or many others. Bye, Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Email processing
I'm currently working on custom-built CMS that will be used to power a local community website. Two of the biggest requests we've had for the new system are API support (quite a ways down our upcoming features list, but coming nonetheless) to allow posting from third-party applications and widgets, and posting via email (or SMS, though we'd be quite content with just email). Has anyone worked with processing inbound email messages through Django? If so, can you offer any tips, tricks, or examples that may help me with developing this further? Any information would be greatly appreciated. Joe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Avoiding HTTP 301 code using mod_python [SOLVED]
Well folks, with webfaction's support huge help, problem solved. The responsible for adding the port to the URL is: mod_dir! http://httpd.apache.org/docs/2.0/mod/mod_dir.html Quoting the documentation: "Provides for "trailing slash" redirects and serving directory index files" So mod_dir was returning the URL with the port, before even Django touches the URL. Disabling mod_dir solves the problem, and now the slash is appended correctly by CommonMiddleware. Thanks again for Webfaction's great support. On 7/13/07, Miguel Filho <[EMAIL PROTECTED]> wrote: > On 7/13/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > > > You might want to have a look at: > > > > http://www.djangoproject.com/documentation/settings/#append-slash > > > > Well just for the record, I have disabled CommonMiddleware and set > APPEND_SLASH to False, both changes didn't work, I still get the same > result. > > I have opened a ticket with webfaction.com, pointing this thread and a > topic on their forums describing the same problem, let's wait. > > Thanks for the replies > > Miguel > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Usernames with spaces?
> I've noticed that within the admin interface, if you try to > edit or add a username that has spaces in it, you get a > validation error stating that there can be no spaces in > usernames. However, if I edit the actual table data manually > and try to login or perform other actions, everything seems > to work fine. This seems to suggest that there might not be > any problem with spaces in usernames. Is there a configuration > directive for settings.py to allow spaces in usernames? Is > there any way that one could be added if there isn't already? The Django auth module is just a standard Django app. If you look in django/contrib/auth/models.py you'll see that the User.username field is defined with a validator_list of "[validators.isAlphaNumeric]". In theory, you should be able to remove this validator to allow for any random characters your users want to masochistically choose. I don't know if there are any ripple-down effects of this, so you'll want to test the results. My first hunting would be for places that a username is validated with a regexp, and ensure that it matches whatever validator your username's CharField describes. -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: model subclassing
Malcolm Tredinnick wrote: > On Fri, 2007-07-13 at 21:31 -0500, Carl Karsten wrote: >> I am experimenting with subclassing a model. The parent class will be an >> abstract class that does not get 'managed' by django. Only the subclass >> will, >> and the table the subclass works with will have all the fields. >> >> syncdb was able to create the table I expected, the admin let me add and >> save >> it, but then when I went to view it, error: >> >> ProgrammingError at /admin/core/message/1/ >> (1146, "Table 'djangodb.msg_abmessage' doesn't exist") >> >> (full details below) >> >> So is this just a small bug in the Admin, or is this totally unsupported and >> I >> should give up now? > > Currently unsupported. Work in progress at the moment and will be > available before 1.0. > I think what I am trying to do is getting tangled up in a big ball of problem, and what I am looking for might be a simple fix. (or even working except for a bug in the admin UI.) What follows is an attempt to isolate my problem from a bigger problem, which will also help with the bigger problem. I just read over http://code.djangoproject.com/wiki/ModelInheritance and http://groups.google.com/group/django-developers/browse_thread/thread/1bc01ee32cfb7374/84b64c625cd1b402?tvc=2=Model+Inheritance#84b64c625cd1b402 I see a design methodology problem: there are at least 3 problems (or features) trying to be addressed and I think they are separate enough problems to have separate solutions. I see more than one reasonable solution proposed. Each has something to offer the developer, not mutually exclusive, and can even work in conjunction. I think breaking ModelInheritance into well defined parts is important. looking at my problem: class abMessage(models.Model): to = models.ForeignKey(User, related_name = "messages_received") body = models.TextField() class message(msg.models.abMessage): status = models.CharField(maxlength=1) The problem/solution I am looking for: abstract base, concrete subclass, subclass is persisted in one table in the db. Yet this is the one case that was listed as "I am not implementing the "everything in one table" storage model." seems to me this should be one of the first things done, given how easy it is compared to the other solutions discussed. "(1) What notation to use to declare a class as abstract?" I think one of the problems trying to be solved here is: how do we keep django's syncdb, Admin UI and such from 'finding' such a class and trying to create a persistence for it. This problem may exist in non ModelInheritance situations too, making it part of the ModelInheritance problem may limit the usefulness of the 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Usernames with spaces?
I've noticed that within the admin interface, if you try to edit or add a username that has spaces in it, you get a validation error stating that there can be no spaces in usernames. However, if I edit the actual table data manually and try to login or perform other actions, everything seems to work fine. This seems to suggest that there might not be any problem with spaces in usernames. Is there a configuration directive for settings.py to allow spaces in usernames? Is there any way that one could be added if there isn't already? I've been building a MUD server with Django, so it'd be a really big plus to allow this flexibility for usernames, since few people actually want an underscore instead of a space, and I'd rather not have to manually butcher the names (as that may confuse some, and it's just sloppy). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is there any host servers that supports Django based sites?
> > what i do is host on my own server until they are hooked on django > and then they either twist their provider's arms or get a new provider] but how I can convince them to change provider? I mean, they could hire some PHP programmer instead... they don't really care about the Django advantages, they just want their project to be done in time.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Python Developer Position in LA
DigiSynd is an experienced team of Los Angeles-based digital pioneers with a unique vision: to create, produce, syndicate, and market online entertainment. DigiSynd uses time-honored storytelling techniques and valuable lessons from traditional media, but applies them in a medium of online communities, virtual experiences, interactivity, viral marketing and user-generated content. We're based in LA, Burbank - across the street from the Warner Bros Lot. We're seeking a seasoned python developer. Ideally you have: * a passion for Django or/and Twisted * exceptional SQL skills * experience with capturing, and reporting off `massive` datasets in real time * extensive experience with web services - both creating and utilising * a preference for MySQL and Ubuntu * strong bash scripting * experience with distributed version control We really want someone local here in LA, however relocation is a possibility for the right candidate. We're a small, energetic team, with a heap of interesting problems to solve in a very entertaining space. If interested, please send your resume as pdf, html or txt to [EMAIL PROTECTED] We'd love to hear from you. cheers, Andy Gayton. VP, Engineering - Digisynd, inc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: About create a database table dynamicly
Hi Carl, Thank you, I have resended the mail again, thanks . best wishes, nick - Original Message - From: "Carl Karsten" <[EMAIL PROTECTED]> To:Sent: Sunday, July 15, 2007 12:33 AM Subject: Re: About create a database table dynamicly > > > nick feng wrote: >> Hi, >> >> I had to create a table in the database according to the users' input >> imformation. >> Django seems has no topic about this, anyone has any idea on it?Thank you > > im guessing you hit reply and changed the subenct, which buried your question > in > someone else's. aka hijacking a thread. > > you may want to post again, but use the > To post to this group, send email to django-users@googlegroups.com > that is at the bottom of all messages. > > Carl K > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Database setup
surfwizz wrote: > I'm trying to do the django tutorial at > http://www.djangoproject.com/documentation/tutorial01/, > but I don't know how to set up a database. I do not have a dedicated > server or web hosting at this time, and I want to do some work on > setting up a website with database systems before I get web hosting. > Can I make a database stored locally? if yes, how? # settings.py ... DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. DATABASE_NAME = 'foo' ... That is all you need (for DATABASE settings) syncdb will create the database for you (called 'foo' in your project dir. which is fine for now.) All that other stuff postdd is correct, but probably over your head at this point, so don't worry about it if you didn't understand. Carl K --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Best Practice for translating db-stored values
Using gettext_lazy, is the way to go, for marking models and fields for translation. Is there some general suggestion we're to follow, for translating values stored in the db? ie, let's say it's a model: class Furniture(models.Model): name = models.CharField(_('name'), maxlength=25) If the app supports more than one language, how are we to get the translated versions of a value, ie: >>> furniture = Furniture.objects.get(id=1) >>> car.name >>> 'chair' should I define a translation variable so I'll be able to get the translated version from the template? Adding a new field just for name_another_lang, sounds like overkill, not extendable. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
newforms: bound forms and prefix parameters
Hi Folks, While implementing a form with edit inline like functionality, I've hit a wall. In order to tell apart each inline model, I am using the "prefix" parameter to instantiate the form. It works, but if it's a bound form (whether from instance or getting values from a dict), if I pass it a prefix, the rendered form shows empty values. This is easy to test: def test_prefix(request): f = forms.form_for_instance(request.user)(prefix="user_1") return render_to_response("test.html", {"f":f}) but if I omit the prefix such as in f = forms.form_for_instance(request.user)() the form renders correctly. (the html inputs show the right value) Is there a catch here? I am sure this works, since the newforms-admin must be using prefix to avoid name clashes when retrieving data from the form. Thanks, Arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: using middleware vs. context_processors: best practice?
On 7/14/07, Amit Ramon <[EMAIL PROTECTED]> wrote: > 1. The language must be set before creating the menu (so the menu will be in > the correct language). I assume that middleware gets called before context > processors. Am I right here? Yes. > 2. I noticed that the middleware is called for every request - this means that > if I access a page which loads additional stuff - for example images, or css > files, the middleware is called multiple times. At least in my case, I only > need my custom middleware to be called once for every page. Am I paying > anything by this behavior (performance wise, of course)? If this is the case, it means you're using Django to serve media, which you shouldn't do if you can avoid it. Django is for dynamic stuff, and media is generally static. Change your server config, and media will be a lot faster. > 3. A more general question: the menu changes very rarely. How my design > affects performance? I mean, is there a db access for every page, or is there > some caching? While I understand the menu is somewhat dynamic, you might consider making this a template tag that does it's own caching: http://www.djangosnippets.org/snippets/223/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: URL design for security?
> So my newbie question is: Is there a way a better way to design/ > obfuscate the URL scheme when dealing with sensitive information? I > know once I get some sort of authentication in place that will help, > but the idea of showing sensitive info in a URL still has me > concerned. The simple answer is "don't put anything sensitive in the URL". In this case, that would mean not exposing things like SSNs in the URL. Since the teacher_id/student_id isn't sensitive, they're fine in the URL. However, you don't want people accessing these URLs if they're not permitted to access them. Enter Django's contrib.auth module. Using Django's built-in "auth" module, it's dead-easy to do and allows you to decorate your views with "login_required". For some example code, I'm just guessing at your models, but if one student can have more than one teacher (as is often the case), you'd have a M2M relationship between them. However, if grades are related to this relationship, you'd have to jockey the M2M yourself. I assume models like # models.py class Teacher(Model): user_id = ForeignKey(auth.User) # rest of definition class Student(Model): # definition class Class(Model): # don't know if this name is bad student = ForeignKey(Student, related_name='classes') teacher = ForeignKey(Teacher, related_name='classes') # rest of definition class Grades(Model): class = ForeignKey(Class) grade = CharField(...) # views.py from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404 @login_required dev view_grades(request, student_id): # you don't need the teacher's ID in the URL # because they're linked to the request.user # the query would then look something like this try: student_id = int(student_id) except: raise Http404 this_teachers_students = \ Student.objects.select_related().filter( classes__teacher__user_id = request.user.id ) student = get_object_or_404( this_teachers_students, student_id ) ... If the user isn't logged in and tries to request the view, they get redirected to the login form. If the user is logged in, but doesn't teach this student, they should get a 404, because for them, this student doesn't exist. You could customize it and return a more truthful HTTP error such as a 403 (Forbidden) because the object might or might not be found, but either way, they're not permitted to go poking around here. -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is there any host servers that supports Django based sites?
On 14-Jul-07, at 6:10 PM, Michael wrote: > for costumers that already have some of hosting service, the chance > that they use a hosting service from that list is very low, almost > zero. > > That's means that I can't use Django or any other python-based > framework for my job ? > I'm asking all the programmers that work for other people, how do you > work with Django? what i do is host on my own server until they are hooked on django and then they either twist their provider's arms or get a new provider -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
About create a database table dynamicly
Hi, I had to create a table in the database according to the users' input imformation. Django seems has no topic about this, anyone has any idea on it?Thank you Best wishes, Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
About create a database table dynamicly
Hi, I had to create a table in the database according to the users' input imformation. Django seems has no topic about this, anyone has any idea on it?Thank you Best wishes, Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Database setup
> Sure you can. You might want to look at sqlite, as it's the > easiest to set up. You can painlessly switch to a "better" > database engine when going to production, though sqlite does > quite well the job, even in production. I second Christian's suggestion of using sqlite for its minimal-fuss configuration (the OS permissions for the web-server/django process on the database file are the permissions you get). It even has a ":memory:" database which is handy for testing purposes (never touching a file). I would add a small caveat to "painlessly": it's painless unless you try and monkey with the underlying SQL through either an extra() call or hacking the ORM, both of which I do far too regularly. If you mess with either of these more obscure corners of Django (okay, the extra() isn't obscured as it's right there in the docs, but not many folks seem to know about it or use it), you just have to be careful that your SQL is portable across the various servers you expect to support. However, if you avoid touching DB specific code, the Django ORM does a rather good job of abstracting most of this stuff away so your code becomes portable across DB engines. -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Database setup
Sure you can. You might want to look at sqlite, as it's the easiest to set up. You can painlessly switch to a "better" database engine when going to production, though sqlite does quite well the job, even in production. surfwizz escribió: > I'm trying to do the django tutorial at > http://www.djangoproject.com/documentation/tutorial01/, > but I don't know how to set up a database. I do not have a dedicated > server or web hosting at this time, and I want to do some work on > setting up a website with database systems before I get web hosting. > Can I make a database stored locally? if yes, how? > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Updating multiple rows with Django DB API?
I'm working on a web app where if a particular conditions is met in particular object, a number of objects in another class/table need to be altered. Basically a trigger, but I'm trying to keep all my logic in the app for the time being. I'm wondering if there's a way to do this with the Django DB API w/o falling back to raw sql. A basic example is: table foo --- id name level table bar - id name foo_id switch When foo.level drops to zero, I need to flip bar.switch like so... update bar set switch = 0 where foo_id = foo.id and switch = 1 I could be updating any number of rows in bar. I want to do this without do a select on bar. Do I need to drop to raw sql, or have I missed this part of the Django documentation? Thanks for any feedback. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Database setup
I'm trying to do the django tutorial at http://www.djangoproject.com/documentation/tutorial01/, but I don't know how to set up a database. I do not have a dedicated server or web hosting at this time, and I want to do some work on setting up a website with database systems before I get web hosting. Can I make a database stored locally? if yes, how? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: URL design for security?
Are you using authentication? It's better to handle security policies in your application instead of hiding informations in URLs Have a look at http://www.djangoproject.com/documentation/authentication Bye, Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: JavaScript in template
It's better to have the MEDIA_URL settings available in the request context. Write your own template context processor, so you could have {{ media_url }}/js/foo.js instead of hardcoding urls in templates. If you need to serve admin media from a separate server or change media directory you'll be able to change only the MEDIA_URL setting. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: installation issues
I think that the install from the website instructions worked. Your code helped me understand what I needed to do. thanks! On Jul 14, 6:04 am, Carl Karsten <[EMAIL PROTECTED]> wrote: > Ok, getting somewhere. That is the dir that needs to know about django. > > Next we need to know where django is, and 'install' that into the > site-packages > dir. 'install' is just a link, .pth file or putting django directly in that > dir. I recommend the link. > > more details are > here:http://www.djangoproject.com/documentation/install/#install-the-djang... > > if you still have problems, post the following: > 1. What version of django you want (official release, or development version.) > 2. Where the django code is > 3. what django references are currently in your site-packages dir. > > For #3, do ls -ld django* in your site-packages dir, like this: > > [EMAIL PROTECTED]:~$ python -c "from distutils.sysconfig import > get_python_lib; print > get_python_lib()" > /usr/lib/python2.5/site-packages > > [EMAIL PROTECTED]:~$ cd /usr/lib/python2.5/site-packages > > [EMAIL PROTECTED]:/usr/lib/python2.5/site-packages$ ls -ld django* > lrwxrwxrwx 1 root root 36 2007-06-25 23:30 django -> > /home/carl/django/django-src/django/ > > Carl K > > surfwizz wrote: > > Sorry about that. Thanks for the tip on using copy/paste. Here's the > > result for that: > > new-host-3:~ wdavis$ python -c "from distutils.sysconfig import > > get_python_lib; print get_python_lib()" > > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- > > packages > > > On Jul 13, 6:49 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: > >> you missed the -c > > >> guessing you need to figure out how to cut/paste into your terminal. I > >> think it > >> is action-v for paste, where action is the cloverleaf. > > >> Carl K > > >> surfwizz wrote: > >>> Here's what that looks like: > >>> new-host-3:~ wdavis$ python "from distutils.sysconfig import > >>> get_python_lib; print get_python_lib()" > >>> /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/ > >>> Contents/MacOS/Python: can't open file 'from distutils.sysconfig > >>> import get_python_lib; print get_python_lib()': [Errno 2] No such file > >>> or directory > >>> new-host-3:~ wdavis$ > >>> On Jul 13, 6:16 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: > run this command, show us what you get: > python -c "from distutils.sysconfig import get_python_lib; print > get_python_lib()" > So like this: > [EMAIL PROTECTED]:~$ python -c "from distutils.sysconfig import > get_python_lib; print > get_python_lib()" > /usr/lib/python2.5/site-packages > Carl K > surfwizz wrote: > > I could not find any folders at the lib location. To clarify how the > > IDLE thing went, I tried running sudo python setup.py, but it didn't > > work, so I opened setup.py in IDLE, Then went to 'run', in the > > menubar, and clicked 'run module'. It prompted me to save it, so I > > did. that was the whole python IDLE thing with this. > > On Jul 13, 3:40 am, "Dirk van Oosterbosch, IR labs" > > <[EMAIL PROTECTED]> wrote: > >> On 13-jul-2007, at 5:42, surfwizz wrote: > >>> I installed python fromwww.python.org, so the command prompt opens it > >>> into 2.5.1. That's what I tried to install django into. > >> Can you confirm that django is installed at this location? > >> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- > >> packages/django/ > >> (try 'locate django' in the Terminal to find out where all of django > >> is) > >>> [...] so I just ran setup.py in IDLE as a module. Is there a way > >>> to fix this, or get this install running properly? > >> What do you mean 'in IDLE as a module'? AFAIK the correct way to > >> install python packages is to run 'sudo python setup.py' from the > >> normal command line. Or did you do that? > >> best > >> dirk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
URL design for security?
Hi, I'm starting to write a grade book type application. There will be many teachers that will be logging in to access their student records. The student record will contain student grades and sensitive info such as student ID number. In the model each teacher will have a primary key (pk) and each student will have a primary key. So if teacher (with pk=21) logs in and wants to update the grade for student (pk=197), the URL I'm calling to retrieve that view is "/grades/ 21/197" (ie, on the teacher page there would be a list of student names each being an as shown). I feel like by using this scheme I'm giving away too much info in the URL. Some other teacher (or person) who is NOT teacher (pk=21) could just enter that URL and look at some other teacher's grades just by "guessing" what pk to plug into the URL. What if the student pk was actually his SSN, then I wouldn't want that as part of the URL for sure. So my newbie question is: Is there a way a better way to design/ obfuscate the URL scheme when dealing with sensitive information? I know once I get some sort of authentication in place that will help, but the idea of showing sensitive info in a URL still has me concerned. Thanks in advance. Rog --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django + newforms + jQuery
On 12 Lug, 08:42, Przemek Gawronski <[EMAIL PROTECTED]> wrote: > Hi, any one willing to share some examples of django newforms with > jQuery? Few months ago I posted on djangosnippets.org a widget that uses the jquery autocomplete plugin written by Jörn Zaefferer, have a look at http://www.djangosnippets.org/snippets/233/ Bye, Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is there any host servers that supports Django based sites?
On 7/14/07, Michael <[EMAIL PROTECTED]> wrote: > That's means that I can't use Django or any other python-based > framework for my job ? If the host does not offer Python, you cannot use a Python-based framework. > I'm asking all the programmers that work for other people, how do you > work with Django? For anything other than a personal site, I recommend having at least a VPS or dedicated server; for anyone doing business on the web, there shouldn't even be any question about this, no matter what technology's being used -- the level of flexibility offered by dedicated hosting costs money, but is well worth it. Back when I was freelancing, the way I explained hosting to clients was like this: Your web site is how you present yourself to the world. If you were running a business with a physical office, you certainly wouldn't expect to find free office space or a free retail location -- you'd expect to pay money to rent space, and you'd understand that the quality of that location will impact the price. And if you want to be successful, you'll invest some money up-front to have space in a well-maintained building with a good location. Free or cheap web hosts, in this analogy, are the online equivalent of run-down buildings in bad parts of town; no matter how hard you work, the limitations of the location are always going to be apparent to your customers and are always going to hinder you in offering them the best experience. So just as you'd invest more money to get a nicer real-world location for a business, you'll want to invest more money to get a higher quality hosting service; the increased flexibility it offers in terms of improving visitor/customer experience will quickly pay back the cost of the hosting, and then some. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: installation issues
Ok, getting somewhere. That is the dir that needs to know about django. Next we need to know where django is, and 'install' that into the site-packages dir. 'install' is just a link, .pth file or putting django directly in that dir. I recommend the link. more details are here: http://www.djangoproject.com/documentation/install/#install-the-django-code if you still have problems, post the following: 1. What version of django you want (official release, or development version.) 2. Where the django code is 3. what django references are currently in your site-packages dir. For #3, do ls -ld django* in your site-packages dir, like this: [EMAIL PROTECTED]:~$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" /usr/lib/python2.5/site-packages [EMAIL PROTECTED]:~$ cd /usr/lib/python2.5/site-packages [EMAIL PROTECTED]:/usr/lib/python2.5/site-packages$ ls -ld django* lrwxrwxrwx 1 root root 36 2007-06-25 23:30 django -> /home/carl/django/django-src/django/ Carl K surfwizz wrote: > Sorry about that. Thanks for the tip on using copy/paste. Here's the > result for that: > new-host-3:~ wdavis$ python -c "from distutils.sysconfig import > get_python_lib; print get_python_lib()" > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- > packages > > > On Jul 13, 6:49 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: >> you missed the -c >> >> guessing you need to figure out how to cut/paste into your terminal. I >> think it >> is action-v for paste, where action is the cloverleaf. >> >> Carl K >> >> surfwizz wrote: >>> Here's what that looks like: >>> new-host-3:~ wdavis$ python "from distutils.sysconfig import >>> get_python_lib; print get_python_lib()" >>> /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/ >>> Contents/MacOS/Python: can't open file 'from distutils.sysconfig >>> import get_python_lib; print get_python_lib()': [Errno 2] No such file >>> or directory >>> new-host-3:~ wdavis$ >>> On Jul 13, 6:16 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: run this command, show us what you get: python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" So like this: [EMAIL PROTECTED]:~$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" /usr/lib/python2.5/site-packages Carl K surfwizz wrote: > I could not find any folders at the lib location. To clarify how the > IDLE thing went, I tried running sudo python setup.py, but it didn't > work, so I opened setup.py in IDLE, Then went to 'run', in the > menubar, and clicked 'run module'. It prompted me to save it, so I > did. that was the whole python IDLE thing with this. > On Jul 13, 3:40 am, "Dirk van Oosterbosch, IR labs" > <[EMAIL PROTECTED]> wrote: >> On 13-jul-2007, at 5:42, surfwizz wrote: >>> I installed python fromwww.python.org, so the command prompt opens it >>> into 2.5.1. That's what I tried to install django into. >> Can you confirm that django is installed at this location? >> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- >> packages/django/ >> (try 'locate django' in the Terminal to find out where all of django is) >>> [...] so I just ran setup.py in IDLE as a module. Is there a way >>> to fix this, or get this install running properly? >> What do you mean 'in IDLE as a module'? AFAIK the correct way to >> install python packages is to run 'sudo python setup.py' from the >> normal command line. Or did you do that? >> best >> dirk > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
using middleware vs. context_processors: best practice?
Hello, I'm working in a multilingual site, for which I have the following two requirements: 1. The language to use for content and ui is derived from the url. 2. All pages (rendered by different views) have a "constant" part - menu, title, etc. The menu is stored in the database (it's simply another model), and I have a function that creates the menu and I pass it to the template in the extra_context. Following a tip from Malcolm (thanks!), in order not to repeat code for doing 1 in each and every view, I created a custom middleware that sets the language in its process_view method. I thought I would do the same for 2, but I just found out that I can also use a custom context_processor for it, which seems more natural for the case. Anyway, I have some questions: 1. The language must be set before creating the menu (so the menu will be in the correct language). I assume that middleware gets called before context processors. Am I right here? 2. I noticed that the middleware is called for every request - this means that if I access a page which loads additional stuff - for example images, or css files, the middleware is called multiple times. At least in my case, I only need my custom middleware to be called once for every page. Am I paying anything by this behavior (performance wise, of course)? 3. A more general question: the menu changes very rarely. How my design affects performance? I mean, is there a db access for every page, or is there some caching? I'm not too familiar with what's going on behind the scenes, and I would appreciate if someone would shed some light on this issue. Sorry for the long story... Thanks, Amit --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is there any host servers that supports Django based sites?
On Jul 14, 2:24 pm, theju <[EMAIL PROTECTED]> wrote: > Hi Michael, > Quite a few hosting services support Django (and also mod_python). > Here is the list of Hosting Providers from the Django > Websitehttp://code.djangoproject.com/wiki/DjangoFriendlyWebHosts Thanks, I already saw that list, it's useful when you build your own site and searching for a hosting service. It's not so useful for me because my main job is to build web-sites for costumers that already have some of hosting service, the chance that they use a hosting service from that list is very low, almost zero. That's means that I can't use Django or any other python-based framework for my job ? I'm asking all the programmers that work for other people, how do you work with Django? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django + newforms + jQuery
Przemek Gawronski wrote: > > What I'm looking for now is, how to redirect to a different page with > the button, and sending to the page (django view) the id number. > > Przemek If you don't want to use ajax you can either use a form as normal to submit it and then issue a redirect at the server side to the new page or call a javascript function to issue a window.Location to fetch a new page or use image buttons that are inside a HTML link etc. It's really up to you how you want to "load" the new page. If you just want to fetch more data using ajax then you could use something like: (this is just a simple test example from my code) $("#newfeaturesave").click(function() { var newfeat = $("#id_name").val(); var newval = $("#id_value").val(); var staffid = $("#id_staffid").val(); $.ajax({ url:"/stafffeature/add/"+staffid+"/", type: "POST", datatype: "html", data: {name:newfeat,value:newval}, success: function(row){ $("#featuretable tbody tr:last").after(row); $("#featuretable tbody tr:last").prev().remove(); $("#featuretable tfoot").show(); $("#featuretable tbody tr:last .griddelbtn").click(function(){ dofeaturedelete(this); }); $("#featuretable tbody tr:last .grideditbtn").click(function(){ dofeatureedit(this); }); stripetable("#featuretable"); }, error: function(XReq, errs, errobj){ alert(XReq.statusText+'\r\n'+XReq.responseText); } }); }); Of course you will want to read the JQuery docs to find all the possibilites for your situation. Regards, Gary. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django + newforms + jQuery
> I'm assuming that you want to use some form a AJAX type request/response > for this? Well, once I'll feel comfortable with django and js, then probably, but not at the moment. > As an outline you might want to do something like this: > Display your list as a table > Use your workorder id as the html row id of each row in the table > Set each of your buttons that do different action to a css class (say > "delbtn" for delete buttons etc. > Use JQuery to attach a click handler function to each button class, one > call per class. > In the click handler function, find out which row is selected and get > it's id. I've got that done now. What I'm looking for now is, how to redirect to a different page with the button, and sending to the page (django view) the id number. Przemek -- AIKIDO TANREN DOJO - Poland - Warsaw - Mokotow - Ursynow - Natolin info: http://www.tanren.pl/ phone: +4850151 email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is there any host servers that supports Django based sites?
Hi Michael, Quite a few hosting services support Django (and also mod_python). Here is the list of Hosting Providers from the Django Website http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts On Jul 14, 4:09 pm, Michael <[EMAIL PROTECTED]> wrote: > I've been searching for free hosting services that supports > Mod_Python, I never find one. Well even I haven't found a free Django hosting site yet. ;-) > In addition, there are few non-free hosting services that supports it. > > so, let's say I'm building a Django based site for my costumer, the > costumer knows nothing about computers so he don't care about the > programming language, however, > in most cases the hosting service he uses won't allow python scripts. > thats a problem. > > how can I solve this problem? can I run my Django-based site on a > server that supports > FastCgi, but has no python installed at all? [that's the situation on > most cases, Fcgi - ON, > python - OFF ] I am really not sure of this question but according to what http://www.djangoproject.com/documentation/fastcgi/ says I don't think it is possible to deploy without python (I might be wrong as well). Cheers Thejaswi Puthraya --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
is there any host servers that supports Django based sites?
I've been searching for free hosting services that supports Mod_Python, I never find one. In addition, there are few non-free hosting services that supports it. so, let's say I'm building a Django based site for my costumer, the costumer knows nothing about computers so he don't care about the programming language, however, in most cases the hosting service he uses won't allow python scripts. thats a problem. how can I solve this problem? can I run my Django-based site on a server that supports FastCgi, but has no python installed at all? [that's the situation on most cases, Fcgi - ON, python - OFF ] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: JavaScript in template
Now that was quick! Big thanks! Przemek -- AIKIDO TANREN DOJO - Poland - Warsaw - Mokotow - Ursynow - Natolin info: http://www.tanren.pl/ phone: +4850151 email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: JavaScript in template
It is better you refer to the Django Documentation on serving static files http://www.djangoproject.com/documentation/static_files/ for greater clarity. Anyways here is the solution below: On Jul 14, 2:47 pm, Przemek Gawronski <[EMAIL PROTECTED]> wrote: > Hi, how do I specify the source of JS scripts in my templates? > > In my settings.py I've got: > > MEDIA_ROOT = '/home/django/work/fw/media/' > MEDIA_URL = 'http://192.168.1.1' > ADMIN_MEDIA_PREFIX = '/media/' > > In the template (base.html): > Make the following change in your urls.py file. (r'^js/(?P.*)$', 'django.views.static.serve',{'document_root': '/ home/django/work/fw/media/'}) and replace in the base.html > I've put the script in both MEDIA_ROOT and ADMIN_MEDIA_PREFIX, but in > either case the script isn't found :( Do not place the JS files in the ADMIN_MEDIA_PREFIX files. It is specifically for files needed by the admin section. Cheers Thejaswi Puthraya --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
JavaScript in template
Hi, how do I specify the source of JS scripts in my templates? In my settings.py I've got: MEDIA_ROOT = '/home/django/work/fw/media/' MEDIA_URL = 'http://192.168.1.1' ADMIN_MEDIA_PREFIX = '/media/' In the template (base.html):
Re: Difference between a model's field and it's translated version - admin
Thanks for pointing this out for me mate. I can't afford to switch to the trunk right now, but it's good to know that it has been taken care of. On Jul 14, 6:44 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-07-13 at 16:19 +, Panos Laganakos wrote: > > If I have the model specified as: > > > class Candy(models.Model): > > name = models.CharField(_('name'), maxlength=25) > > > The admin section, displays the field as, 'Name', while the translated > > version will appear as 'onoma', ie, the first letter isn't > > capitalized. > > > The translated word is specified all lower-case in the .po file. > > > Is it possible to have the admin section, display it with the first > > letter capitalized when appropriate? > > This has been fixed on trunk. There were a number of problems with > delayed translations in cases like thisback in 0.96. The Unicode merge > should have fixed all the known ones. > > Regards, > Malcolm > > -- > Success always occurs in private and failure in full > view.http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: confused about the order of the CacheMiddleware in MIDDLEWARE_CLASSES
Can any body give me some help information? Thanks very much On 7月13日, 下午3时06分, Mesh007 <[EMAIL PROTECTED]> wrote: > Hi, all: > > I touch django not long before, and am learning it, when i touch the > CacheMiddleware, i am confused confused about the order of the > CacheMiddleware in MIDDLEWARE_CLASSES > > It is say: "Put the CacheMiddleware after any middlewares that might > add something to the Vary header. " in the > documentation(http://www.djangoproject.com/documentation/0.96/cache/) > > because SessionMiddleware and GZipMiddleware add Vary header, so, i > code below in my settings.py: > MIDDLEWARE_CLASSES = ( > 'django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.middleware.cache.CacheMiddleware', > ) > but it doesn't work well, I use > "request.COOKIES.get('sessionid','null') " show the sessionid on page, > but it show the same value on different browser(the real session id is > not that showd on page), it seem it should save differrnt version > cache based vary header, In browser the vary header is Cookie > > I see the codes below in file django/core/handlers/base.py (svn > version) > 47th line: self._response_middleware.insert(0, > mw_instance.process_response) > > Is it means from bottom from top middleware in MIDDLEWARE_CLASSES > when process the response? > so i guess that the CacheMiddleware should put before the > SessionMiddleware, because the SessionMiddleware add cookie vary > header, so the CacheMiddleware can get the vary header added by the > SessionMiddleware in response object, but , i not sure,. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django on FreeBDS
Hi, On Jul 14, 8:52 am, Przemek Gawronski <[EMAIL PROTECTED]> wrote: > Hi, a hosting company has installed django for me on their system > (FreeBSD 6.2-RELEASE-p5). When I try to run (ssh under jailshell): > bytes += read(_urandomfd, n - len(bytes)) > OSError: [Errno 6] Device not configured I am not expert neither in Jail or FreeBSD, but it seems obvious that they did not configured "random" device into jail. So I think you shoul ask them to include support for random into jail. May be even simple thing like: mknod dev/random c 1 8 under 'root' of this jail will help you, but I am not sure and probably you can try and if not works, ask FreeBSD expert. Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---