Re: What do you use for design interface / mockup
At the risk of being flamed, I'd say that nothing is better than OmniGraffle. That aside, both Gimp and Dia are cross-platform and very reasonable choices. They may not fit the Mac gui, but they work well enough if cross-platform is a higher priority than best-of-breed. You can get the job done with them. If cross-platform is not your highest priority, I'd pick OmniGraffle and Acorn, with Photoshop and such as the big guns, as required. Though, there's a lot to be said for wireframing in HTML, and for paper prototypes. ---Peter On 10/23/08, Gerard Petersen <[EMAIL PROTECTED]> wrote: > > Francis, > > I'm not a designer but I start my global layout on paper or in my head and > then it's (x)html and CSS. The first thing that comes to mind on doing this > electronically is photoshop (and siblings ... CS3?). And the Gimp but that > would not be a good choice on OSX (gui handling wise). > > Regards, > > Gerard. > > Francis wrote: >> Hi, >> >> What do you use for design interface / mockup? >> >> I made some search, omnigraph seems pretty popular. But I often switch >> between linux and Mac and omnigraffle isn't cross platform. >> >> Is there any tools out there that work on Mac OS X and Linux? (or >> something better than omnigraffle) >> >> Thank you >> >> >> >> > > > -- > urls = { 'fun': 'www.zonderbroodje.nl', 'tech': 'www.gp-net.nl' } > > > > > --~--~-~--~~~---~--~~ 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: Noon Help
I might also suggest django-registration (http://code.google.com/p/django-registration) to handle your user registration needs. On Mon, Oct 27, 2008 at 2:34 PM, Jeff Anderson <[EMAIL PROTECTED]> wrote: > Johnny Utah wrote: >> Thanks for the input. >> >> When you say Django.admin would be useful, do you mean users would >> access the admin interface? >> > Please respond to the list when asking further questions. > > That being said: no-- users shouldn't access the admin interface. Admins > should. It's there to make your life much easier, and it does that very > well. You'll still need to build views for your app, but if you need to > go in and change something manually, the admin interface is way better > than dropping to SQL. > > Jeff Anderson > > --~--~-~--~~~---~--~~ 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: psycopg2 Visual Studio installation error on XP
Hi DJ, Psycopg2 has a C extension wrapped by Python. That C extension must be compiled with the same compiler used to compile the Python compiler itself. This is not a Django issue, this is a psycopg issue. You should ask for assistance on the psycopg mailing list, they'll be better able to help you. You should also look around for pre-compiled binaries of psycopg2 for Windows, as the packagers will have taken this compiler mismatch issue into account. ---Peter On 11/17/08, dj <[EMAIL PROTECTED]> wrote: > > Hello All, > > I am django novice and i am very, very ,very, very green. > > I am trying to setup the PostgresSQL database with the psycopg2 > library. I downloaded the psycopg2-2.0.8.tar file. > Opened the tar with Winzip and installed the library from the command > line using python setup.py. I got this really strange error message. > > error: Python built with Visual Studio 2003; extensions must be built > with a complier than can generate compatiable binaries. Visual Studio > 2003 was not found on this system. If you have Cygwin installed, you > can tru compiling with MingW32, by passing "-c mingw32 to setup.py" > > I am not using Visual Studio for any of my development, I am using the > python. > Do I need to install Cywgin or is there a work around ? > > > --~--~-~--~~~---~--~~ 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: Setting Up Django on Vista and Creating a Database
The other thing that comes to mind is, have you installed the MySQLdb python library? If you want to connect to a database from a Python app, you must also install a library that bridges Python and the database. (I apologize in advance if you've already done so). ---Peter On 11/17/08, Karen Tracey <[EMAIL PROTECTED]> wrote: > On Mon, Nov 17, 2008 at 3:13 AM, John Antony <[EMAIL PROTECTED]> wrote: > >> >> I have currently created a database with the following details: >> DATABASE_ENGINE = 'mysql' >> DATABASE_NAME = 'myforum' >> DATABASE_USER = 'root' >> DATABASE_PASSWORD = 'myforum' >> DATABASE_HOST = 'localhost' >> DATABASE_PORT = '' >> > > Is this a cut and paste from your actual setting files? Because that > setting for DATABASE_ENGINE -- all lowercase mysql -- is correct. > > >> I used phpMyadmin to create the database >> >> I have updated C:\projects\myforum\settings.py in the similar >> fashion >> >> However when i run the the following command i get: >> >> C:\projects\myforum>python manage.py runserver >> Validating models... >> Unhandled exception in thread started by > 0x027CC670> >> Traceback (most recent call last): >> File "C:\Python26\Lib\site-packages\django\core\management\commands >> \runserver. >> py", line 48, in inner_run >>self.validate(display_num_errors=True) >> File "C:\Python26\Lib\site-packages\django\core\management\base.py", >> line 122, >> in validate >>num_errors = get_validation_errors(s, app) >> File "C:\Python26\Lib\site-packages\django\core\management >> \validation.py", lin >> e 22, in get_validation_errors >>from django.db import models, connection >> File "C:\Python26\Lib\site-packages\django\db\__init__.py", line 34, >> in > e> >>(settings.DATABASE_ENGINE, ", ".join(map(repr, >> available_backends)), e_user) >> >> django.core.exceptions.ImproperlyConfigured: 'MySQL' isn't an >> available database >> backend. Available options are: 'dummy', 'mysql', 'oracle', >> 'postgresql', 'post >> gresql_psycopg2', 'sqlite3' >> Error was: No module named MySQL.base >> > > Whereas what this is saying is that you have 'MySQL' set as your > DATABASE_ENGINE, and that is not correct. Case matters. What you have in > your settings file needs to be all lower case for the DATABASE_ENGINE > setting. > > Karen > > > > --~--~-~--~~~---~--~~ 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 and favicon.ico problem
I've done favicons as per Malcolm's suggestion, with a link in my base template to e.g. /media/images/favicon.ico, and that works satisfactorily for most cases. The favicon shows as expected in browser address bars, etc. However, since favicons arose via convention, where the convention was to place them in the root of the server, some old and/or stupid UAs still request them at /, rather than following the link. Which means I've received 404 emails. I haven't bothered to try fixing it yet, but I wonder if a redirect from /favicon.ico to /media/images/favicon.ico might solve that issue. If I get a chance I'll test it today, see if works. Has anyone else experimented with this? ---Peter On 12/16/08, Malcolm Tredinnick wrote: > > > On Tue, 2008-12-16 at 02:45 -0800, architecture wrote: >> i was working with php and always i put the favicon.ico in the root of >> the website but now the problem with django occurs >> now i'm working with django and i have a problem now >> i used >> 1. static.serve >> 2. .htaccess >> 3.redirect_to >> >> but none of them works have you any idea for using favicon.ico in the >> website > > There's nothing Django or PHP-specific about setting this up. However, > if you've configured your Django installation to control everything > under "/", then you'll need to make sure it also responds to request for > favico. > > An even easier solution is simply to put the favicon file wherever you > serve other static data from (e.g. where your stylesheets and images > are) and put a line in your base template to point > clients to the right location. > > Regards, > Malcolm > > > > > > --~--~-~--~~~---~--~~ 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: Do you recommend "Practical Django Projects"?
"Practical Django Projects" is a bit dated at the moment -- Django has been moving very quickly. However, there's a lot to learn from it, particularly regarding structuring your applications to be reusable, and lots of other best practices. I'm in the middle of "Python Web Development with Django" by Jeff Forcier, Paul Bissex and Wesley Chun, and while it almost covers 1.0, it was obviously written mostly before 1.0 and updated as and when possible. The lag time between manuscript completion and printing is long, so it's hard to be current considering Django's velocity. That said, it is a very good book, with some really good information in it. Admittedly I'm something of an infovore, so my response should be taken with a grain of salt, but if you have the time I'd recommend you work through Forcier, et al. and refer back to the online documentation as needed to flesh out individual topics. *Then* go back and take in James' book, sifting through it for the still-relevant pieces. But, if you've worked through the online tutorial, your best teacher will be a comprehensive project of your own. Pick something that you need, and write it. Refer back to the online docs for specifics, and ask questions as needed to fill in the blanks and keep you headed in the right direction. Experience is the best teacher, and if you already know Python reasonably well, Django will fit your Pythonic expectations well. On Mon, Jan 5, 2009 at 9:42 AM, brad wrote: > > > On Jan 5, 2:21 am, HB wrote: >> Do you recommend "Practical Django Projects" instead? > > I got this book as soon as it came out, and very soon after Django hit > 1.0. It's a good book, and I learned a few "big picture" ideas from > the sample apps, but I really had to read the docs to figure out how > to do the specifics. > > If you're looking for the "big picture", grab it from a library or > borrow it from a friend.. otherwise, wait for the next edition or just > read the docs (which are very excellent, btw). > > > > --~--~-~--~~~---~--~~ 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: static html
On Mon, Oct 13, 2008 at 8:36 AM, Alfredo Alessandrini <[EMAIL PROTECTED]> wrote: > > ok...it's work. > > but If I want customize the url by url.py? > > > Alfredo > If you really want to customize the URL with urls.py, then go ahead. But for URL customization with Apache, use mod_rewrite. It may be somewhat harder to learn the syntax, but by keeping your static files separate from your Django machinery, you'll have better overall server efficiency. On the other hand, if what you want is really to serve static/semi-static pages through Django, have you investigated flatpages (http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/#ref-contrib-flatpages)? ---Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: trying unsuccessfully to access django admin
Well, first things first: set DEBUG=True in your settings. The traceback you got there is saying there's an HTTP 500 error somewhere, so it's looking for a 500.html template to use to display that error. Django only tries to show that page if you have set DEBUG=False. In this case, you need to find out what the underlying error is, so set DEBUG=True and try /admin/ again. Here's the docs on the 500.html page: http://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views ---Peter On Thu, Jan 22, 2009 at 9:44 AM, bconnors wrote: > > when I typed in: http://127.0.0.1:8000/admin/ > > I got: > > Traceback (most recent call last): > > File "C:\Python26\Lib\site-packages\django\core\servers > \basehttp.py", line 278, in run >self.result = application(self.environ, self.start_response) > > File "C:\Python26\Lib\site-packages\django\core\servers > \basehttp.py", line 635, in __call__ >return self.application(environ, start_response) > > File "C:\Python26\Lib\site-packages\django\core\handlers\wsgi.py", > line 239, in __call__ >response = self.get_response(request) > > File "C:\Python26\Lib\site-packages\django\core\handlers\base.py", > line 116, in get_response >return self.handle_uncaught_exception(request, resolver, > sys.exc_info()) > > File "C:\Python26\Lib\site-packages\django\core\handlers\base.py", > line 160, in handle_uncaught_exception >return callback(request, **param_dict) > > File "C:\Python26\Lib\site-packages\django\views\defaults.py", line > 23, in server_error >t = loader.get_template(template_name) # You need to create a > 500.html template. > > File "C:\Python26\Lib\site-packages\django\template\loader.py", line > 80, in get_template >source, origin = find_template_source(template_name) > > File "C:\Python26\Lib\site-packages\django\template\loader.py", line > 73, in find_template_source >raise TemplateDoesNotExist, name > > TemplateDoesNotExist: 500.html > > > > --~--~-~--~~~---~--~~ 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: Some questions on using Django
On Wed, Feb 11, 2009 at 9:39 AM, koranthala wrote: > (1) >Could somebody let me know whether this is usual? Am I missing > some basic viewpoints which is causing me to write far too much code > than necessary? i.e. Am I or am I not following Django framework > properly? No, this approach is quite normal for an AJAX-heavy RIA. Templates make writing the HTML portion of your site easier, but if your sites are, as you say, almost entirely JavaScript-based, then I'd think it very natural not to use templates much. I have been building web apps for a while, but only recently have I begun to use much JavaScript. I use templates quite a bit, and find they make my life easier, but I'm only adding jQuery plug-ins, so more of my front-end code is HTML than JavaScript. However, I have found some utility in using various template tags within my JavaScript. > > (2) >Another question that I have is - is it usual to have no major > architecture in the web coding? > I am very much worried that I am missing something major and it is > going to blow up in my face later. If someone can help me on this too, > it would be very helpful. > There are some best practices in terms of code organization (making your apps reusable, directory layout, etc.), but really the entire point of using a framework such as Django is that the framework handles the 80% of the code that you'd need to rewrite for every web application you build, while allowing you to concentrate on the 20% of the code that is the domain-specific logic. Thus, a lot of the stuff you'd have to do that would otherwise emerge as a pattern in web architecture is already built in to Django. The other nice part is that Python itself has little need for programmers to use design patterns, as the language has been designed to address the flaws that make design patterns necessary. Iterators are part of the language, a singleton is a module of functions, etc. As Thomas said, "Welcome to python and django". ---Peter --~--~-~--~~~---~--~~ 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: Charts for Admin Interface
I don't have the URL handy, but the admin docs contain pointers on how to add extra URLs to your admin site. Create a view, make a template, add the URL, profit!! So if you want charts in your admin, such a task is well within the capabilities of Django for you to add. On 2/13/09, Robert wrote: > > Dear Community, > > did ever anybody try to add charts (i.e. with ReportLab) to the admin > interface? I think it would be a very nice feature to show > statistics, ... First the user should be able to make some choices and > then depending on these choices django should create a chart (values > of course out of a mysql db) and display it. > It's no problem to register a new model for the admin interface. But I > don't know how I can add things like Charts or PDFs, ... > I hope anybody can give me a help in this case! > > Nice regards > Robert > > > --~--~-~--~~~---~--~~ 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: Mutli-Assignable Models
Hi Justin, I can't view your code at the moment, but it seems to me you want a ForeignKey on Article to Show, another FK on Photo to Show, an M2M from Article to Photo, and a custom manager on Show, or some other custom method, that returns both Articles and Photos. The latter might best be accomplished by having Articles and Photos inherit from some common model, and have Show pull from that common ancestor and then descend to the specific type as needed. The common model would be where you'd have the FK to Show, thinking about it, and then you wouldn't need a custom method on Show, you could just use std methods. ---Peter On 2/12/09, Justin Lilly wrote: > > Hi all. > > I have a project where I need to assign multiple models to each > other via some many to many relationship. > > There are a few main players in my prototype: Articles, Photos and > Shows. Shows has many Articles and Photos. Article has many Photos, > but has one Show. Photos has one Show, but has many Articles. (Might > make more sense below) There will be more models involved in this > process when this app goes to production, but these 3 will do for > prototyping. > > My initial thought was to have an intermediate model with 2 generic > relationships. I think this is going to be too costly in terms of > performance as I'll need to run 2x the queries per lookup. One to > check if my lookup object is referenced in the first generic > relationship, then to see if its referenced in the 2nd one. > > The next idea was to have a self-referential m2m field for my models > to inherit from. The issue there is the lookup returns objects whose > type is that of the parent model, not the child model. > > I'm looking for a way to accomplish queries similar to this: > > >>> myshow > > >>> myshow.related.all() > [, , , , ] > >>> photo1 = myshow.related.all()[0] > >>> photo1.related.all() > [, , , ] > > The self referential model code I was using can be found at > http://dpaste.com/119897/ and an ipython session at > http://dpaste.com/119898/ . I feel as if I may be stretching what > model inheritance was meant for or at least what its currently > capable of. > > Although everyone says it, the solution will need to scale to a > large number of users as it will be used in a very large > dynamic-content site. This is the core of the content plan (to > present various content types based on a given "pivot point", in the > illustrated case above, shows). > > Looking for any advice or help you may be able to provide. > > -justin > > > > --~--~-~--~~~---~--~~ 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: Mutli-Assignable Models
On Mon, Feb 16, 2009 at 1:20 PM, Justin Lilly wrote: > > Hi Peter, > > While your proposed solution would work for the prototyping example > I've given, I have 3 more arching themes like Show and probably > another 4-5 content types like photo and articles. The main idea here > is to be able to select an arbitrary element, be it a photo, video, > article, etc. and display all of its related content, regardless of > content type, within the theme (aka Show). Your M2M to self looks okay from a theoretical point of view, does it work in practice? >From a Pythonic point of view, you should be explicit, right? So, how well or how badly does it work if you have an FK on Item to self, named 'parent'? You can build trees mighty quickly that way. You might also want to look into Django-MPTT, which is designed to handle object graphs well. On a non-Python level, you might want to consider building a view in your db, and creating a model based on that view, rather than having Django build your tables. A bit more manual maintenance, and you might need to brush up on your SQL and relational design skills to get there, but it might be a direction to go. > As an ancillary goal, I > need to ensure I'm not generating a ton of expensive queries for each > of these lookups as this site will be serving a large number of users. > As far as I can tell, abstracting these relationships is the best way > to go about the problem, its just the method of abstraction that I'm > unsure on. "Premature optimization is the root of all evil." Don't worry about performance until you know it's a problem. Then solve it the normal way: figure out your caching strategy, tune your db to fit your server(s), profile. Don't assume that queries will be expensive a priori. Use select_related. You make your life harder by assuming bad performance before you know it occurs. See you tonight, ---Peter --~--~-~--~~~---~--~~ 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 Transaction Management
> Django Reference suggests that we use Transaction Middleware in the > web applications. Mm, the documentation doesn't suggest you use it, it merely details how to use it if you in fact need it. Whether you need it or not is a design decision you must make. > What is the usual practice followed here? Do we use Transaction > Middleware most of the time? You need to think about transactions and your application. That is, does your application actually require transactions? Do you have multiple database operations that really MUST be performed as a unit, or rolled back as a unit? In most web applications, that's not likely to be the case. Commercial websites, money exchanges, these sorts of operations normally require transactions, but does a To-Do list application, a blog, or a photo gallery? So you need to think about whether your application truly requires transactions. Most of my apps do not, though I do have one use case in one app where I am using transactions to ensure logical consistency. > > The reason why I am asking is due to the following reason: > In my code, I at many places do the following > Obj = Model(parm1, parm2) > Obj.save() > # Now store the id for future use > l.append(Obj.id) No, don't do the above. Instead, do: l.append(Obj) > Now, I think this sort of code should be very usual in Web > Applications. But I cannot understand how this will work, since as per > my understanding, the _id_ will not be obtained until the DB actually > assigns one. Since transaction middleware allows the transaction to be > commited only at the end, this should fail right? As per above, don't store the id for future use. You've already got a reference to the model object, Obj. Append that to your list instead, if you need to refer to it. You don't have to worry about the id, and you don't have to worry about transactions (whether or not you decide to use them). If you keep the reference to the Obj throughout your transaction, you need never refer to the id explicitly, just use the object reference. Then later, when you commit your transaction, your object *in its final form* is saved to the database, and an ID is assigned. Hope that helps, ---Peter --~--~-~--~~~---~--~~ 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 Certifications
In short, no.If you are looking to create one, feel free, there's no competition. There's also been no discernible demand, from what I've seen. On 3/6/09, Praveen wrote: > > Is there any Django certification as others like SCJP, MCSE, CCNA and > more on? > > > --~--~-~--~~~---~--~~ 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: HIPAA, Django and User Authentication/Security
hat hard to do. HIPAA is more about the organization having in place policies that comply, and that the system expresses those policies. A lot of compliance is subject to interpretation, there's some leeway as to what is and what isn't compliance. Also for what it's worth, I have a suspicion that if your customer is already using that Django application to store production patient information, that system is already subject to HIPAA regulations, regardless of whether it is public or not. As a hint, test data should absolutely NOT be real patient info. Use obviously fake patients, e.g. "Daffy Duck, MRN 123456789". Disclosure of real patient data from a test system is still disclosure, and subject to penalties. And since security policy enforcement is usually less on a test system ("Oh, sure, I'll show you how it works on test, no problem!"), the chances of disclosure are higher. ---Peter Herndon http://spookypony.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: HIPAA, Django and User Authentication/Security
> You speak > of HIPAA which translates to FISMA requirements. I suspect they are complementary, not equivalent. > I assume your web > application i.e MYSQL will be storing Personal Identifiable > Information (PII) such SSN, etc... In this case, you may have tough > battle getting your web application approved. Hmm, I was assuming Glen's customer was a healthcare organization. If you are looking for approval for use by a government agency, in addition to HIPAA compliance, that's well beyond my experience. > Nevertheless, there are > sites our there which may help you get started. > > Check out the following websites: > > http://www.commoncriteriaportal.org/ > http://www.mitre.org/ On quick perusal, MITRE seems to have an open source tool LAIKA that checks electronic health records for interoperability compliance. Good stuff, if interoperability is a requirement. My experience with HIPAA pretty much predates interoperability, and was focused on the privacy and security regulations. ---Peter --~--~-~--~~~---~--~~ 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: Memory error
On 08/05/2009 12:26 PM, drakkan wrote: > No I'm not serving static file I have a very large json file > dinamycally generated (based on a db query) > Please post the relevant view and model code, so we can see what's happening. Also, if your db query is actually a really large number of db queries, and you are running in debug mode (DEBUG = True in settings), then Django caches all of your SQL queries to assist with debugging -- at the expense of memory and performance. --~--~-~--~~~---~--~~ 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: Memory error
On 08/05/2009 04:09 PM, drakkan wrote: > The code is something like this > > obj=DBModels.objects.filter(somefilter) > results=[] > for o in obj: >results.append({'field1':o.field1,'field2':o.field2}) > > return JsonResponse(results) > > where JsonResponse is a class derived from HttpResponse that add a > simplejson.dumps > > I have a really large database and in some edge case I need to return > a large number of results (about 150.000 when I get the error). I make > only one query with select_related and I tried also with DEBUG=False > but nothing changed only the detailed stack trace isn't printed, > > thanks > drakkan > Hi drakkan, Your code: results=[] for o in obj: results.append({'field1':o.field1,'field2':o.field2}) is building a list in memory. Chances are, with 150k+ objects, that's where you are running into the memory issue. That's a big list! A couple of possibilities come to mind. First, have you looked into using a values query? You may be able to avoid building the list entirely. The relevant documentation is here: http://docs.djangoproject.com/en/dev/ref/models/querysets/#values-fields and the syntax would be something like this: results = DBModels.objects.filter(somefilter).values('field1', 'field2') At which point, results is basically this: [{'field1':o1.field1, 'field2':o1.field2}, {'field1':o2.field1, 'field2':o2.field1}, ...] but it's a lazy iterator rather than an in-memory list. Another thing that comes to mind is using Django's built-in serializers, which will take your filtered QuerySet, a tuple of fields, and serialize to JSON for you. Docs are here: http://docs.djangoproject.com/en/dev/topics/serialization/#topics-serialization Hope that helps, ---Peter --~--~-~--~~~---~--~~ 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: adapt admin interface
On 08/05/2009 03:36 PM, sveri wrote: > Hi, > > i wonder if it is possible to change the admin interface of an app > like that: > Yes, it is very possible. > Now i go to the admin interface of Entries and want to add a new > Entry. > Then i select a party for the new entry. > After having that selected i want to reload the form ajax like > and show only the politicians that belong to that specific selected > party. > One way to do this would be to override the admin template for the change_form.html for your model, and add the necessary Javascript to it to do what you need. You will likely need to create a view for your app that performs the querying for your Ajax request, but you'd write the view like you would any other, and you'd just override the admin template to include the Javascript that calls to your view and parses the response. Overriding the admin templates documentation is here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates Hope that helps, ---Peter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Announce: django-ldap-groups
I'm pleased to announce the release of django-ldap-groups. Of special interest for building intranet sites, django-ldap-groups allows Django users to authenticate against LDAP, and allows site administrators to map LDAP organizational units (OUs) to Django groups. This mapping allows LDAP-authenticated users to acquire site permissions based on their LDAP OU membership, automatically when they first log in to the Django site. The app is available at http://code.google.com/p/django-ldap-groups/, and is BSD licensed. Currently the app has been tested and works against Microsoft Active Directory and Novell eDirectory. Other LDAP servers will probably work using the eDirectory backend, but none have been tested at the time of writing. Please let me know if you have any questions or comments. Regards, ---Peter Herndon --~--~-~--~~~---~--~~ 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: python md5
On 08/06/2009 01:55 PM, Asinox wrote: > Hi guys, please i need to know why md5 return this: > > > > > the way that im using: > > def encriptar(): > toEncode = pickle.dumps(datetime.now) > encoded = md5.new(toEncode) > > return encoded > Because encoded is an md5 hash *object*. You can add more strings to the hash with the update() method. Then, when you are finished adding things, you call the digest() or hexdigest() method to retrieve the value of the hash. It isn't just a one-time hashing function that returns the value of the single item you pass to 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 deploy Django on the web server?
On 08/07/2009 05:25 PM, Milan Andric wrote: > Justin, it's not. Have you seen the deployment docs? > > http://docs.djangoproject.com/en/dev/howto/deployment/#howto-deployment-index > > -- > Milan > > On Aug 7, 1:56 pm, justin jools wrote: > >> thanks for the reply but I have access to a server for free so I wanted to >> set it up myself, how can it be so difficult? Django is renowned as an easy >> rapid development framework so why is it so difficult to deploy? >> >> More to the point, tell us what you are doing and where it's failing. Maybe then we can help you solve the problem. Hmm, looking at the 000webhost.com site, their free offering does not include Python. And I can't get heliohost.com to resolve. Perhaps your problem starts there. ---Peter --~--~-~--~~~---~--~~ 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: apps that relate to each other
On 08/07/2009 05:33 PM, Milan Andric wrote: > Hello I have two apps that have foreign keys to each other. Like: > > people.models: > >class Profile(Model): > secondary_email = CharField() > >class Staff(Profile): > office = ForeignKey(Room) > > > resources.models: > >class Room(Model): > name = CharField() > >class Reservation(Model): > profile = ForeignKey(Profile) > > Runserver seems to work fine but when i do ./manage.py sqlall people I > get a "Error: App with label people could not be found. Are you sure > your INSTALLED_APPS setting is correct?" error. > > Is there a way around this or do I need to rip my apps apart so I can > foreign key to my rooms model? > > Thanks, > > Milan > Hi Milan, It sounds like your 'people' and 'resources' packages aren't being found by manage.py. That means they aren't on your PYTHONPATH. There's a little bit of explanation in the first couple of paragraphs here: http://docs.djangoproject.com/en/dev/ref/django-admin/ Assuming that 'people' and 'resources' are both Python packages that started life as the result of django-admin.py startapp, then the easiest thing to do is to make sure both modules are accessible to Python's site-packages. That way, you can use people and resources in your current app, and use them again later in another app without having to move them from their current location on the file system. There are two ways to go about this. The first way is to (assuming you are running Linux or OS X) link to the package directory from within site-packages. That is, "cd /usr/lib/python2.6/site-packages" and then "sudo ln -s /home/milan/projects/people ." for each package. (Needless to say, modify the paths to reflect your system.) This method is quick and easy, but places these modules in your system's Python install. You may need to be cautious in doing so, as you may run into a namespace clash with existing packages. The second method is to learn all about virtualenv and use that wonderful tool to do what it does best. Virtualenv allows you to create a sandboxed Python installation per project, separate from your system's Python installation. With each project in its own sandbox, you don't need to worry about interfering with your system, or with version conflicts between the needs of one project and the next. Use virtualenv with pip and virtualenvwrapper to make your life even easier, as pip allows you to install packages to your virtualenv similar to easy_install. The downside, of course, is that you have to learn a few more tools, and use them with discipline. Happily, they aren't hard to learn and are reasonably well documented. Hope that helps, ---Peter --~--~-~--~~~---~--~~ 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: Strange problem with LDAP authentication backend
On 08/12/2009 11:17 AM, stupidgeek wrote: > Hi all, > > I'm having a strange problem. I wrote a basic LDAP backend, to > authenticate users against our open directory server: > > [snip] > > Note that the print user line works, so a valid user is being > returned, meaning the bind works just fine. > > The problem I am getting is that the GET /admin/ is returning me to > the login form, without any errors, over and over. A login using a > user from the django db works without a problem. > > Any suggestions? > > Hi Brenton, Your GET /admin/ is returning "without any errors". By that, do you mean that it is sending you back to the login form and telling you to input a *correct* username and password? If so, the thing I ran into with this is that the django.contrib.auth.models.User model has two attributes, is_staff and is_superuser. If you are NOT setting at least is_staff = True, then your user is not allowed to access the admin, period, and you'll never get past the login screen. If you go into /admin/ as an actual admin user, you'll likely see your user created in the Users section, but with no staff or superuser permissions. I actually very recently wrote an app to help with this sort of thing, http://code.google.com/p/django-ldap-groups/, though I haven't targeted Open Directory or LDAP servers using SASL auth. I'd be happy to work with you to add Open Directory to the list of supported servers. It is very new (about a week old or so), and has boogs, but I'd love to see if it helps your problem. (Of course, the fun part about LDAP is that my diagnosis may be entirely wrong, too... ;) Regards, ---Peter Herndon --~--~-~--~~~---~--~~ 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: Theory: Models/Apps
On 08/14/2009 12:36 AM, Vadivel Kumar wrote: > I have recently started on Django .. going awesome .. I know, this > question might have popped out several times before, but since Google > does not yield me any results, I am writing this post. However, do > point out resources if any in this mailing list. > > 1. What is the fundamental difference of APP versus PROJECT in Django > terminology. For instance, is it right to say, POSTS is an APP and > BLOG is a PROJECT or ORDERS is an APP and ORDER_MANAGEMENT is a PROJECT .. One way to describe a "project" is "web site", or "web application". You have a top-level urls.py, a top-level settings.py, and in your settings you are specifying which "apps" are to be used in this site. An app, then, does NOT need to sit in the project directory. Instead, it can and should be a Python package and should be made available to your "project" via being on the PYTHONPATH. That way, the app is available to any other projects at the same time. For more on this structure, read James Bennett's _Practical Django Projects_, and his blog entries on the subject. > 2. Particularly, I don't like the idea of using a single models.py for > many entities, I would rather to keep separate files for each of > entity .. in a scenario like a huge team is working on a project, this > approach will create unnecessary noise. Any answers? As others have stated, feel free to break out models.py into ../models/__init__.py and ../models/, ../models/, etc. However, one major point to keep in mind is that if you restrict a given "app" to providing a single function (or small set of intimately related functions), and break other functionality into other apps, then the models.py for a given app will generally never get too terribly big. This separation and modularization is part of the success factor for Django -- there are hundreds, perhaps thousands of reusable apps you can plug in to provide functionality for your site. And when you start thinking that your models.py, or views.py, is getting too big, you should probably start asking yourself if you split a related set of functionality out into its own app. ---Peter Herndon --~--~-~--~~~---~--~~ 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 much python do i need to know to learn/use Django?
On Fri, Aug 14, 2009 at 11:39 AM, snfctech wrote: > > And I guess the answer to the title of the post, according to you guys > is: > > "All you need is previous programming experience and a Python > reference book. Learning some Python basics before diving into Django > is probably a good idea, but you don't need to spend weeks on it or > take a bootcamp/course." I strongly disagree. The thing to remember is that Django is just Python applied to web programming. Knowing Python better, and understanding the quirks of the language and why they are there, will serve you better when programming a Django app. Django is a supremely Pythonic approach to web applications (not the only such, to be sure). The framework developers use the language fluently. The better you understand the language, the easier you will find it to understand Django. The choices made in designing Django will be obvious, or at least more clear than they would have been otherwise. You are more likely to reach your goal of having a working Django site sooner if you have a better understanding of the language than if you concentrate on Django and skip the subtleties of the language. Yes, Python is designed to be easy to learn and easy to read, but understanding the possibilities inherent in the language will help you grasp more of Django more easily than if you just dive into web programming. Listen to the instructor, he's not wrong. ---Peter Herndon --~--~-~--~~~---~--~~ 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: Eric Evans Value Objects
Hi Tibor, On Mon, Aug 17, 2009 at 4:17 AM, gentlestone wrote: > > I'm looking for a support for something like Eric Evans Value Objects > (http://domaindrivendesign.org/). For example, if I have a Person > model like > > class Adress(models.Model): > street = ... > city = ... > postal_code = ... > > class Person(models.Model): > home_adress = models.OneToOneField(Adress) > business_adress = models.OneToOneField(Adress) > > Adress is like a Value Object, but I don't want any adress table, nor > extra foreign key and database joins. My application is not made for a > National Post Office domain. I just want an Adress class whitout > database identity. I think you're approaching the problem incorrectly. When dealing with a relational database, go ahead and view things from a relational perspective. In this case, if you want your Person model to have zero, one, or multiple Addresses, and a single Address can be used by multiple people, what you want in Django is a ManyToMany field. Yes, this creates a couple more tables and the requisite joins, but as it so happens, that likely won't be a problem for you, as you are writing an application that is as you say "not made for National Post Office domain." In short, don't fight the relational model in this case. It is designed to handle such tasks. The only reason you might want to avoid an extra table or two is due to poor performance, but I suspect that you are optimizing prematurely. Until you have a large number of users, you don't need to worry about one M2M field. And your first choices for optimization in Django should be caching and setting up a separate image server, not database denormalization. Django's ORM is a very powerful tool, and it makes the developer's life a lot easier in many ways, but that in part is because the Django developers made design choices that reflect best practices and channel users in the proper direction. The fact that Django does not make it easy to do what you think you want is likely a sign that you are going upstream against the natural flow of Django. In short, take it as a warning sign that you should rethink your approach. Try working with Address as a ManyToMany field, and see whether that works for your application. From there, if it presents a problem, you can always rethink later, and you will have the benefit of knowing what problems you need to work around. Hope that helps, ---Peter --~--~-~--~~~---~--~~ 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: custom authentication backend not being used...
On 08/19/2009 02:04 PM, Jay wrote: > Sorry, nevermind. I finally figured this out right after I posted > this. > > What was the solution? Both for posterity, and because I'm personally curious. Thanks, ---Peter --~--~-~--~~~---~--~~ 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: Ajax TreeList with Django
On 08/26/2009 03:52 PM, Dirso wrote: > I'd like to create a dynamic treelist (using Ajax, Django and > Postgres). Did anyone know tutorial ou code piece that could do this > magic? > > Hi Dirso, I've done something similar to what you are describing, using jQuery, the dynatree jQuery plugin, and some reasonable Django code. The code is available at http://bitbucket.org/tpherndon/django-fedora/, and you'll specifically be interested in the djadora/views/browse.py and the djadora/templates/fedora/browse_dynatree.html and image_fragment.html files. I implemented the code as part of a special-purpose web app for interfacing with a Java repository system, and the code is far from clean and pretty, but it should give you a decent example of something that is currently in production. The way I approached it was to write a couple of views that are designed to handle the jQuery dynatree Ajax requests. Dynatree does the work on building the tree in HTML, my views provide the data, and the models each have a "parent" attribute that allows the views to figure out how to select children for each tree level. In retrospect, I'd do my best to reuse django-mptt, django-treebeard, or similar. They aren't a direct fit for my use case, since I have different models that can contain each other, and from what I've seen they are geared to handle only a single model class pointing to itself, but I would follow their approach and steal code like crazy. :) Or, if I had just one kind of model, I'd just add enough Ajax views to power dynatree. ---Peter --~--~-~--~~~---~--~~ 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: Fulltext searching
In addition, full text indexing with Sphinx has been shown to be faster than the same using MySql'ls fulltext search. Django-NYC recently had some talks on search, and the gentleman who presented on David Cramer's django-sphinx module had run some rough timing tests. On 3/27/09, Antoni Aloy wrote: > > 2009/3/26 Malcolm Tredinnick : >> >> On Thu, 2009-03-26 at 14:37 -0700, TheIvIaxx wrote: >>> So i have been trying to get a solid search going in django. I have >>> seen things liek Whoosh and Solr or Lucene(sp?) which all add fulltext >>> searching to your models. Are these better than the mysql fulltext >>> searches? > > I prefer to stay away from database indexing so the application is > database agnostic. I have integrated xapian successfully in some > projects using django-xapian, and it works quite well. You can see it > in action in trespams.com. > > > -- > Antoni Aloy López > Blog: http://trespams.com > Site: http://apsl.net > > > > --~--~-~--~~~---~--~~ 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: Mysterious "=32" for all strings extracted from list showing up via send_mail
The answer is here: http://www.faqs.org/rfcs/rfc2045.html Specifically, section 6.7, "Quoted-Printable Content-Transfer-Encoding". If you take a tour through Python's email module in the standard library, you'll find some bits for handling decoding. On Thu, Mar 26, 2009 at 4:11 PM, NoviceSortOf wrote: > > > My objective is to send a clean list of field names and values via > email > after the completion of a form in Django. > > When formating an email message after extracting a list of field names > and values from a list i get a string that prints something like this. > > $print(message_str): > ... > name="Bill Jones" > street="Baker St." > zipcode="9"... > > When I send this string as message parameter with Send_mail it arrives > looking like this in the body of the email > ... > name=3D"Bill Jones" > street=3D"Baker St." > zipcode=3D"9"... > > I'm curious where between the string being readable without the 3D via > the Django debugger via Send_mail and into the arriving mail > where the 3D might be interjected into the string. > > > > > --~--~-~--~~~---~--~~ 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: TreePanel in Django
I've done something similar using jquery and the dynatree plugin, though the directory "structure" doesn't actually exist on the file system of the server. I'm building my tree from relationships stored in the db. Works for me so far, though I've yet to test with large quantities of objects. ---Peter On 4/13/09, Eduardo Aragón Montes wrote: > Hi everyone..I'm new in django and I'm developing and app that have virtual > storage for users...so i would like to do a treepanel for every user where > they can see what files they have uploaded and if they want create folders > and organize their files...I know i can use ext-js but i would like to know > if anyone of you know other way to perform this...Thanks > > -- > Eduardo Aragón Montes > Cel. 3113072880 > > > > --~--~-~--~~~---~--~~ 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: Newb with some questions ...
For REST in Django, there are a number of options, but django-piston is a front-runner. ---Peter On 6/14/09, Gunnar wrote: > > Good Day, > > I'm an 'ol VB6/SQL Server client-server programmer who has moved > into .NET, Silverlight and has done some websites with Joomla. I've > also done a LOT of Shockwave-Lingo, C++ and C#. > > After spending several days researching, I'm settling into Django more > and more, and am letting go of the near hysteria I'm seeing over Ruby > on Rails. > > ( I'm not keen on a language that is only around because of ROR, I'm > not keen on Ruby performance) > > My goals are ... > > (1) Build REST web services incorporating ORM and sending XML results > to Silverlight > > (2) Possibly integrating Django 'apps' into Joomla > > and > > (3) Building out full-blown websites with Djano - where for me - it > would compete with Joomla. > > (4) It MUST run on GoDaddy - beyond my ability to influence so thanks > in advance for the flame ;-) > > > QUESTIONS... > > Goal (1) - To meet this goal, I just need web services. Is this > practical in Django and can you point me somewhere to read-up on > this??? > > Goal (2) - This is more of a Joomla question - but if anyone has a > suggestion - I am all ears! > > Goal (3) - I need to bone-up on Django so expect questions > > Goal (4) - Does anyone have experience with Django hosted at GoDaddy? > Do they use Fast-CGI for Python? > What problems can I expect? Going to another host is not an option! > > Thanks in advance.! > Gunnar > > > > --~--~-~--~~~---~--~~ 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: Beginners question: select box with very much options
Jannis Leidel implemented autocomplete in admin, and I've done it a few times in user forms. Jquery has a nice autocomplete plugin (http://bassistance.de), plus I think there's one in the next Jquery UI beta/trunk. IIRC, there's a current GSoC project to add autocomplete to admin. In short, there's lots of prior art from which to learn. But the summary is that you will need to write a view that pulls possible matches from the db, and returns them in whatever format is required by whichever JavaScript component you adopt (or write). Then add a URL for your js to call via Ajax, add the js to your template, and you're in business. ---Peter On 6/18/09, Bruno Tikami wrote: > Hello Mathias, > > On Thu, Jun 18, 2009 at 12:37 PM, Mathias Waack > wrote: > >> >> Hello django experts, >> >> let me first note I'm a beginner in both django and web-development at >> all. > > > welcome! > > >> >> I have a form with some select boxes containing several million options. >> Now >> I'd like to have something like the search field in wikipedia, where I get >> suggestions during typing. > > > there are two common features that should help you get it done: suggestion > and autocomplete. A suggestion feature will show you some common searched > keywords (like youtube) while the autocomplete stuff will show you some > database records containing the typed text. > > >> I'm fairly sure this question has been answered several times, but I >> haven't >> found any feasible solution. Are there any special keyword you're using >> for >> this kind of input fields? > > > These features are implemented in JavaScript, as they are related to the > data representation _logic_ so it has nothing to do with special keywords > on inputs. > > > >> >> Would be nice to have a solution working with last stable django, but just >> in >> case I could also upgrade to 1.1alpha. >> > > I don't have any link to send you right now but once you know a little bit > more of it, I think you can google it ;-) > > >> >> Thanks! >> >> Mathias >> >> > Tkm > > > > --~--~-~--~~~---~--~~ 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: Custom Authentication Backend
On Dec 3, 2009, at 3:29 PM, bfrederi wrote: > I'm not looking to avoid effort. I just don't want a bunch of extra > users cluttering up my system if I don't need to. I have no desire for > them to exist in my system for any reason. I want to keep the number > of django users limited in my system so it is easier to manage them in > admin. > > Thanks for the import advice though. Unfortunately, it's not what I'm > seeking. > In which case, you'll need to rewrite an awful lot of contrib.auth to work with LDAP directly. The existing contrib.auth is designed to work with User models stored in a relational database, manipulated via the standard Django ORM. There are any number of working snippets for importing user data from LDAP or other sources on successful authentication, but they all work by creating a User and storing the model in the db. They just get their user info from AD, or wherever. The one you chose is very workable. While it sounds like a grand thing to avoid the redundancy of storing your users both in the db and in your original source, the amount of work involved makes it a non-starter for all but the most obsessed. And it really doesn't buy you much, practically speaking. I'd suggest to you that a better approach would be to work on customizing the admin to separate out your LDAP users from your local-to-Django users, I seem to recall seeing some snippets to that purpose. Basically, just rope off your LDAP users and ignore them. Though if you *do* wind up rewriting contrib.auth to work directly from LDAP, please do post, I'd love to see it. ---Peter P.S.: Thanks for the plug, Mike! :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: LDAP-groups problem
On Dec 17, 2009, at 7:32 PM, Wayne wrote: > Hi, Hi Wayne, > > I tried to use djando-ldap-groups but got some errors from database > configuration. Could somebody shed some light on the possible problems > of my set up? Hmm, I think I found the problem below. > > Our LDAP server is Sun One Server and the site is running in the > windows environment. Aside: If you get all this running properly, please let me know, I've not tried it with Sun One and would be glad to know that it works with that particular LDAP server. > AUTHENTICATION_BACKENDS = ( > 'django.contrib.auth.backends.ModelBackend', > ) . You will need to add one of the LDAP backends to this setting. The eDirectory backend is pretty generic, and will be a better bet than the ActiveDirectory backend. That's not the problem you are having, but is something you'll need to handle shortly. > > The error message came from command: python manage.py syncdb > Creating table ldap_groups_ldapgroup > Traceback (most recent call last): > [snip] > cx_Oracle.DatabaseError: ORA-02329: column of datatype LOB cannot be > unique or a > primary key > In ldap_groups/models.py, the LDAPGroup.org_unit field is a TextField, and is marked unique=True. I'm thinking that the cx_Oracle backend is translating the TextField into a Large Object (LOB) field in Oracle, and Oracle cannot ensure uniqueness of a Large Object. In short, remove the "unique=True" from the ldap-groups code and try again. It should work after that. This error arises from an inconsistency between the behavior of Oracle and the behavior of PostgreSQL, as Mike noted. It works under Postgres. I'll check with the dev list and see if this behavior difference is known, and whether the fix is to never use unique=True on a TextField (a bug in my code), or something that needs to be smoothed over in the SQL generation for Oracle specifically (a bug in the underlying Django behavior). Let me know if you have further questions, I'm happy to assist. Regards, ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: LDAP-groups problem
On Dec 18, 2009, at 10:15 AM, Peter Herndon wrote: > > On Dec 17, 2009, at 7:32 PM, Wayne wrote: > >> Hi, > > This error arises from an inconsistency between the behavior of Oracle and > the behavior of PostgreSQL, as Mike noted. It works under Postgres. I'll > check with the dev list and see if this behavior difference is known, and > whether the fix is to never use unique=True on a TextField (a bug in my > code), or something that needs to be smoothed over in the SQL generation for > Oracle specifically (a bug in the underlying Django behavior). > Hi Wayne, Can you tell me the Django version, the version of cx_Oracle, and the Oracle version? If this has been fixed for certain versions, that would make this error a moot point. And the developers are certainly going to ask. :) Thanks, ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: LDAP-groups problem
On Dec 18, 2009, at 10:15 AM, Peter Herndon wrote: >> >> The error message came from command: python manage.py syncdb >> Creating table ldap_groups_ldapgroup >> Traceback (most recent call last): >> > [snip] >> cx_Oracle.DatabaseError: ORA-02329: column of datatype LOB cannot be >> unique or a >> primary key >> > > In ldap_groups/models.py, the LDAPGroup.org_unit field is a TextField, and is > marked unique=True. I'm thinking that the cx_Oracle backend is translating > the TextField into a Large Object (LOB) field in Oracle, and Oracle cannot > ensure uniqueness of a Large Object. In short, remove the "unique=True" from > the ldap-groups code and try again. It should work after that. > > This error arises from an inconsistency between the behavior of Oracle and > the behavior of PostgreSQL, as Mike noted. It works under Postgres. I'll > check with the dev list and see if this behavior difference is known, and > whether the fix is to never use unique=True on a TextField (a bug in my > code), or something that needs to be smoothed over in the SQL generation for > Oracle specifically (a bug in the underlying Django behavior). > Hi Wayne, The limitation is known, there's a note in the Oracle backend mentioning that TextFields do not support indexes, which includes unique constraints. For your use, just remove the unique=True from the model definition and run syncdb again. Regards, ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: LDAP-groups problem
On Dec 22, 2009, at 10:40 AM, Wayne wrote: > Thanks for the prompt reply. Yes, unique=True was the problem. Now I > passed the "run syncdb" and new tables were created. However, I still > could not "contact LDAP". Could somebody help me with this? That would be me. > > Thanks! > > My settings: > > LDAP_SERVER = 'directory.X' > > # If using SSL use these: > LDAP_PORT = 636 > LDAP_URL = 'ldaps://:636' > SEARCH_DN = '' > SEARCH_FIELDS = ['sn','cn','uid'] Future note: The point of ldap-groups is to allow a mapping between LDAP OU group memberships and Django groups, in order to have LDAP users acquire the permissions that have been assigned to the Django group. So at some point you will need to add to SEARCH_FIELDS the field on your LDAP user that contains the list of groups to which the user belongs. If that field is not called 'groupMembership', you will need to edit the ldap_groups.accounts.backends module, and change lines 205 and 206 to match the name of that field. This change isn't your initial problem, though, so it can be deferred for a bit. Eventually I should refactor that field out to its own setting. > BIND_USER = 'XX' > BIND_PASSWORD = 'X' > CERT_FILE = 'XX' > > AUTHENTICATION_BACKENDS = ( > 'ldap_groups.accounts.backends.eDirectoryGroupMembershipSSLBackend', > 'django.contrib.auth.backends.ModelBackend', > ) [snip] > Traceback: > [snip] > 154. l.simple_bind_s(username, password) > File "C:\Python26\lib\site-packages\ldap\ldapobject.py" in > simple_bind_s > 206. msgid = self.simple_bind(who,cred,serverctrls,clientctrls) > File "C:\Python26\lib\site-packages\ldap\ldapobject.py" in simple_bind > 200. return self._ldap_call > (self._l.simple_bind,who,cred,EncodeControlTuples > (serverctrls),EncodeControlTuples(clientctrls)) > File "C:\Python26\lib\site-packages\ldap\ldapobject.py" in _ldap_call > 96. result = func(*args,**kwargs) > > Exception Type: SERVER_DOWN at /admin/ > Exception Value: {'desc': "Can't contact LDAP server"} The error messages are typically accurate. In this case, "Can't contact LDAP server" should be taken literally. You should first confirm that the LDAP server is listening on whatever port at the appropriate DNS name, and that you have network connectivity to the LDAP server. Once you've confirmed the DNS name and port, make sure those are in your settings.py file. A quick way to test is to try to telnet from the system running Django to the LDAP server. An example: Ralf: $ telnet ldap.example.com 636 Trying 1.2.3.4... Connected to ldap.example.com. Escape character is '^]'. If you get the above response ("Connected to XXX"), then you have confirmed you can contact the server, and your next step is to diagnose why python is not able to establish a client connection. If you do not get that response, your port or DNS name is incorrect, or you do not have connectivity to the server. The next step in this case is to figure out why your network connection is not working as expected. One starting note: while the standard port for LDAPS is 636, and the standard port for unencrypted LDAP is 389, vendors may not follow the standard. In addition, your LDAP administrator can also decide to listen on different ports. This would be the first thing I'd check. Let me know your results, and we can move on to the next step. Regards, ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: LDAP-groups problem
On Dec 23, 2009, at 3:00 PM, Wayne wrote: > Hi, > > Many thanks for your reply. > > I did the test and it seemed that our network is working fine and I > could telnet to the directory with "Connected" feedback. What other > things we could try next? > Our next step is to work out how to make your connection work properly from Python. Django-ldap-groups is basically a thin wrapper around python-ldap, with added code to work with Django. So what we need to do next is establish a connection to your LDAP server from a Python shell using python-ldap. Once we have that connection working, we'll know what we need to change in the ldap-groups code to make it work with Sun ONE, and/or your particular environment. I'm including a transcript of a python shell session. This session shows the steps needed to make a working connection to a server, and is based on the flow of events in the bind_ldap() method of eDirectoryGroupMembershipSSLBackend, in ldap_groups/accounts/backends.py. It also shows the kind of error you'll receive if the certificate you are trying to use is not correct: Ralf:~ herndonp$ python Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import ldap >>> ldap.set_option(ldap.OPT_X_TLS_CACERTFILE,'/Users/herndonp/Downloads/wrongcert.b64') >>> l = ldap.initialize('ldaps://ldap.example.com:636') >>> l.set_option(ldap.OPT_PROTOCOL_VERSION, 3) >>> l.simple_bind_s('cn=fake_username,o=fake_org', 'fake_password') Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.6/site-packages/ldap/ldapobject.py", line 206, in simple_bind_s msgid = self.simple_bind(who,cred,serverctrls,clientctrls) File "/Library/Python/2.6/site-packages/ldap/ldapobject.py", line 200, in simple_bind return self._ldap_call(self._l.simple_bind,who,cred,EncodeControlTuples(serverctrls),EncodeControlTuples(clientctrls)) File "/Library/Python/2.6/site-packages/ldap/ldapobject.py", line 96, in _ldap_call result = func(*args,**kwargs) ldap.SERVER_DOWN: {'info': 'error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed', 'desc': "Can't contact LDAP server"} >>> I'm including the error because it is most likely the cause of the problem, having eliminated connectivity. Getting the right certificate is not straight-forward. You do not need the actual certificate of the LDAP server, you need the trusted root certificate (including any intermediary signers) of the certificate authority that issued the certificate used by the LDAP server. If you do get the error above, or something similar, it might be useful to confirm that there are no other problems connecting. If your LDAP server is listening for *un*encrypted traffic, you may want to try the above steps without encryption, just to see that you can connect successfully. An example session: Ralf:~ herndonp$ python Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import ldap >>> l = ldap.initialize('ldap://pledir1.mskcc.org:389') >>> l.set_option(ldap.OPT_PROTOCOL_VERSION, 3) >>> l.simple_bind_s('cn=fake_user,o=fake_org', 'fake_password!') (97, []) >>> If you do get that error, you will need to work with your LDAP admin to identify the right certificate to export, export it as Base64 PEM encoded file, and place it somewhere you can reference from Python. Give that a try and let me know how it goes. ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Problem with letters like ÄÖÕÜ in dja ngo admin
My immediate thought, looking at your error, is that your database is storing text data as ASCII rather than a unicode encoding (utf-8 being the most common). Perhaps you should check your database character set. IIRC, MySQL uses an ASCII character set by default, unless you choose otherwise during installation. ---Peter Herndon On Apr 15, 2010, at 11:54 AM, zayatzz wrote: > Hello > > I recieve this kind of error message when in admin: > > Caught an exception while rendering: ('ascii', 'Madalal temperatuuril k > \xc3\xbcpsetatud stressivaba sea parim t\xc3\xbckk', 23, 24, 'ordinal > not in range(128)') > > The text should actually be "Madalal remperatuuril küpsetatud > stressivaba sea parim tükk". > > The model, that saves this information is: > class Retsept(models.Model): > name = models.CharField(max_length=100, verbose_name=_("Name"), > blank=False, null=False) >and other fields > > > And the form for it is: > class RetseptForm(ModelForm): > about = forms.CharField(widget=TinyMCE(attrs={'style': 'width:370px', > 'rows': 15, 'theme':"simple"}), label = _("text here"), > required=False) > tags = TagField(label = _("tags"), > widget=TagAutocomplete(attrs={'class':'required'})) > name = forms.CharField(label = _("Name"), > widget=forms.TextInput(attrs={'class':'required'})) > class Meta: > model = Retsept > fields = ('name', 'about', 'image', 'tags',) > widgets = { > 'name': TextInput(attrs={'class': 'required' }) > } > > Can anyone tell me whats wrong with it? > > Alan > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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: usage of TIME_ZONE and zone-to-zone conversion
Hi Shawn, http://pytz.sourceforge.net/ looks like it would be useful for converting time zone strings. The one thing I keep hearing, though, whenever anyone brings up time zones here on django-users is: "*ALWAYS* store dates in UTC, then convert as needed". Don't know how useful that is, but for what it's worth, *whump*, there it is. :) ---Peter Herndon On Apr 27, 2010, at 3:09 PM, Shawn Milochik wrote: > Given a date/time value and a value that is valid for the TIME_ZONE setting > in settings.py, how do I convert that date/time to the time zone defined in > settings.py? > > Example: > settings.py contains: > TIME_ZONE = 'America/New_York' > > Input contains: > date/time value "13:00" > time_zone = "America/Los_Angeles" > > Desired: > timedelta of the +/- difference needed to convert 13:00 PST to > 16:00 EST > > It would be easy to create a dictionary of these values and their UTC offsets > and just use that. But before I potentially reinvent a little wheel, I was > wondering if this conversion was already being handled in Django. > > By looking at the Django codebase I've found the tzinfo file, but it expects > to receive a timedelta as input, and doesn't actually use the TIME_ZONE > value. Further grepping seems to indicate that the string values (such as > 'America/New_York') are only passed to the database engines when creating a > connection object so that the database itself can handle the time zones, and > expects the dates it receives to already have been converted to that zone. > > It appears that the time and datetime Python libraries also use offsets and > US-centric values such as PST and EST for time zones, and not the verbose > names accepted by settings.py and PostgreSQL. > > Thanks, > Shawn > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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: Noob questions: Syntax, Python listserv, utility/helper methods?
On May 4, 2010, at 2:29 PM, mhulse wrote: > + > > Question 01: > > Going back to the AS example, I really dig using a dollar sign for > method arguments and the underscore for class properties. > > Does Python/Django allow for anything similar? :) Not as such. Names (of anything) must start with either a letter or an underscore (http://docs.python.org/reference/lexical_analysis.html#identifiers). Names that start with an underscore have special meaning (http://docs.python.org/reference/lexical_analysis.html#reserved-classes-of-identifiers), and should generally not be used for normal names of functions, class methods or class attributes. > > + > > Question 02: > > Is there a good Python listserv out there? I could not find an > obviously popular Google group. Something like the PHP user group > would be cool. :) comp.lang.python (http://groups.google.com/group/comp.lang.python/) > > + > > Question 03: > > I am building a view, and I would like to move functions within the > view into other files (for the sake of modularity)... In general, > where do you like to store your generic (to everything) / specific (to > a particular view) "helper" methods/functions? > > My co-worker suggested that I put "helper" methods in a "utilities.py" > file: > > views.py > utilities.py > > That might work well, but a part of me would prefer to do something > like this: > > views.py > utilities/ > +--- paginate.py > +--- other.py > +--- this.py > > In other words, one method per class file, vs. cramming everything > into one utilities file. > > What do ya'll suggest? > > Also, let's say "paginate.py" could be used for any project... Where > would you suggest I store "global" utility classes/methods? Utility functions that are used by multiple other files should go in a separate utilities.py. Helper functions that are specific to either a single view or are used just within views.py should be included in views.py, subject to "taste" limitations as to how long views.py should be. Separating out one helper function per file will make other Python programmers hate you. :) Keeping a bunch of unrelated functions, classes and methods together all in one file will also make other Python programmers hate you. You should use one file to hold all related classes and functions. If the file starts getting too large, you haven't thought enough about how related the classes and functions are. Notice how I'm not defining either "related" or "too large". If you break each individual function into its own file, you are going to need lots and lots of import statements in order to get anything done. That's an awful lot of unnecessary typing. > + > > Sorry if silly questions. :( Not silly, just new. You would do well to read some good Python code, to get a feel for how things are done. For instance, take a look through Django's source code, not so much to understand what it does, but just to get a feel for how it is laid out, the flow of organization, and how related subjects are organized and things are named. HTH, ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: permissions at per specific object instance
http://packages.python.org/django-authority/ or, an alternative: http://pypi.python.org/pypi/django-objectpermissions/ ---Peter Herndon On May 5, 2010, at 4:09 PM, zweb wrote: > "Permissions are set globally per type of object, not per specific > object instance. For example, it's possible to say "Mary may change > news stories," but it's not currently possible to say "Mary may change > news stories, but only the ones she created herself" or "Mary may only > change news stories that have a certain status, publication date or > ID." The latter functionality is something Django developers are > currently discussing." > > I need to build "permissions at per specific object instance" for my > app. > > Anyone has already done it ? Also it says django developers are > already discussing it.. > > You can please refer me to the threads or blog posts on 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-us...@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-us...@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: OneToOneField usage
On May 13, 2010, at 10:29 AM, TallFurryMan wrote: > Hello Django users, > > Is there a particular reason why using a related OneToOneField raises > DoesNotExist instead of returning None? Any query you make that is supposed to return one or more instances, that instead cannot find any results, returns a DoesNotExist. > > | class Person( Model ): > |pass > | > | class Pet( Model ): > |owner = OneToOneField( Person ) > | > | # Assuming "joe" exists as a Person > | >>> kitty = joe.pet > | DoesNotExist: Pet matching query does not exist. Your process is wrong. You are assuming "joe" exists. But your syntax, "kitty = joe.pet", assumes that "pet" already exists. You are assigning to "kitty" a reference to the object named by "joe.pet". If "joe.pet" does not exist, well, you get a DoesNotExist. > > SingleRelatedObjectDescriptor is expecting the related model to exist. > OneToOneField being a subclass of ForeignKey, my first attempt was: > > | >>> kitty = joe.pet.get_or_create() > | DoesNotExist: Pet matching query does not exist. This should be: kitty = Pet.objects.get_or_create(user=joe) > > It's the getter of "joe.pet" which fails. Is it that OneToOneField is > not popular enough to receive such an implementation, or is there a > deeper philosophical reason I don't see? No reason, just that your syntax is incorrect. ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Tree view me
On May 14, 2010, at 4:16 AM, cyrux cyrux wrote: > I have a simple task to accomplish. I have some hierarchal data in my > database which needs to be displayed in a UI. It needs to be simple > and preferably in a expandable tree format (although a non -expandable > should work as well). This is what I am looking for > http://source.mihelac.org/x/treetable/tests/example2.html# > > I have been looking django since last week and I haven't gone > anywhere. I have looked at a couple of extensions , but I am not sure > if they would work. So , is it possible to achieve some thing like the > above link in django ? I have looked into django-mptt and django- > treemneu but seems consuing. I have never really worked on front end > languages like HTML , PHP , so the template part of django confuses > me. There is so much of stuff happening behind the scenese that > confuses me. If somebody can tell me if this is possible, i can spend > may be a day or more looking into it, else I will probably go for php > stuff Django is front-end agnostic. There may be individual reusable apps that provide what you need, but Django itself does not come with a tree view, nor does it pick a particular JavaScript library to integrate. This means you have all the flexibility you may need to build whatever components your application requires. This also means you often have the burden of developing the front-end by yourself. In my case, I have had good results incorporating the jQuery Dynatree plugin into my application. However, I did the integration entirely myself. If you only have "a day or more" to invest on building the front-end, and you are not comfortable building HTML and wiring up JavaScript, but you *are* comfortable with PHP, then PHP may be the better choice for your needs. On the other hand, if you continue to build web applications, you will need to develop a certain expertise with HTML, CSS and JavaScript, in addition to your server-side framework and its language, so you may want to put the time in to learn the tools now. Hope that helps, ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: OneToOneField usage
On May 14, 2010, at 5:43 AM, Tom Evans wrote: > On Thu, May 13, 2010 at 7:31 PM, Daniel Roseman wrote: >> >> >> On May 13, 5:35 pm, Peter Herndon wrote: >>> On May 13, 2010, at 10:29 AM, TallFurryMan wrote: >>> >>>> Hello Django users, >>> >>>> Is there a particular reason why using a related OneToOneField raises >>>> DoesNotExist instead of returning None? >>> >>> Any query you make that is supposed to return one or more instances, that >>> instead cannot find any results, returns a DoesNotExist. >> >> Not true - a .filter() query returns an empty QuerySet if no results >> are found. However a .get() query does raise DoesNotExist if it >> doesn't find anything - which is the exact equivalent of a >> OneToOneField lookup. > > To get super pedantic, he said 'any query that is supposed to return > one or more instances' would raise a DoesNotExist. You countered with > a .filter() query, which returns 0 or more instances. > > Cheers > > Tom :) Indeed, I knew what I *meant* to say, but I must admit I didn't bother to look up the details before I wrote it all down. Further, I often forget that get_or_create returns the obj, boolean tuple, leading to the exact bug Daniel pointed out. I do that in my own code whenever I first use get_or_create again after an absence, and have to debug it. Mea culpa, I replied carelessly, points to Daniel for correcting me. But in *spirit* I was correct! :D Sadly, though, this is neither horseshoes nor hand-grenades, so close doesn't really count for much. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 do select from table where something in ('What','When','Where')
tableA.objects.filter(columnA__in=['Value1', 'Value2', 'Value3']) http://docs.djangoproject.com/en/1.2/ref/models/querysets/#in On Jun 24, 2010, at 4:18 PM, thusjanthan wrote: > Hi, > > Can someone provide the syntax for doing the following in django > queries: > > Select * from tableA where columnA in ('Value1','Value2','Value3') > > Cheers, > nathan. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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 do select from table where something in ('What','When','Where')
Yup. Sounds like you're getting the hang of it. On Jun 24, 2010, at 4:44 PM, thusjanthan wrote: > nvm found it :) just append it to the .exclude method right? > > On Jun 24, 1:40 pm, thusjanthan wrote: >> Hi, >> >> How about not in? >> >> Select * from tableA where columnA not in >> ('Value1','Value2','Value3') >> >> On Jun 24, 1:23 pm, Peter Herndon wrote: >> >> >> >>> tableA.objects.filter(columnA__in=['Value1', 'Value2', 'Value3']) >> >>> http://docs.djangoproject.com/en/1.2/ref/models/querysets/#in >> >>> On Jun 24, 2010, at 4:18 PM, thusjanthan wrote: >> >>>> Hi, >> >>>> Can someone provide the syntax for doing the following in django >>>> queries: >> >>>> Select * from tableA where columnA in ('Value1','Value2','Value3') >> >>>> Cheers, >>>> nathan. >> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "Django users" group. >>>> To post to this group, send email to django-us...@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> django-users+unsubscr...@googlegroups.com. >>>> For more options, visit this group >>>> athttp://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-us...@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-us...@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 bases blog solutions
"What am I doing wrong..." First, you aren't asking for help in the proper venue. I'm Cc'ing the django-users mailing list, which is where your question belongs, and to which I know you subscribe. Second, your question is badly put together. You need to learn to ask better questions. In this case, you mention you get an error when you try to create a virtualenv. That's a start, but you should include the text of the error stack trace. You should also include such pertinent details as your OS, your Python version. Third, consider searching for the answer. Chances are that others have encountered a similar problem, and their solutions are documented somewhere that Google can find for you. The first thing I do when confronted with an error I've never seen before is search for the text of the error. This usually obviates the need for asking questions, and is faster than waiting for a reply. HTH, ---Peter On Jul 16, 2010, at 5:10 PM, justin jools wrote: > How do i install it? > RE: http://djangoadvent.com/1.2/everything-i-hate-about-mingus/ > I tried following this to install Django-Mingus, it says it is easy > but not for a newbie who knows nothing about virtualenv! tsk! > > I don't have pip so I ran easy_install > 1. easy_install virtualenv... no problem > 2. easy_instal virtualenvwrapper... no problem > 3. mkvirtualenv myblog —-no-site-packages > I get error: mkvirtualenv myblog —-no-site-packages > > What am I doing wrong... > > thanks for your help > > On 4 Feb, 17:09, Peter Herndon wrote: >> On Feb 4, 2010, at 10:02 AM, Joel Stransky wrote: >> >>> Hi all, >>> I'm brand new to Django/Python but not software development. I just to say >>> hi and ask for your understanding on my newbish questions. >>> I realize Django, when used correctly makes it stupidly easy to create >>> webblogs but I'm curious as to whats out there as far as django based blog >>> installs go a la wordpress. >> >>> Any input is appreciated. >> >> Hi Joel, >> >> I'm tempted to suggest you write your own blog engine, as that seems to be >> the first thing every new-to-Django programmer does, and it will provide a >> good learning experience. However, if you are looking for an actual really >> good, pre-built blog app, you can't really go wrong with >> django-mingus(http://github.com/montylounge/django-mingus). There are >> dozens of other options out there (since, as written above, darn near >> everyone writes their own at some point), but django-mingusis both easy to >> use and provides an excellent example of both good software engineering and >> good deployment practices. >> >> ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 install django-mingus blog? installed vrtualenv + virtualenvwrapper now I'm stuck
>From the virtualenvwrapper instructions: "First, some initialization steps. Most of this only needs to be done one time. You will want to add the command tosource /usr/local/bin/virtualenvwrapper.sh to your shell startup file, changing the path to virtualenvwrapper.sh depending on where it was installed by pip." Did you do this part? On Jul 17, 2010, at 9:28 AM, justin jools wrote: > still trying to install django-mingus > > I loggged into my server with ssh and installed virtualenv and > virtualenvwrapper > easy_install virtualenv > pip virtualenvwrapper > ok... > > trying to follow the install instructions(bottom). I guess virtualenv/ > virtualenvwrapper need setting up? > 1. mkvirtualenv myblog --no-site-packages (virtualenv myblog --no- > site-packages works but I guess this is not correct) > error: > -bash: mkvirtualenv: command not found > > 2.workon myblog > error: > -bash: workon: command not found > > -- > The quick start assumes basic familiarity with "vitualenv":http:// > virtualenv.openplans.org/, "virtualenv wrapper":http:// > www.doughellmann.com/projects/virtualenvwrapper/. > > It also assumes you have both subversion, mecurial, and git clients > locally. > > * mkvirtualenv myblog --no-site-packages > * workon myblog > * cd myblog > * git clone git://github.com/montylounge/django-mingus.git > * cd django-mingus/mingus > * pip install -r stable-requirements.txt > * ... wait a bit > * mv local_settings.py.template local_settings.py > * ./manage.py syncdb > * .manage.py loaddata test_data.json > * ./manage.py runserver > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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: install django-mingus blog / http://djangoadvent.com/1.2/everything-i-hate-about-mingus/ pls help
Try "pip install ElementTree", your version of python does not include e-tree. Sent from my external cortex. On Jul 17, 2010, at 11:45 AM, justin jools wrote: > Trying to install django-mingus (see bottom, not easy at all!) > When installing * 6 pip install -r stable-requirements.txt > > ironed out 1 error with BeautifulSoup==3.0.8.1 - see bottom (http:// > github.com/montylounge/django-mingus/issues/issue/36) > > now I get markdown error, tried changing markdown2.0 to eariler verion > markdown1.7 made no difference: > any ideas? > >from markdown import version > > File "markdown/__init__.py", line 173, in ? > >etree = etree_loader.importETree() > > File "markdown/etree_loader.py", line 21, in importETree > >message(CRITICAL, "Failed to import ElementTree") > > File "markdown/__init__.py", line 112, in message > >raise MarkdownException, text > > markdown.MarkdownException: Failed to import ElementTree > > - > > http://djangoadvent.com/1.2/everything-i-hate-about-mingus/ > > 1. mkvirtualenv myblog --no-site-packages > 2. workon myblog > 3. cdvirtualenv > 4. git clone git://github.com/montylounge/django-mingus.git > 5. cd django-mingus/mingus > 6. pip install -r stable-requirements.txt > 7. cp local_settings.py.template local_settings.py > 8. ./manage.py syncdb > 9. ./manage.py loaddata test_data.json > 10. ./manage.py runserver > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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 persistent database(postgres) connection.
On Aug 27, 2010, at 1:17 PM, jai_python wrote: > Hi friends, >My django application runs in red hat server with apache & > mod_wsgi. We have several request which interacts with > database(postgresql), so database interaction is huge. i found that > every time django application establishing a new connection to > interact with DB. So my server hanging often due to large number of DB > connection (approximately some 200-250 connection/minute, it may > increase gradually) > Its very urgent. Hope I will get support here > Thanks for looking my thread. > > > Thanks & Regards, > Jayapal D Hi Jayapal, What you want is a connection pool for Postgres. Happily, such exists in the form of pgpool-2: http://pgpool.projects.postgresql.org/ The way it works is pgpool-2 runs as a separate daemon and spawns a configurable number of database connections. You configure pgpool-2 to listen for incoming database connections on whatever port you prefer, 5433 for example, and you tell it to talk to your database on e.g. port 5432. In your Django settings, you use the standard "postgresql_psycopg2" driver and tell it to connect to the database via port 5433. Django then uses the pooled connections, and you don't have to worry about the overhead of setting up new connections or tearing down old ones. Hope that helps, ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Deleting a Django project/ app
On Oct 3, 2010, at 4:04 PM, Sithembewena Lloyd Dube wrote: > Howdy, fellow Djangites, > > This is going to sound downright loony - but is there a special method to > delete Django projects and apps, or is it fine to just delete the > directories? I know that most third party Python packages can be > "uninstalled" by simply removing them from the default Python installation's > site-packages directory or wherever else they happen to be. I just wonder if > there are any configuration settings somewhere that would flip their wigs > about me not using a specific tool e.g. django-admin.py to uninstall? > Assuming you installed via "setup.py install" or equivalent, there is no special method; just delete the directories and any reference to the Django app in e.g. INSTALLED_APPS for any sites you want to keep. If you installed packages via Ubuntu's package manager, then "apt-get remove" is a much better method than deleting the directories. ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: minimum system requirements
On Oct 31, 2010, at 7:19 AM, ozgur yilmaz wrote: > Hi, > > I'm developing a project by django 1.2.3. Now it's time to bring the > project to production. I'm looking for dedicated servers but i dont > know the minimum hardware requirements. There are dedicated options > with P4 cpus. Is there any information about requirements? Hi Ozgur, Minimum hardware requirements are relative to the amount of traffic you will be receiving. It is certainly possible to host a Django web site on a single 256MB VPS from e.g. Rackspace, but I would not expect that single VPS to be able to handle more than a very small number of visitors at once. On the other hand, 2 load-balanced 512MB instances serving the Django app plus a larger instance running the database should suffice to handle a much larger number of concurrent users -- depending on how you architected the site. If you have particular views that run lots of database queries and perform a large number of calculations, and those views turn out to be popular destinations for your visitors, you can very rapidly run out of resources. On the other hand, if you have a good caching strategy in place and minimal required computation for your site, small servers can potentially handle a much larger load. You will need determine for yourself how much computing hardware will suffice to handle your particular requirements. You should approach this task by load-testing your application, using such tools as httpperf (http://code.google.com/p/httperf/) and Tsung (http://tsung.erlang-projects.org/) to simulate usage of your app. You will want to test all your views, and also simulate what you think will be the normal use pattern. With the knowledge of how each view responds to load, you can then tune those views individually for better performance. With the knowledge of how your app responds to the normal use pattern, you can gauge how much hardware will be required to handle your estimated number of visitors. In short, profile your app, and make decisions based on that knowledge. As with many questions regarding deployment, the answer is "It depends". ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: minimum system requirements
On Oct 31, 2010, at 9:50 PM, Javier Guerra Giraldez wrote: > On Sun, Oct 31, 2010 at 12:10 PM, Peter Herndon wrote: >> but I would not expect that single VPS to be able to handle more than a very >> small number of visitors at once. > > only if you consider several dozens "a very small number" > That rather depends on what your app does, don't you think? If your app has dynamic elements for each and every visitor, and runs large calculations on each page hit, it's possible to max out a small VPS with one client. On the other hand, if you set up e.g. Varnish with full-page caching, and have a site that changes only once every few days, yes indeed you can support several dozens of concurrent users. But either way, a single small server still won't be able to handle a full-on slashdotting. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 auth tutorial
On Nov 3, 2010, at 12:31 PM, Sebastian Alonso wrote: > Hi everyone, I'm a complete django newbie, and I need to use the Auth > system. The problem is that I haven't been able to find a good tutorial such > as que django one, with all the examples, pretty simple, very easy, with the > templates included, etc... My main issue is that i dont get on well with > html, so the templates are a complete mistery, and the forms, and everything. > The django tutorial provides you with the different templates and everything. > > For example if I search among the other tutorials in the django site, > there are tutorials related to the Auth system, but they are somehow more > advanced than what I'm looking for. For example there's one on how to expand > the user model.. but I dont even know who to use the basic auth system :P > > > So, if you know of any tutorial like the one I describe let me know, any link > is helpful... Hi Sebastian, The documentation for auth is here: http://docs.djangoproject.com/en/1.2/topics/auth/ Part of that documentation covers what you need, I think, but it isn't necessarily obvious which parts you need just to get started, so here are some pointers. You need to mark the views you want protected with the @login_required decorator, as documented here: http://docs.djangoproject.com/en/1.2/topics/auth/#the-login-required-decorator You need to add the login view to your URLs, there's boilerplate for this immediately above this link: http://docs.djangoproject.com/en/1.2/topics/auth/#django.contrib.auth.views.login In that same section, but a bit further down, there's a code listing for a login template, which should go in registration/login.html. That should be enough to get you started. There are more parts to it all, which are covered in the auth documentation linked above, but just start with the parts I've listed and you will have a decent simple basis for authentication within your app. You can add the other bits and pieces as you find you need them (for instance, a logout page, groups and permissions are the common ones). Hope that helps, ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: error haven't set the DATABASE_ENGINE setting
On Dec 30, 2009, at 2:22 PM, gintare wrote: > Hello, > > OS Debian Gnu Linux Lenny > Python 2.5 > Installed python-django_1.0.2-1+lenny2_all.deb with K-package instead > of Django-1.1.1.tar.gz, > > it was configured according instalation site: > http://docs.djangoproject.com/en/dev/topics/install/#installing-official-release > working:/mano/mysite1# ln -s 'pwd'/django-trunk/django/bin/django- > admin.py /usr/local/bin > > > > trying to run example > in folderDjango-1.1.1/examples after untaring file:///opt/sql > anywhere files/sqlany-django.1.1.tar.gz > acording to http://docs.djangoproject.com/en/dev/intro/tutorial01/ > commandpython manage.py syncdb > gives an error File "/var/lib/python-support/python2.5/django/db/ > backends/dummy/base.py", line 15, in complain >raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE > setting yet." > > How to set DATABASE_ENGINE? > > > settings.py > - > DEBUG = True > TEMPLATE_DEBUG = DEBUG > ROOT_URLCONF = 'examples.urls' > > DATABASES = { >'default': { >'ENGINE': 'django.db.backends.sqlite3', >'NAME': '/mano/mysite1/band1.db' >} > } > - > You are reading documentation for the development version of Django, not Django 1.1.1. The docs you need are here: http://docs.djangoproject.com/en/1.1/intro/tutorial01/#database-setup -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Announce: django-ldap-groups
On Jan 19, 2010, at 9:11 PM, Mike Dewhirst wrote: > On 6/08/2009 10:15am, Peter Herndon wrote: >> >> I'm pleased to announce the release of django-ldap-groups. Of special >> interest for building intranet sites, django-ldap-groups allows Django >> users to authenticate against LDAP, and allows site administrators to >> map LDAP organizational units (OUs) to Django groups. This mapping >> allows LDAP-authenticated users to acquire site permissions based on >> their LDAP OU membership, automatically when they first log in to the >> Django site. The app is available at >> http://code.google.com/p/django-ldap-groups/, and is BSD licensed. > > Peter > > I have implemented this against Novell eDirectory and it works brilliantly. > > Highly recommended :) > > Thank you > > Mike > >> >> Currently the app has been tested and works against Microsoft Active >> Directory and Novell eDirectory. Other LDAP servers will probably work >> using the eDirectory backend, but none have been tested at the time of >> writing. >> >> Please let me know if you have any questions or comments. >> >> Regards, >> >> ---Peter Herndon >> Thanks very much, Mike, I'm glad to hear you got everything up and running! Just yesterday I pushed a new revision incorporating Apple OpenDirectory support, as contributed by Preston Holmes (thanks, Preston!), as well as a couple of bug fixes. I'll see about updating the docs and cutting a new version to PyPI shortly. ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 bases blog solutions
On Feb 4, 2010, at 10:02 AM, Joel Stransky wrote: > Hi all, > I'm brand new to Django/Python but not software development. I just to say hi > and ask for your understanding on my newbish questions. > I realize Django, when used correctly makes it stupidly easy to create > webblogs but I'm curious as to whats out there as far as django based blog > installs go a la wordpress. > > Any input is appreciated. > Hi Joel, I'm tempted to suggest you write your own blog engine, as that seems to be the first thing every new-to-Django programmer does, and it will provide a good learning experience. However, if you are looking for an actual really good, pre-built blog app, you can't really go wrong with django-mingus (http://github.com/montylounge/django-mingus). There are dozens of other options out there (since, as written above, darn near everyone writes their own at some point), but django-mingus is both easy to use and provides an excellent example of both good software engineering and good deployment practices. ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 and ldap
On Feb 5, 2010, at 5:45 AM, andreas schmid wrote: > ok django-ldap-groups works perfectly now! > That's great to hear! If you run into any issues, I'll be happy to help troubleshoot. ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Sort by attribute not in database
On Feb 5, 2010, at 1:02 PM, ChrisC wrote: > This may be an easy question to answer, but I just can't seem to do > this. > > I have a model called Computer which has a function (turned into an > attribute via the property builtin) which queries the local filesystem > to get a modification time. > > ie. > Computer.object.all()[0].last_modified > > returns a time > > I want to sort by this time, but unfortunately there is no sort() > method on querysets and you cannot seem to order_by() on anything > other than table fields. > > Putting the field into the database isn't an option as it is a quickly > changing variable. > > Any help gratefully appreciated. Never forget, Django is Python. One way to do what you need would be to implement the __cmp__ special method on your Computer class. Then, if you make e.g. a list out of the results of your QuerySet, you can call sort() on the list, and you're done. The downside is that you need to make a list of your QuerySet, which may require quite a bit of memory, depending on the number of objects returned. The reason you can't order_by something that's not in the database is that the order_by method is SQL and is executed in the database as part of the query. The reason you can't sort() a queryset is that it's a generator, not a list, so it only lazily instantiates your model objects. ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Flat file application for binary data?
On Feb 5, 2010, at 1:44 PM, John DeRosa wrote: > I'm building a site that will include using lots of image files, audio clips, > and video clips. Including users uploading these things and then later > referencing them. > > I don't want to store this binary data in the database, but instead want to > store them in disk files. > > I've looked for a Django app that manages flat files, and can't find one. By > "manage," I mean functions like organizing the directory into a year/mo/date > (for example) structure, returning filenames for new data to be recorded into > a database table, and returning the binary data given a link. This stuff > isn't rocket science, but I'd rather not code it from scratch. > > Anybody know of an suitable application for this? > FileFields and ImageFields are by default stored on disk, with just a pointer stored in the db. For more examples, take a look at David Larlet's django-storages (http://code.welldev.org/django-storages/wiki/Home) and Justin Driscoll's ImageKit (http://bitbucket.org/jdriscoll/django-imagekit/wiki/Home), both of which should give you at least a starting point. With ImageKit, for example, you create a "spec" for your image fields, and part of the spec is a means of determining the filesystem storage location (including a method you can define if you need to). ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Slugify() and Clean form data Questions
On Feb 18, 2010, at 3:01 PM, Jon Loeliger wrote: > Folks, > > Quick question or two: > > Is there a canonical definition or even a reference implementation > of a slug = slugify(str) function somewhere? Yeah, I could go > grep through the sources and maybe find one? And yes, I see: > >http://docs.djangoproject.com/en/dev/ref/models/fields/#slugfield > > But even that is a bit ambiguous as to the treatment of underscores. Could you clarify what you mean by "ambiguous as to the treatment of underscores"? I don't see an ambiguity, so I wonder what I'm missing. My understanding is that a slug is usable as a URL; that's really the syntax definition, and is why it is limited to "only letters, numbers, underscores or hyphens." A slug is effectively an artifact of Django's birth in journalism-on-the-web, and an extraordinarily handy one. As such, it exists for practical reasons, rather than purity. > Naturally, I'm wanting to use a slug to identify some model instances > based on some other model field. But it's not being entered via the > Admin model, so I can't do the prepopulated_fileds[] trick either. I do indeed use the slugify() function for precisely that pattern. I override the model's save method, and populate the slug field prior to allowing the save to proceed. I picked up that trick from some other code somewhere; it isn't uncommon. HTH, ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Slugify() and Clean form data Questions
Perfect example! On Feb 18, 2010, at 4:09 PM, Matt McCants wrote: > Here's a stripped down example. I've messed with using signals instead > of overriding the save method for all the models that need a slug. But > this is quick and easy. > > http://gist.github.com/308068 > > Matt > > On Thu, 2010-02-18 at 14:53 -0600, Jon Loeliger wrote: >>> Is there a canonical definition or even a reference implementation of a slug =3D slugify(str) function somewhere? Yeah, I could go grep through the sources and maybe find one? And yes, I see: =20 http://docs.djangoproject.com/en/dev/ref/models/fields/#slugfield =20 But even that is a bit ambiguous as to the treatment of underscores. >>> >>> Could you clarify what you mean by "ambiguous as to the treatment of unders= >>> cores"? I don't see an ambiguity, so I wonder what I'm missing. >> >> Some places say underscores are valid, others say they removed: >> >>http://docs.djangoproject.com/en/dev/ref/templates/builtins/ >> >>slugify >> >> Converts to lowercase, removes non-word characters >> (alphanumerics and underscores) and converts spaces to >> hyphens. Also strips leading and trailing whitespace. >> >> >>> My understanding is that a slug is usable as a URL; that's really the synta= >>> x definition, and is why it is limited to "only letters, numbers, underscor= >>> es or hyphens." A slug is effectively an artifact of Django's birth in jour= >>> nalism-on-the-web, and an extraordinarily handy one. As such, it exists fo= >>> r practical reasons, rather than purity. >> >> Sure, I get that. >> >> It would be nice to use the same (or at least internally consistent) >> definition, of course. >> >>> I do indeed use the slugify() function for precisely that pattern. >> >> Exactly *which* slugify() function? Documentation reference? >> Import from line? >> >>> I override the model's save method, and populate the slug field prior >>> to allowing the save to proceed. I picked up that trick from some >>> other code somewhere; it isn't uncommon. >> >> Well, yeah. That's what I want to do too! :-) Any chance you >> can post a snippet for me? >> >>> HTH, >> >> Somewhat! >> >> Thanks, >> jdl >> > > > > This message is confidential, intended only for the named recipient(s) and > may contain information that is privileged or exempt from disclosure under > law. If you are not the intended recipient(s), you are notified that the > dissemination, distribution, or copying of this message is strictly > prohibited, and that this message should be deleted from your system. The > Free Lance-Star Publishing Company accepts no liability for the content of > this message, or for the consequences of any actions taken on the basis of > the information provided. If you receive this message in error, or are not > the named recipient(s), please notify the sender and delete the document from > your computer. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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: Database relations concepts
On Feb 18, 2010, at 11:47 PM, Timothy Kinney wrote: > > Here's the system I'm currently using that doesn't work too well... > > Samurai (id, name) > > Room (id, name, ForeignKey(Samurai), ForeignKey(Province)) > > Province (id, name) > > > Can someone suggest which relationships to use to get the results that > I want and explain why the relationship helps to accomplish that? > If a given samurai must be in a room, and a room can hold multiple samurai, your models should instead be: Samurai (id, name, ForeignKey(Room)) Room (id, name, ForeignKey(Province)) Province (id, name) With this set of models, a single Samurai has an FK reference to the room in which he finds himself. The Room, very similarly, has a reference to the Province in which it is located. A Province can hold many Rooms, and a Room can hold many Samurai. In Django's ORM models, a given instance of the Room model (e.g., "room = Room.objects.get(pk=1)") will have a method that allows access to all Samurais residing in that Room. So, "room.samurai_set" will give you the Room's Samurais. Similarly, for a given province, you can retrieve all rooms via "province.room_set". Relevant Django docs are here: http://docs.djangoproject.com/en/1.1/ref/models/relations/#ref-models-relations In a view, assuming you are given a Samurai, you can get to the room name via samurai.room.name, and the province name by samurai.room.province.name. If, in your view, you pass the Samurai object to the template, your template can perform that same dereference and thus you can present to the user the room name and province name in your HTML. Relevant Django docs here: http://docs.djangoproject.com/en/1.1/topics/templates/#variables For the canonical book on relational database theory, I'd suggest "Introduction to Database Systems", by Chris Date. Not for the faint of heart, the math-challenged, the practical or those short of time, but it will explain relational theory in detail. Great detail. Ye be warned. ;) I hope this helps, though the Date book probably won't, at least not without long and sustained study. There are likely other books on RDBMSs that folks can recommend. Other than that, my apologies, it's late and I no longer have a functioning brain. ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Generate random data for Django models
On Feb 19, 2010, at 5:51 PM, Timothy Kinney wrote: > So I have a nice little database now stocked with items and provinces. > I now want to generate random samurai and populate the database with > them. I can think of two ways to do this: > > 1) Through the admin interface. But how do I install a button that > will add a random samurai? Adding samurai is a built-in function on > the template, but the fields are always empty. Is there a > straightforward way to add another button called "Add Random Samurai" > that does the same thing but with the fields randomly filled from > appropriate choices? > > 2) Use a python script. This seems to have two possible methods: > a) Randomly generate samurai desired, output a JSON flatpage, and call > manage.py loaddata that_flatpage > > b) Randomly generate the samurai desired, access the database directly > and insert them using SQL syntax. (not very Django like) > > I have listed these in order of preference. Can someone tell me the > easiest way to implement a new admin button? I'm not even sure where > the admin templates are stored. :/ > > -Tim Hi Tim, Docs for overriding admin are here: http://docs.djangoproject.com/en/1.1/ref/contrib/admin/#overriding-admin-templates You will probably want to override the change_form.html template at whatever level is appropriate for your needs (Province, if you are adding Samurai to random rooms), and add a button "Generate Random Samurai". That button will be the submit for a form that points to a view you will write. That view should generate a random number, loop over that number, create a Samurai object and assign it to a randomly-chosen Room (pick a random number from 1 through the total number of rooms, get the room via "room = Room.objects.get(pk="). You will need to add a URL that will tie together the view and the submit button. For an added bonus, add an IntegerField to your form allowing you to set an upper bound on the number of Samurai generated. An approach similar to 2b would be to implement a custom management command (skeletal docs here: http://docs.djangoproject.com/en/1.1/howto/custom-management-commands/#howto-custom-management-commands but Google for better examples) that would allow you to run "python manage.py create_samurai". That command would use the same logic as I outlined for the view, and create Samurai via the ORM and assign them to random Rooms. ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 and ldap
On Mon, Feb 22, 2010 at 9:40 AM, andreas schmid wrote: > im experiencing strange problems now. the user is able to authenticate > against ldap only if in the active directory the displayName == username > why this? i dont get any error or traceback, the user only isnt able to > get logged in > If users were able to authenticate, and are now not able to authenticate, what changed? At my place of work, I've learned to expect changes in Active Directory every so often -- my AD admins are not that great at notifying users of impending changes. These changes occasionally cause breakage elsewhere. If not in AD, did something else in your environment change? The normal way ldap-groups works is that sAMAccountName is the field used to identify a user in AD (line 106 in ldap-groups/accounts/backends.py), and is used as the source of their django.contrib.auth.models.User username. So, if you go changing someone's username via the admin, or otherwise edit the username data in your db, then the username won't match the sAMAccountName, and they won't be able to log in to that account. Similarly, if their sAMAccountName changes in AD, and they log in to your site with the new name, they will effectively have created a second account in your db. If you have resources tied to an account in Django (saved bookmarks, tags, uploads, etc.), the user won't have access to those resources any longer, as they're on a new account. I realize that sAMAccountName is not the same as displayName. I wonder if you were mistaking the occasional coincidence between displayName and sAMAccountName? Or did you edit the app to use displayName? Perhaps you could post more details about your issue, including code. Also, you may want to instrument the LDAP code. Either log the results from the LDAP calls to a file, or drop in some print statements and run via runserver, and see what messages your LDAP environment produces. Useful bits to log will be lines 82, 106, and 132 in ldap-groups/accounts/backends.py. ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Slugify() and Clean form data Questions
On Mon, Feb 22, 2010 at 12:32 PM, Jon Loeliger wrote: > I get is_valid() and the notion of cleaned data. I *think*, > though, that I am asking for something more robust. > > Will some_form.is_valid() will, say, remove (or identify) > embedded SQL hacking attempts from a plain text field input? > http://www.djangobook.com/en/2.0/chapter20/ The part on CSRF is a bit outdated for Django 1.2, which features improved CSRF protection, but the rest is still on point, to my knowledge. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 and ldap
On Feb 22, 2010, at 3:13 PM, andreas schmid wrote: > Peter Herndon wrote: >> On Mon, Feb 22, 2010 at 9:40 AM, andreas schmid wrote: >> >> >>> im experiencing strange problems now. the user is able to authenticate >>> against ldap only if in the active directory the displayName == username >>> why this? i dont get any error or traceback, the user only isnt able to >>> get logged in >>> >>> >> >> If users were able to authenticate, and are now not able to >> authenticate, what changed? > i was thinkin the authentication over ldap group was working because i > testet it only whith a testuser which had sAMAccountName == displayName > but now im figuring that if thats not equal it desnt work as expected. > the app is still in development and i didnt work on it for a few days. Hmm. When I get to work tomorrow, I'll take a look and see if the displayName is the same as the sAMAccountName in our AD. If they are consistently the same, that might be a sign that some part of this operation is looking at the displayName. It occurs to me, Andreas, I'd be very interested to know if someone who has a displayName *different* from the sAMAccountName can log in initially, but not a second time; or, can that person not log in at all? Is it consistent? If you change someone's displayName, do they instantly stop being able to log in? >> > i started to log a bit today and will go on tomorrow and post what i > will get or the solution if i will find it. Do let me know. I'm wondering if the problem is with the bind setting on line 81 of backends.py. Where I work, our AD is configured to accept "hernd...@example" for the bind, where the "@example" is your NT4_DOMAIN setting. If your AD is not configured to accept that kind of identifier, that might cause an issue. We may need to mix things up a bit, and try a search-for-user-and-then-bind approach similar to the one in the eDirectory backend starting at line 157. It also occurs to me that the "n...@domain" pattern might be looking at displayName -- I'm no expert on Active Directory. To that end, you may want to insert a logging statement of the exception that's caught at line 134, between 134 and 135. ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: transaction in django app desktop
On Feb 24, 2010, at 2:51 PM, ktemo wrote: > hi > i working in a desktop app with django mysql, and wxpython, and i > need to make transaction > i read the doc online, but i dont know if is possible work with a > desktop app If you could provide more detail on what you want to accomplish, we could provide better responses. Barring that, I'll try to guess what you meant; please let me know if I am misunderstanding you. I guess from what you've provided that you are writing a GUI front-end in wxPython that makes HTTP calls to a backend server. That backend server is running Django, and storing data in MySQL. Django itself doesn't care where an HTTP request comes from. You could be making the request from a GUI app, from JavaScript via Ajax in a browser, or from HTML in a browser. Django doesn't care, it treats all requests the same way. So if you write a view function in Django that accepts a request containing certain arguments, and that view function uses Django's ORM to modify data in the database in a transaction, you can call that view from your GUI, from a browser, from curl or wget, or any other means at your disposal to generate an HTTP request, and the view function will run inside its transaction just fine. So yes, it is possible. Does that answer your question? ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Adding a new convenience filter 'contains_any'
On Mar 4, 2010, at 2:56 PM, aditya wrote: > I would like to add a new filter for models to my django build that > can be used as follows: > > tags = ['tag1','tag2','tag3''tagn'] > i = Image.objects.filter(tags__contains_any=tags) > > > Essentially, instead of passing a string, I pass a list and get a set > of valid objects that match *any* of the items in the list. I'm a loss > for where to look for the relevant code, thoughI'm trying to find > where the 'contains' filter has been implemented, so that I can take a > look at how its written. Currently I'm looking at db.models.query and > db.models.query_utils. Where should I be looking? > Hi Aditya, Won't the "in" filter do exactly what you need? http://docs.djangoproject.com/en/1.1/ref/models/querysets/#in ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Adding a new convenience filter 'contains_any'
On Mar 4, 2010, at 6:07 PM, Phlip wrote: > Peter Herndon wrote: > >> Won't the "in" filter do exactly what you need? >> >> http://docs.djangoproject.com/en/1.1/ref/models/querysets/#in > > Why do you need even __in? Given... > > Entry.objects.filter(id__in=[1, 3, 4]) > > ...couldn't id=[] overload if the target is a list? I suppose it could if it were written that way, but it isn't. The filter form "filter(=)" is shorthand for the form "filter(__exact=)". To my knowledge, no one has written an operator overload for a Django filter operation. I could of course be mistaken about that, but in my opinion, such overloading would go against the Python philosophy that "explicit is better than implicit." Since an "in" operator already exists, and is a direct analog of the SQL "IN" operator, using that seems preferable. Again, assuming I'm properly understanding the original poster's problem. I believe, from reading your recent back-and-forth with James, that you are looking for ways to reduce the amount of code you need to type. Neither Python nor Django are oriented towards code brevity as their primary motivation; instead, ensuring that code can be easily read and understood is primary. Occasionally, legibility clashes with brevity, as you've pointed out. I personally find this emphasis to be a pleasant release from being forced to interpret code that is obfuscated by its brevity. But that's just my preference. ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Adding a new convenience filter 'contains_any'
On Mar 4, 2010, at 7:37 PM, Phlip wrote: > > Sorry, I didn't say "operator overload" (which are either spot-on or > sophomoric, when they work). I'm using "operator overloading" in this case because "id=" already has a specific function, and you would have it do something in addition to that function. I may be using the term incorrectly. > Because, IIRC, no SQL database can store arrays ('list's) in fields, > the =[] event is free to be "overloaded" by its type. Entertainingly, Postgresql does have array types (http://www.postgresql.org/docs/8.4/interactive/arrays.html), though that's more of an exception than the general case. Django's ORM doesn't support db arrays directly, though there is the CommaSeparatedIntegerField, which approximates a primitive version. > So id=[] would resolve to id__in=[], id=Scalar to id__exact=Scalar, > and the explicit versions are available if you suspect that > overloading is fragile. Interesting thought. Might be worth doing, to see how practical it is. You should start it as a third-party project, see how much traction it gets. > > (I also disagree with leaving out the spaces around =, but obviously > obeying a team style guide supersedes improving it...) Interestingly, that particular style choice is part of the language-level style guide, PEP8 (http://www.python.org/dev/peps/pep-0008/), rather than Django-specific. Needless to say, it's a guide, rather than a syntax error, so it could be (and occasionally is, in some projects) ignored at the project level. In the case of Django, though, PEP8 is specified. I personally think it's a good thing that there's a language-level style guide, which is entirely consistent with both the goal of clarity/legibility, and the philosophy that "there should be one --and preferably only one-- obvious way to do it". It means I don't have to think about style, I can instead focus on solving the problem. Which is, really, the entire point of any style guide. ---Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Adding a new convenience filter 'contains_any'
On Mar 5, 2010, at 1:03 PM, Phlip wrote: > On Mar 5, 8:41 am, Peter Herndon wrote: > >> On Mar 4, 2010, at 7:37 PM, Phlip wrote: > >>> (I also disagree with leaving out the spaces around =, but obviously >>> obeying a team style guide supersedes improving it...) >> >> ... the goal of clarity/legibility > > uh... ;) I meant *having* a style guide was consistent with said goal. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Multi-cores & Django
On Apr 1, 2010, at 7:35 AM, Daniel Hilton wrote: > I'm researching the deployment of a new internal app and the ops team > have asked me what type of server the app requires. What I'm looking > for is some advice / guidance on how best to make > use of multi cores in a single machine deployment. > > We are currently running mod_wsgi, postgresql on a single machine. > > What I've read has said that due to GIL you need to run multi-process > mod_wsgi and make use of that to Hi Dan, I've had some really good performance improvements in moving from Apache + mod_wsgi running Django + PostgreSQL to a stack consisting of nginx + gunicorn.py running Django, controlled by supervisord + memcached + pgpool + Postgres, on a single server. The single server has 2 CPUs/4 cores per CPU, and 32GB of RAM, as well as 2 x 15k SAS local hard drives in RAID 1, and 2 fiber channel HBAs to connect to SAN. I'm running 4 processes each of nginx, gunicorn, and pgpool, and am able to serve a few thousand requests per second. I haven't spent a great deal of time benchmarking it or working to improve efficiency much, as I don't anticipate anywhere near that high a load, but I know there's quite a bit of room for further improvement. The reason I chose to move from Apache and mod_wsgi to nginx and gunicorn wasn't necessarily because I couldn't get decent performance out of mod_wsgi, but because the nginx + gunicorn stack scales down for use on a small VM really well, as well as scaling up and out easily. That way I can use one stack for all cases, just increase the number of processes as the server scales up. Your ops folks will like that idea. What the ops folks won't like so much is that gunicorn is a very speedy moving target. But if you use pip to install it, and pip -U to keep on top of new releases, you'll be fine. The above server runs us about $5k, your mileage will inevitably vary. If you don't require SAN, you can chop ~$1500 off by dropping the HBAs. Hope that helps, ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: PK and FK questions
On Apr 7, 2010, at 11:45 AM, ojayred wrote: > Hello All, > > I am new to Django and thinking about migrating to Django from our > existing web environment. I had a couple of questions that I would > like help in answering them. Your insight is greatly appreciated. > Thank you. > > 1) Considering, there is no support for Multiple Primary keys, how > would Django react if my tables have multiple primary keys and I tried > to update or delete a record? I am just curious. I don't know the answer, but assuming you already have tables built in your database, you can run "manage.py inspectdb" to see what ORM code Django would generate from such a table. If it generates something useful, then you are in business. In short, test. It shouldn't pose too much of a problem in a development environment. > > 2) I read somewhere that each table must have one primary key? Some of > our tables have no primary keys. Then you are doing it wrong in your database. Every table should have a primary key, regardless of how few rows it may have. Otherwise, your database has (theoretically, not usually true in practice) no means of determining one row from another. As others have mentioned, a Django model by default uses an autoincremented integer field as an artificial primary key, if you don't otherwise specify a PK in the model definition. > > 3) Is there a limit on the number of Foreign Keys in a table? I don't believe Django imposes such a limit. More likely, such a limit would be imposed by your database. > > 4) How often would I need to patch and/or upgrade Django? And is this > a difficult procedure? It depends. If your web application faces the public Internet, you will want to start with a current release of Django, and stay up to date with security and bugfix releases. If your web app is internal-only, I would still argue you should update for bugfixes and security releases, but you could likely get away with not updating, depending on the security policies of your company. You mention your test environment is OpenVMS. I don't know much about OpenVMS, except to say that when I used VAX/VMS in college many years ago, it was not Unix. As such, I don't know whether Python will work on your system. Assuming it does, then Django itself should run well enough. That also means that standard Python facilities for managing module installations should also work. You can thus use Distribute and Pip to keep your Django install up to date fairly easily. The harder question is whether you will need to modify your application to run with the updated version of Django. The Django core developers make a very strong effort to maintain backwards compatibility, and you can thus assume that updating from e.g. version 1.1.0 to 1.1.1 will be painless. But migrating from 1.1.x to 1.2 will only be *mostly* painless. Again, you can assume that everything will be backwards-compatible, but there may be the odd exception in the case of a bugfix. Much more likely, there will be new and improved functionality introduced that you will want to use, that will necessitate changes in your code. For instance, 1.2 will introduce the ability to connect to multiple databases. The means of specifying multiple db connections in the settings file has of course changed to accommodate the new features, though the old settings structure will continue to work as-is. Finally, as you work on your application, you may find yourself needing to modify the database table structures -- assuming you allow Django's ORM to manage your tables, which is a common case. In that situation, the changes to the underlying DDL can be automated using a Django-aware schema migration tool. South (http://south.aeracode.org/) is one such tool. ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 use IPC in Django??
On Apr 11, 2010, at 5:52 AM, vishwanath b wrote: > I have developed an application in django which has to send or receive > requests from/to a server.These requests have to be sent or received > through sockets.how do i achieve this? Python socket programming: http://docs.python.org/library/socket.html An amazingly good book on the subject: http://www.complete.org/FoundationsOfPythonNetworkProgramming -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 use IPC in Django??
On Apr 11, 2010, at 10:20 AM, vishwanath b wrote: > thanx for the reply...peter i am new to django so i am a bit confused > regarding implementing this...will i have to write python socket > client code in views which would interact with server c code rite? > > On Apr 11, 7:11 pm, Peter Herndon wrote: >> On Apr 11, 2010, at 5:52 AM, vishwanath b wrote: >> >>> I have developed an application in django which has to send or receive >>> requests from/to a server.These requests have to be sent or received >>> through sockets.how do i achieve this? >> >> Python socket programming:http://docs.python.org/library/socket.html >> >> An amazingly good book on the >> subject:http://www.complete.org/FoundationsOfPythonNetworkProgramming Django is a web framework, that is, HTTP. As such, it abstracts the mechanisms of connecting via TCP/IP sockets, so that you, the web application developer, do not need to deal with low-level socket programming. However, it does so only for HTTP, not for any other kind of network protocol. If you, as you said in your original email, need to connect to network sockets to transmit data that are *not* HTTP protocol, you will need to implement that functionality yourself. Yes, it can go in a view, if that's the appropriate place for the code. But at that point, you are working beyond Django's scope, and will need to either implement your solution using Python's socket library, or perhaps using a third-party library that implements a client for whatever network service you are using. In short, you haven't described your problem very well. Tell us about the services with which you need to communicate, and perhaps we can point you in the right direction. Better yet, search Google for "python ", where network_service is whatever you are trying to use. You will likely find that higher-level libraries exist to facilitate your work for just about every network protocol. On the other hand, if you are interfacing with custom code, well, you'll likely have to write your own Python client library yourself, and then call that library from within your views. ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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... False promises?
On Jan 4, 2008 2:26 AM, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > forget running the debian version - it will always be way out of > date. Use the latest svn trunk as described in the tutorial. Also > forget about using the django book - use the latest docs on the web > site. The latest svn has too many goodies not present in .96 that it > is a shame not to use it. > While I understand Ken's point about the book, in that it is no longer the complete reference, I would *not* recommend just forgetting it. Instead, use it as the valuable resource it is, and supplement your nautical sojourn with reference to the online documentation as needed. I, for one, have found the book to be extremely helpful overall, as well as useful in helping to clarify parts of the online documentation that are, perhaps, overly terse. In addition, having things explained in a different way provides extra perspective. And, more to the point, you've already dropped the sawbucks on the book, right? Regards, ---Peter --~--~-~--~~~---~--~~ 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: IDE
I use vim a lot for, as Michael says, quick editing tasks. For longer coding sessions, I use Coda (http://www.panic.com/coda/). It's payware, and it's OS X only, but it is so easy and amazingly productive. You have a terminal session, WebKit-based browser, (S)FTP client, and a really decent text editor all in one program. In addition, if you are doing pair-programming, the editor supports live shared editing sessions -- you and your coding partner can both be working on the same file at the same time. On top of that, there's a visual CSS manipulator, though I don't find it of much use, and some reference material linked in, though accessing it requires Internet access, and the material is not the best. There are some things Coda lacks that I'd love to see, including either the ability to handle version control integration, or some means of running outboard scripts/plug-ins, but overall it makes developing Django apps a breeze. --~--~-~--~~~---~--~~ 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: Access control
http://www.djangoproject.com/documentation/authentication/ On Sat, Mar 29, 2008 at 1:04 PM, Wilson Acha <[EMAIL PROTECTED]> wrote: > > Hello, django have any library that allows include a login and enable > restrict access to different parts of the application according to > roles and / or profiles > > Wilson > > > > --~--~-~--~~~---~--~~ 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: Fedora Core 4 - Django-dev & Mysql
The immediate solution is to download the source and compile. A better solution, i.e. a prebuilt RPM, might be available from somewhere, I haven't searched. ---Peter On 4/14/08, martyn <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm using Fedora Core 4 and MySQL as my database for Django. > I installed mysql-python from here > http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/MySQL-python-1.2.0-1.i386.rpm > Then I run Django (the dev version - 0.97-pre-SVN-unknown) and it > tells me this : > > ""ImproperlyConfigured: MySQLdb-1.2.1p2 or newer is required; you have > 1.2.0"" > > I can't find any mysql-python-1.2.1 for FedoraCore4. > If someone knows the problem, thanks for helping me. > > Martyn > > > --~--~-~--~~~---~--~~ 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: getting a problem while using templates
You need to set an environment variable DJANGO_SETTINGS_MODULE that points to your settings.py. Look up the documentation on settings for more detail. This isn't necessary when running the development server, IIRC, but becomes necessary when running under Apache/mod_python. On 6/4/08, Sandy <[EMAIL PROTECTED]> wrote: > > hi > iam new to django. i just installed the Django. can any one > help me in setting the environment variables . > actually i put a path like: C:\Python25\Lib\site-packages\django\ and > site-packages\bin\django-admin.py > but for both types iam unable to import templates. > > whenever i try this line > > from django.template.loader import get_template > > the following errors are coming:- > > Traceback (most recent call last): > File "", line 1, in > from django.template.loader import get_template > File "C:\Python25\Lib\site-packages\django\template\__init__.py", > line 918, in > add_to_builtins('django.template.defaultfilters') > File "C:\Python25\Lib\site-packages\django\template\__init__.py", > line 915, in add_to_builtins > builtins.append(get_library(module_name)) > File "C:\Python25\Lib\site-packages\django\template\__init__.py", > line 904, in get_library > mod = __import__(module_name, {}, {}, ['']) > File "C:\Python25\Lib\site-packages\django\template > \defaultfilters.py", line 5, in > from django.utils.translation import gettext > File "C:\Python25\Lib\site-packages\django\utils\translation > \__init__.py", line 3, in > if settings.USE_I18N: > File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line > 28, in __getattr__ > self._import_settings() > File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line > 53, in _import_settings > raise EnvironmentError, "Environment variable %s is undefined." % > ENVIRONMENT_VARIABLE > EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is > undefined. > > thankyou in advance > > > > --~--~-~--~~~---~--~~ 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: Importing data from 'MS Access' .mdb files
Two possibilities come to mind. First, is the Python ADODBAPI module: http://sourceforge.net/projects/adodbapi Second, as an *extremely* useful tool for this sort of thing, may I suggest Navicat for MySQL on Windows? The Windows version allows you to import .mdb files and do data transfers directly into MySQL, with some mapping. It may not afford you the entire power of Python for manipulating the data, but it will give you a very nice leg up on the process. Not free, but not too expensive, and there is an evaluation version so you can see what it will do for you. If you need to script data transfers and manipulations for multiple runs, then the ADODBAPI module will work well. For figuring out what you need to do, Navicat will be a big help, and if your manipulations are not extensive, will possibly be entirely sufficient. Plus, it makes a really nice MySQL admin tool (that being its primary purpose). 2008/6/9 M.Ganesh <[EMAIL PROTECTED]>: > > chefsmart wrote: >> You may follow these steps: >> >> 1. install the MySQL ODBC connector (currently version 5.1) >> 2. create an empty database >> 3. create a DSN pointing to your newly created empty database >> 4. open your .mdb file in Access >> 5. select your table in Access and go to File->Export... >> 6. In the "save as type", choose ODBC databases(), give a name for the >> table in mysql, and then choose your DSN created in step 3 above. >> >> That's all. >> >> On Jun 9, 7:38 am, Julien <[EMAIL PROTECTED]> wrote: >> >>> The MySQL migration toolkit has worked quite well for >>> me:http://www.mysql.com/products/tools/migration-toolkit/ >>> >>> On Jun 9, 10:23 am, bacccr <[EMAIL PROTECTED]> wrote: >>> >>> also, you can export your data from access to xml (within vb) file and then load it into your mysql db with python. there is a lot of options, select the way you familiar with. On 9 июн, 04:30, "Jeffrey Johnson" <[EMAIL PROTECTED]> wrote: > Use access on your Windows PC, Get the ODBC drivers for MySQL, map the > tables and copy the data in by hand. > > Jeff > > On Sun, Jun 8, 2008 at 10:54 AM, M.Ganesh <[EMAIL PROTECTED]> wrote: > >> Hi All, >> >> I am looking for tools/methods to read(if possible also write) data from >> .mdb files which are copied into my linux box with python. I require >> this for coercing existing legacy data into MySQL with some change in >> the data structure. The ultimate aim is to replace an application >> developed in VB with django >> >> Thanks in advance >> Regards Ganesh >> > Hi Jeffery, bacccr, Julien, chefsmart & Garrett, > > Thanks for all your responses. All the suggested methods are suitable > for one time migration. Actually I am planning to migrate from VB to > django in phases. So I may have to update data many times. i.e first > export a few tables (doing some re-arrangement). After it settles down, > export few more tables, as well as the new data entered in the phase I > tables through the VB app. Basically one-time-export-of-tables will not > work for me. So, if only I can access 'ms access' tables through python, > I can write a few functions to check if the data has already reached > MySQL table, if not add it. The actual .mdb files are in a Windows box, > so if the setup will require a Windows box it is okay, but it will be > convenient if I can copy those .mdb files to my linux box, do the > initial developement and testing and finally point the functions to the > original .mdb files. > > In short I am looking for a way to read(/write) tables in a .mdb file, > through python. > > Any pointers? > > Thanks for your time once again > > Ganesh > > > > > --~--~-~--~~~---~--~~ 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 and Fliqz
Hi Julie, Django doesn't speak SOAP out of the box. You could use one of the Python SOAP libraries that are out there (ZSI comes to mind) to build your own, though. And perhaps someone has already built such an interface to Fliqz, but if so, you'd perhaps be better off asking on the mailing lists for the various SOAP libraries. ---Peter On 6/10/08, AestheticMindStudios <[EMAIL PROTECTED]> wrote: > > I am building an application and am curious if anyone has done an > interface with Fliqz using Web Services Description Language - or if > this is automatically built in as an add-on to Django? > > Anybody out there that can help answer my question - looking to > migrate to Django if it's been done and easily. > > Thanks! > Julie > > > > --~--~-~--~~~---~--~~ 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 and Fliqz
Hi Julie, Unfortunately, I have only the briefest of acquaintances with SOAP and the Python modules for working with it. I don't know where their lists are hosted. About all I do know is that ZSI stands for Zolera SOAP I-something (infrastructure, perhaps?). If you search Google for "Zolera SOAP Python", you should get the right sites quickly. Googling for "Python SOAP" should get you mentions of other libraries. I do seem to recall there was another library called Soappy, that wound up being subsumed into ZSI, though my recollection is suspect. I also think there may be a Special Interest Group page for SOAP on python.org, though it is likely to be out of date. Good luck, and happy Googling, ---Peter On 6/11/08, AestheticMindStudios <[EMAIL PROTECTED]> wrote: > > Hi Peter, > > Thanks for your input - are the mailing lists for the various SOAP > libraries > also in googlegroups? > > Best, > Julie > > On Jun 11, 7:56 am, "Peter Herndon" <[EMAIL PROTECTED]> wrote: >> Hi Julie, >> >> Django doesn't speak SOAP out of the box. You could use one of the >> Python SOAP libraries that are out there (ZSI comes to mind) to build >> your own, though. >> >> And perhaps someone has already built such an interface to Fliqz, but >> if so, you'd perhaps be better off asking on the mailing lists for the >> various SOAP libraries. >> >> ---Peter >> >> On 6/10/08, AestheticMindStudios <[EMAIL PROTECTED]> wrote: >> >> >> >> > I am building an application and am curious if anyone has done an >> > interface with Fliqz using Web Services Description Language - or if >> > this is automatically built in as an add-on to Django? >> >> > Anybody out there that can help answer my question - looking to >> > migrate to Django if it's been done and easily. >> >> > Thanks! >> > Julie > > > --~--~-~--~~~---~--~~ 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: Handling unknown data
Or better yet, normalize first. A given Winner can have one or more Fields, so build a Field model with a ManyToMany relationship to the Winner model, and make it unique=True and asymmetric. Work backwards in a similar chain all the way to Event. On the other hand, that this set of models will quickly get really complex is an indicator that your data could stand some further thought -- how can your model be simplified? Of course, it could also just be an indicator that your problem domain really is complex... ---Peter, not the same one ;) On 6/12/08, Peter Rowell <[EMAIL PROTECTED]> wrote: > >> I'd like to store the results for the event, but can't >> figure out how. The event object is generic, but the results >> structures are specific to that event. > > What first occurs to me is to give the Event class a TextField called > 'results' which contains a pickled python object/dict/list (whatever) > of the results. This gives maximum flexibility in what you are storing > (this is what the django.contrib.sessions code does for session > variables), but it means that the results are not easily operated on > by DB calls. > > If you do need to have certain operations performed on the results > (something like "all races that Bob competed in"), you might extract > that info into a separate text field of comma-separated-values to make > searching/life easier. If you have many entries for the same > contestant, you might represent this as a separate mapping model. > Admittedly this breaks any "normalization" of your data, but that's > already happened by the variable shape of the results themselves. > Besides, as someone (who?) said a while ago, normalization is for > wimps. > > HTH, > Peter > > > > --~--~-~--~~~---~--~~ 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: pluggable django ticketing app?
Hi all, The Django-NYC users' group is working on an issue tracker, at http://code.google.com/p/django-issues. If you are interested in contributing, please let me know, and I'll add you to the committers. Please see the django-nyc google discussion group for some additional context on the app. It was started both to scratch an itch, and as a training exercise for our new-to-Django members. Thanks, ---Peter Herndon http://spookypony.com On 7/6/08, Milan Andric <[EMAIL PROTECTED]> wrote: > > On Sun, Jul 6, 2008 at 12:05 AM, chefsmart <[EMAIL PROTECTED]> wrote: >> >> Does anyone know of a pluggable django ticketing app? Something like >> the apps used by webhosts for online support? > > I have yet to see something available for Django that does > ticketing/issue tracking. But I may have missed it, hopefully someone > on this list can enlighten the both of us. But in the Python world > setting up Trac to integrate Django authentication was not too ugly. > Here's the Trac module I used with the 0.12 (i think) version of Trac. > > http://trac-hacks.swapoff.org/attachment/wiki/DjangoAuthIntegration/djangoauth_1.py > http://trac-hacks.org/wiki/DjangoAuthIntegration > > But I have heard at least a handful of people interested in developing > this kind of app, me included, but my queue is backlogged as usual. > > -- > Milan > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: looking to override some admin save features
Bumping doesn't help, and just makes you look impatient. If you want a more immediate answer, log in to the #django IRC channel on freenode. Aside from that, it sounds like you want the newforms-admin branch. Search for that on the wiki. ---Peter Herndon On 7/7/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > bump. > > On Jul 7, 3:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> a brief description of what I am trying to do: >> >> developing a project where I would like to keep django intact allowing >> for seamless SVN updates of django. However, I need to add a bit of >> functionality in the saves of a few admin functions. Basically I just >> need to audit some actions (modifying of users, etc). Is there an >> easy way to do this? I am pretty new to django and python so my >> apologies if this is an obvious question. > > > --~--~-~--~~~---~--~~ 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: Inserting html into a page dynamically
Django is an excellent framework for developing web applications, but it doesn't do away with the need for JavaScript. In your case, I would very much use JavaScript to make the HTML dynamic. I've done much the same, though on a smaller scale, in my own apps. Django gives you a very easy means of getting data in and out of a web page, via the ORM, the views and templates, and URLconf, but you still need JavaScript to do the kinds of things you're describing. However, if you need your AJAX call to return some information dynamically calculated by the server, retrieved from a database, or something like that, you can write your AJAX to call a Django view. You would write that view to do the calculations required, and return the data as XML or JSON. ---Peter Herndon On Mon, Jul 7, 2008 at 4:48 PM, Bear <[EMAIL PROTECTED]> wrote: > > Hi > > I'm new with Django and I can't figure out a method to do what I want, > that is to say inserting html dynamically in my page (I'm not very > good in english so I'll do my best to explain it with an example) > > Let's say the goal of the page is to let the user build a > "storyboard". A storyboard is just a succession of many elements that > the user can chose to add by clicking on links. When the user comes on > the page, it's empty. There are a few links to add elements to the > storyboard. > > An element can be just a title (as a charfield) or it can be a more > complex thing (combination of image and textfield etc..). So in order > to help the user to build his storyboard, I already have those > elements in templates (pre-built forms in fact that could be just html > code in my database). The user just needs to click on a link and here > it is, it adds the html code of the element in the page. > > The thing is that each time the user clicks on a link, I want the page > to keep its appearence. If the user wants to add 3 titles, 4 image > fields, and a textfield, he just clicks on the related links, and then > he can fill in all the forms. I also want the user to be able to > manage each element separately. Save or delete.. > > I just can't figure out how to do this. How do I tell Django to add > some stuff in a page like that ? > In ajax I'd just have a view to load an element that would be called > as the user clicks on a link, and then get back the html code of the > element and add it into my page wherever I want. But without ajax, I > really don't know. > > If someone could understand my problem and help me it would be great. > > Thx. > > Bibi > > > > > > --~--~-~--~~~---~--~~ 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: "ColorField"?
You'll want to check out django.db.models.fields, django.db.models.fields.subclassing, and django.core.validators as starting points for creating a new Field type with a custom validator. In addition, there's a js attribute for class Admin you can use to bring in the necessary JavaScript into admin (http://www.djangoproject.com/documentation/model-api/#js), or you can look into newforms-admin branch (soon to be trunk) for more options on custom admin pages. On Mon, Jul 7, 2008 at 11:28 PM, Leaf <[EMAIL PROTECTED]> wrote: > > Also note - when I say this, I'm talking about something that can plug > in to the admin interface. Just clearing that up. > > Regards, > Leaf > > > --~--~-~--~~~---~--~~ 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: Issue with django-tagging 0.3 (svn) with models definition
For a more immediate answer, ask on #django on IRC. Mailing list may not answer as quickly as you'd prefer. Or at all, if nobody has the time to answer. You should look at the model documentation for specifics, but you likely need null=True as a param in your tags=Tagfield() declaration. ---Pete r Herndon On 7/8/08, Nicolas Steinmetz <[EMAIL PROTECTED]> wrote: > > Nicolas Steinmetz wrote: > >> >> Hello, >> >> Despite I read a lot of time the overview.txt on the django tagging svn >> repository, I still can't stand how to use it at my model's level. I'm >> quite new to python and may miss some elements. >> >> When diving into the register part, it says it requiers a field for tag >> which is supposed to be "tags". But what kind of type is this tag supposed >> to be ? a TagField() ? >> >> I came down to this kind of things which looks not the optimum for me (at >> least at validate & runserver step, it stops shouting...): >> >> from django.db import models >> import tagging >> from tagging.models import Tag >> from tagging.fields import TagField >> >> # Create your models here. >> class Links(models.Model): >> title = models.CharField(max_length=80) >> description = models.TextField() >> url = models.URLField() >> tags = TagField() >> >> class Admin: >> list_display = ('title', 'description', 'url', 'tags',) >> list_filter = ['title', 'tags'] >> search_fields = ['title','tags',] >> >> class Meta: >> verbose_name = "Lien" >> verbose_name_plural = "Liens" >> >> tagging.register(Links) >> >> But when I try to save a link, I got : >> >> IntegrityError at /admin/links/links/add/ >> tagging_taggeditem.object_id may not be NULL >> >> What did I miss ? >> >> Regards, >> Nicolas >> > > Nobody is in a similar case than mine ? > -- > Nicolas Steinmetz > http://www.steinmetz.fr/ > http://www.unelectronlibre.info/ > > > > > --~--~-~--~~~---~--~~ 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: "ImportError No module named django"
Yes, the install worked. If you can import a module without error, it's installed successfully. Mostly. ;) You can also successfully import a module even if it is not on PYTHON_PATH, if you are in the same directory as the module. ---Peter Herndon On 7/9/08, MadMax007 <[EMAIL PROTECTED]> wrote: > > Thanks for the links I'll check them out > > One last question, I re-did the installation for Django using some > instructions I found on Google. When I open Python now and type: > >>>> import.django >>>> django.VERSION >>>> (0,96 ) "There's something else after the 0, 96 but I can't remember >>>> what it is sorry, (I'm writing this post from work) > > Does this mean that the install worked this time ? > > On Jul 8, 11:04 pm, Julien Phalip <[EMAIL PROTECTED]> wrote: >> Apparently Django is not present in the PYTHONPATH and therefore not >> reachable by Python. >> I'm not a Mac user, but some help can be found on google. >> >> Try there for >> example:http://antoniocangiano.com/2007/12/22/how-to-install-django-with-mysq...http://www.rhonabwy.com/wp/2006/07/20/installing-django-on-macos-x-de... >> >> In the first link, the section "Telling Python where Django is" looks >> like what you're after. >> >> Cheers, >> >> Julien >> >> On Jul 9, 12:34 pm, MadMax007 <[EMAIL PROTECTED]> wrote: >> >> > Ok, for the PYTHONPATH I got: >> >> > >>> import sys >> > >>> print sys.path >> >> > ['', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ >> > python25.zip', '/System/Library/Frameworks/Python.framework/Versions/ >> > 2.5/lib/python2.5', '/System/Library/Frameworks/Python.framework/ >> > Versions/2.5/lib/python2.5/plat-darwin', '/System/Library/Frameworks/ >> > Python.framework/Versions/2.5/lib/python2.5/plat-mac', '/System/ >> > Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat- >> > mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/ >> > Versions/2.5/Extras/lib/python', '/System/Library/Frameworks/ >> > Python.framework/Versions/2.5/lib/python2.5/lib-tk', '/System/Library/ >> > Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload', '/ >> > Library/Python/2.5/site-packages', '/System/Library/Frameworks/ >> > Python.framework/Versions/2.5/Extras/lib/python/PyObjC'] >> >> > Hope this tells you something, I relatively new to Apple computers so >> > I feel a bit lost, and to top things off, I'm new to Python as well : >> > ( >> >> > On Jul 8, 5:42 pm, Julien Phalip <[EMAIL PROTECTED]> wrote: >> >> > > Hi, >> >> > > This means that Django is not in the PYTHONPATH. To check what's in >> > > that path, run the following in Python: >> >> > > >>> import sys >> > > >>> print sys.path >> >> > > On Jul 9, 9:35 am, Juanjo Conti <[EMAIL PROTECTED]> wrote: >> >> > > > How did you exactly install it? >> > > > Which folders are in your PYTHONPATH? >> >> > > > Juanjo >> > > > -- >> > > > mi blog:http://www.juanjoconti.com.ar > > > --~--~-~--~~~---~--~~ 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: Non-programmer looking to create more sophisticated site
Hi Michael, > I've been wanting to get into Python, thinking it could be good for > certain interactivity which I haven't implemented really in my sites, > DB access, forms. Indeed, Python in general and Django in particular are quite good for these sorts of features. > But I have a site design to do where the company rents corporate short- > term housing. I want to create about 10 pages, a few of them > editable, and maybe explore doing a properties database and multiple > contact forms. > > Am I crazy to be thinking about using Django for this at my skill > level? I installed Plone locally to play around, seems good, but > maybe too much overhead. Crazy? Not at all. This project sounds like a very good way to get started learning Python and Django. The caveat, though, is your time frame. If your client needs this site up and running *now*, or within a short time-frame, this might not be the best time to start learning both a new language and a new web framework. On the other hand, if you are a self-starter and intellectually curious, there's nothing like a deadline for providing motivation. > If I want to use Django, do I have to some up with some kind of > database setup to list properties with a picture? The short answer is yes. The longer answer is, strictly speaking, I imagine it's possible to use Django without a database, but doing so would be going against the intent of the framework. > Where might I begin > to do this for the first time? This depends very much on your hosting setup. I'll leave to others a discussion of the relative merits of various hosting companies, and you will find much discussion on that very topic in the list archives. In general, though, Python 2.5 comes with bindings for sqlite and the sqlite engine -- "batteries included" and all that -- which, for exploration and learning purposes, should be enough to start. I would strongly recommend *against* using sqlite as your production database, though. > Will I be able to quickly make the main HTML page template and add > content to it, or is that not how this works? Yes, that is exactly how it works. You can set up a site-specific template, and create pages that pull in that template. The template documentation is here: http://www.djangoproject.com/documentation/templates/ I'd also suggest you work your way through the tutorial, as it covers the basic aspects of building a Django-powered site. ---Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Form result notices
Hi Julien, > I'd like to hear your advice on the best way to go with displaying > form result notices. > > For example, after editing an object via a newform, the following page > displays a notice that says "Object successfully updated". There is no canonical "best way". There are, instead, a bunch of different ways, depending on what effect you are wanting. That is, you could return HttpResponseRedirect and send your users to a "successfully updated" page. Or, if you want them to stay on the same form and just be alerted of a successful save, you could use Ajax to send back to your page notification of successful save, and the Javascript could display the notification. It rather depends on what makes sense for your application. So tell us more about what you are trying to accomplish. ---Peter --~--~-~--~~~---~--~~ 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: Beginner a bit lost - need some pointers please
On Oct 5, 2011, at 3:55 PM, Chris G wrote: > > However two rather basic things still elude me:- > >Where/how do I actually start creating the top level/page of a web >site? Do I just open vi and create some HTML and embed django >code? That seems unlikely but I can't see anywhere that tells me >what the code that creates a django site looks like and/or where it >resides. An actual example of a two or three page working django >based web site would be a huge help. I've seen a few different patterns in regards to this question. One scenario is where you have a multi-purpose Django site comprised of multiple reusable apps with no obvious top-level entry point, you can create a view "def index(request)", and have it render a template with whatever data you want to send it -- including perhaps no data at all. Then map your index view to '/' in urls.py at the project level, put together a template and you're all set. Another option I've seen is if you have a single-purpose site where one app is primary, you map your primary app's start page as your index. An example would be a blog, and you would set up your chronological entries list page as the index. > >I can't see anywhere that seems to tell me the issues involved with >moving from using the built in web server to using apache2 (or >whatever, I have apache2 on my system). The short version is that the built-in server was built as a just-good-enough-to-use-while-developing solution, and is not sufficient to handle more than a minimal load. The trade-off is that configuring apache2 + mod_wsgi, or nginx + gunicorn, is more complex than just running the devserver. Hope this helps a bit, ---Peter Herndon -- 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: FAQ app 2011
Hi Mike, revsys/django-fack is a reasonably recent fork of howiworkdaily/django-faq, with some subsequent divergence between the two code bases on both sides. Both projects' primary developers are well-respected members of the Django community. In fact, the primary developer of revsys/django-fack is Jacob Kaplan-Moss, co-BDFL of Django itself. At the same time, he respected Kevin Fricovsky's work enough to both submit fixes *and* then fork it, rather than write from scratch. I have used Kevin's app in a site, and it does what it says on the tin. I'm guessing about this, but since Jacob released django-fack under his company's github account (RevSys), chances are the cleanup work was done for a client, which means that django-fack is very likely in production somewhere. Either fork will serve well enough, though you don't mention any specific requirements that could be addressed. Were I to need an app for FAQs in a new project, I'd probably use django-fack at this point, as the code base is a little cleaner. Hope that helps, ---Peter Herndon On Nov 5, 2011, at 12:37 PM, Mike wrote: > I've been searching for a FAQ app for Django and found several but no > commentary as to which is best and still maintained, etc. > > This group looks to have mentioned the subject last in 2006 and refers > to this: > > http://simon.net.nz/articles/simple-faq-application-for-django/&usg=AFQjCNFwcCQGBUOKI_lMzqUc3gVR56Oesg > > In my googling I've found these: > > https://github.com/revsys/django-fack > https://github.com/howiworkdaily/django-faq > https://github.com/benspaulding/django-faq > http://code.google.com/p/django-generic-faq/ > > Can anyone provide some recommendations? > > -- > 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 of Django release dates?
The info is available in the Django project blog (https://www.djangoproject.com/weblog/), though you will need to do some spelunking to find the release dates. You can also find the release dates in the mailing list archives, for example, search for "released" in the Django-developers Google group. On Sat, Dec 10, 2011 at 11:52 PM, Tim Chase wrote: > After a bit of googling around, I was unable to come up with a catalog of > release dates for various versions. I was mostly just interested in things > like > > for release in "0.95 0.96 1.0 1.1 1.2 1.2.6 1.3".split(): > print release, get_release_year_and_month(release) > > sort of information, though point information would be interesting rather > than noise (such as security fixes on older versions, e.g. 1.2.6). > > Is this info readily available in some place my Googling couldn't find? Or > do I have to do a bit of wading in Subversion to extract this info? > > Thanks, > > -tkc > > > -- > 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: Multiple versions of Django
I would suggest using separate virtual environments, each with gunicorn (http://gunicorn.org/) installed into the venv. Run gunicorn listening on a different port per venv, start all your venvs under supervisord (http://supervisor.org/), and proxy them behind nginx (http://wiki.nginx.org/). On Sep 30, 2013, at 11:48 AM, Bill Freeman wrote: > Virtual environments can, indeed, be used under Apache. I presume other > front ends can also handle this. > > For Apache, the separate VE's need to be in separate deamon process groups, > so that their sys.path settings can differ. > > The primary thing that virtualenv does for you is tweak sys.path, usually by > setting PYTHONHOME, but there are other ways. > > If using a new enough mod_wsgi (3.4 or later, I htink), there is a > python-home option to the WSGIDaemonProcess directive. Otherwise you can > fiddle sys.path in your wsgi script file. If you are using Apache/mod_wsgi, > there is lots of useful documentation and a pointer to their mailing list at > http://code.google.com/p/modwsgi/ > > > On Mon, Sep 30, 2013 at 11:30 AM, Gerald Klein wrote: > Sorry please disregard I didn't read far enough into your message > > > On Mon, Sep 30, 2013 at 10:25 AM, Jasvir Singh > wrote: > Is it possible to install multiple versions of Django on single ubuntu server. > If yes, please tell me how to do this. > I have already made a try for this using virtual environment, but > found that it is only for development. > > -- > > Jasvir Singh Grewal > Blog:http://jasvirsinghgrewal91.wordpress.com/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAN_O85vhiKvpdxf74stvfR1AsLcoP6E1EeC1M86nHgFRF34K1g%40mail.gmail.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > Gerald Klein DBA > contac...@geraldklein.com > www.geraldklein.com > geraldklein.wordpress.com > j...@zognet.com > 708-599-0352 > > Arch Awesome, Ranger & Vim the coding triple threat. > Linux registered user #548580 > Brought to you by the Amish Mafia > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAP8NtCw5tr3%3Dt0k6H2CUVGfaNkX6jFhArh6E1iz32s412%3DjL0Q%40mail.gmail.com. > > For more options, visit https://groups.google.com/groups/opt_out. > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAB%2BAj0trj-MnweyArGTyfSy6SR0wdRLdwV_tYCXfOvA%3DgvOeGg%40mail.gmail.com. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/78E9816C-7555-4A0C-928D-F9D346463987%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.