Re: Hosting for Django
Hi Christian. I've tried a few hosting setups in the paste year with various degrees of success too. I've never been able to get a good, stable fcgi setup myself. In the end I've settle of webfaction. They have a very good setup with you own apache instance + mod_python, and it's very affordable. Great support as well. If you need more control, meaning root access, a VPS will probably be your best bet. Also, (mt) is working on a django-container. > But I was disappointed the minute I knew they'd be running it off lighttpd + > fcgi. They're working closely together with the two guys who made django, so > I wonder what they'd be telling them about "the right way". I am curious to see what Media Temple will come up with as well. Cheers. Arthur On Jun 15, 7:53 am, Christian M Hoeppner <[EMAIL PROTECTED]> wrote: > Hi there! > > This is a message for all those that have been successful in deploying django. > It is not that I find myself unable to get a django project to show up in a > web browser, but I'm wondering about "best practises", "the right way", and > all that stuff. > > It's been hard to find a hosting provider giving a django-capable hosting > solution at an affordable price, and I have found myself paying for a > dedicated just for this matter. > > I have started a quest to gather all relevant information about django > deployment, since I have found many lagoons in what I have found, including > the django book's chapter "deploying django". They're talking about server > farms and load balancing, but not a single side note is thrown about what > some not-so-guru-like person might be wondering about when first deploying a > django app. > > I can understand that you might think that apache and postgresql matters are > out of scope. Maybe. But I don't think so. For the sake of completeness and > comprehensiveness, I'll be seeking and throwing together whatever I might > find usefull for all those django-noobs out there. > > Anyone up to help gathering? I might need some help :-) > > Sincerely, > Chris Hoeppnerwww.pixware.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
newforms: clean way to customize a widget's label?
Hi Folks. I've looked through the docs (which are pretty godd by the way) and the source code, but it look as it's not easy to customize the tag that goes along with a widget. When instantiating a widget I can pass the attrs dict and those properties will be rendered as html attributes. But the label parameter takes only a string, and I would love to specify what (css) classes get rendered through that label, something like: my_field.widget= (label : {"name": "Your name", "class": "quiet small"}, widget=...) so that {{field.label}} would render: http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newforms: clean way to customize a widget's label?
Hi Leif. Thanks for the pointer. This certainly looks userful, but if I understand this right it makes easier to link to external js and css, not customize the output of the tag. Cheers Arthur On Jul 9, 10:06 pm, leifbyron <[EMAIL PROTECTED]> wrote: > Arthur, > > You'll probably find this of interest: > > http://groups.google.com/group/django-developers/browse_thread/thread... > > Cheers, > Leif --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
newforms: bound forms and prefix parameters
Hi Folks, While implementing a form with edit inline like functionality, I've hit a wall. In order to tell apart each inline model, I am using the "prefix" parameter to instantiate the form. It works, but if it's a bound form (whether from instance or getting values from a dict), if I pass it a prefix, the rendered form shows empty values. This is easy to test: def test_prefix(request): f = forms.form_for_instance(request.user)(prefix="user_1") return render_to_response("test.html", {"f":f}) but if I omit the prefix such as in f = forms.form_for_instance(request.user)() the form renders correctly. (the html inputs show the right value) Is there a catch here? I am sure this works, since the newforms-admin must be using prefix to avoid name clashes when retrieving data from the form. Thanks, Arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using Django to generate Flash/Flex content
Hi Sam. As someone who codes Actionscript for a living, I can understand where you are coming from. > > That is the point, when HTML is the lowest common denominator, a web > application is limited. HTML is evolving at a snail's pace, whereas > Flash has steadily evolved into something far more sophisticated than > HTML. HTML has it's place, of course. Depends of what you mean by "more sophisticated". Flash content can't be indexed by search engines for example. How many websites do you think can afford to be excluded from search engines? Flash content requires more processing, besides a proprietary plugin. This means that for example, people on a 64 bit linux can't read flash content. iPhone can't either. As the number of people accessing the web through different devices grow this will be more and more of an issue . (don't even get me started on flash lite) Flash content can't be cut and paste normally (browser menus or browser shortcuts). Flash content, out of the box, will break the browser's back button. Flash content, out of the box, will not allow deep linking. If you take these into consideration you'll see that one of this issues excludes flash from a lot of projects. When you add them up, you realize that very, very few sites can rely heavily on flash at all. Flash is great for "entertainment sites", or "advertainment". Site where the wow factor is more important than actual content. Otherwise flash is great as small pieces: a video player (youtube), a photo slideshow (flickr)... etc. Relying in flash to deliver "hard" content (text, navigation... etc) immediately excluded your content from a lot of technologies and a lot of users. > > But Flash now has a free command line compiler, so it is easy to > manufacture SWF's from scratch in a Python program. A " free command line compiler" means free as in beer, it still is proprietary. If adobe decides to change it's mind on the next release, or change licensing, it can. The mxmcl compiler, for example, loads the jvm every-time. This means that if you wish to compile swf files dynamically you'll be dealing with a couple of seconds of wait, plus a large memory overhead for each request. Also, note that your post is too vague. Django "generating flash content" can mean, among other things: a) django generates dynamic data, such as the description for a slideshow. this can be done in xml or JSON, which django has excellent support for, and it's very straight forward to extend for you specific use (I've done quite a few of those) b) django serializing data with AMF. For this check: http://djangoamf.sourceforge.jp/index.php?DjangoAMF_en and http://cheeseshop.python.org/pypi/flashticle c) django acting as Flash Comm. This involves reverse engeniering protocols, flv compression and more. (I'd love to use one of these though, specially live video enconding) d) django acting as a xml socket server, such as unit (from moock) The point is, flash has a lot of limitations. Papervision is cool, but it's not meant at all to replace html. Their weblog for example is html , and so is the mailing list. Before people realize javascript could make web apps much more dynamic, flash seemed like the only option for making apps more responsive. Today, ajax has killed a lot of reasons to use flash (page reloading, progress indicator etc). Besides for specific use of rich media (again video, audio.. etc) and visual effects (papervision and genereal BitmapData voodo) there's no reason to use flash, and most hackers doing dynamic websites don't need those things at all. Also notice than having django acting as a magic backend solution for issues b), c) and d) is kind of moot. The largest, by far , effort would be to reverse engineer and implement protocols, codecs and file formats . Once that was accomplished, having django views hook those up would be trivial. I've done a few all flash websites with django in the back end. I'm pretty happy using JSON to send data in and out (I hope to try amf soon). I did wish there was something like Flash Communication Server open source and written in python but I am not holding my breath for it. If you think most data send to flash can easily be xml, JSON on html (variables to the embed tag) django is well suited for feeding flash content. Cheers Arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using Django to generate Flash/Flex content
I'll second Patrick's opinion. It's an interesting idea, but I doubt it will be practical at all to put together classes at the backend and make that into an application somehow. You're probably better off developing modules, precompiled swf with functionality and a shell loading what modules you will have on a given app. That information , plus data for these modules can easily be generated from django as xml, json even amf. I do think, however of two, kind of far fetched cases for dynamic compiling: a) Generating flex swfs by a gui editor at the browser, effectivily recreating some of FlexBuilder's functionality. You could develop a Drag and Drop GUI editor that uses django to output the mxml an have that fed to the compiler to generate a swf file. b) Having assets embedded into a swf, to make it easier to deal with preloading and reduce latency for a large number of small files Regarding swf dynamic generation the Mtasc compiler that Patrick mentioned is great. Also for AS2 there's swf mill that could create a library of swf files from an xml. Also, Adobe has an Apache module for the compiler: http://labs.adobe.com/wiki/index.php/Flex_Module_for_Apache_and_IIS I have no idea how stable or buggy that is, but it might be interesting. Cheers Arthur On Aug 15, 8:00 am, Patrick Lauber <[EMAIL PROTECTED]> wrote: > I work as a Flash Developer and Django Programmer. > > You don't and you shouldn't compile flash on a request basis. > You should make your flash app smart enough that you can give it some > parameters or let it talk with the backend with something like django- > amf. > Then it can load images, mp3 etc. or display something. With flex you > can do some nice data bindings with django-amf. > > Just for reference there is a command-line compiler for AS2 too: > called mtasc and is used by the very nice eclipse plugin "fdt" by > powerflasher.de > > cheers > > On 15.08.2007, at 08:56, SamFeltus wrote: > > > > > > > I was thinking of A - D, for Django serving information for Flash > > also. > > > But mainly I was thinking of... > > > E. Compiling Flash content ahead of time with a Python web framework. > > Basically, creating a browser based environment to create content > > (supplementing, not replacing the Flash/Flex/etc tools). The tool has > > a library of ActionScript classes, SWFs from other sources, images, > > flvs, mp3, etc to compile into a SWF before the user requests it. > > Basically, you create a swf in the browser, edit and recompile it in > > the browser until it is done, then publish to the site. Django > > generates ActionScript instead of HTML/JS etc. It seems to work > > pretty easily. > > > F. A live section that has a library of content, including SWF, > > database info, images, video, audio that is designed to load a master > > swf created in E. > > > As to Flash being more sophisticated, I mean HTML is only good at > > textual information. I was thinking content that expands human > > expression beyond the HTML web, overlays and augments it, not replaces > > it. It seems to me we are at the beginning of an explosion of non > > text content on the web. > > > Here are some crude examples of experimental content created by > > TurboGears and Django in the browser (with GIMP, Photoshop, MXMLC and > > a text editor). The code has issues of course, I am a gardener > > Googling Python and ActionScript 3 as I go along. :) > > >http://samfeltus.com/site_index.html > > > PS I appreciate everyone's input. > > Divio GmbH > Patrick Lauber > Rich Media Architect > Bachstrasse 15 > CH-8038 Zürich > > Fon +41 44 480 12 40 > Fax +41 44 480 12 71 > Mobile +41 76 390 22 23 > > Mail[EMAIL PROTECTED] > Webhttp://www.divio.ch --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Unicode question
Hi Rob. After the unicode branch merge django expects and produces unicodes objects throughout. A detail how to port guide is here: http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist In this specific case, you can call "lower" directly on your unicode object: "cur_month.lower()" instead of "str.lower(cur_month)" Cheers Arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Can someone explain custom managers to me? (model methods vs. custom mgr. methods)
It took me a while to understand manager better a little bit too. Managers are pretty useful when you have a specific query / queryset that will be common case, and it's more convenient to place that query on one place and avoid repeating yourself. For example, suppose you have a blogging app with a entry model. That model has a boolean fiel, "public". You want to allow only public entries to be viewed throughout the site. Instead of filtering for public entries in a lot of places (views, feeds, sitemaps ): entries = Entry.objects.filter(public=True) It's just easier, and less error prone to say something like: class EntryManager(Manager): def public(self): return self.filter(public=True) Then, through the code you can just call: entries = Entry.objects,public() This is a simple case, but as your query gets more complex, the better off you are. Another case worth looking into, is custom sql. Sometimes django' ORM is unable to make some queries (or they will be clumsy / have poor performance) so you need to resort to hand written sql. Having that code sit in one place only makes it more reusable (and easier to guard against to sql injections, for example). Django-tagging app has some well though uses of manager: http://django-tagging.googlecode.com/svn/trunk/tagging/managers.py Cheers, Arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: list_filter not working properly?
yes, same thing here. strangely enough, I have a model with a foreign key acting as a list_fillter and it's fine. another model (same app) list filters wont't work (foreign key or not) . this was working a little while ago. still looking into 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: syncdb
yes, syncdb is for current trunk (post magic removal). please notice that if you're using 0.91, you can use the old documentation from here: http://www.djangoproject.com/documentation/0_91/ but if you're just getting started updating to the dev version is your best bet. cheers arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: save() called 2 times.
yes this is a known bug. see ticket 639 http://code.djangoproject.com/ticket/639 currently I'm using an ugly work around such as def save(self): if self.imagefield : #do whetever, files does exist... also this seems to cause problems withe DateFields with auto_now... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: OpenID
Hi Alan. have you tried this one ? http://code.djangoproject.com/wiki/CookBookShortcutsOpenIDAuthentication (it's about a month old, but I haven't used it my self) cheers, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
admin not *seeing* installed app
Hi folks. I've just ran into a small glitch when moving an app to a new server. My application is "missing" from the admin main view. Everything is installed correctly. I can mange.py shell and work on my models and my data interactively (I've moved the db as well). the application's models do have the class Admin: (on the old server these wore working fine). The main admin page lists the Auth and the Site apps. I can change/add/delete users and permissions. On the permissions side of things, the permissions to my app show up fine (and are set right). If I type the url that *should* work, such as /admin/myapp/mymodel/ I get an error page saying that mymodel was not found on app *myapp*. It's as if the django project was *seeing* the app but not the admin. (all my models have an inner class Admin, this was working before the server move). Any ideas about what could be causing this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: admin not *seeing* installed app
Hi Doulgas. It's not db related. Somehow my fcgi script was setting the DJANGO_SETTINGS... env variable on the wrong path. Thanks a lot anyways, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
memory error on lighttp deployment (file upload)
I have an app deployed on lighttpd, but I am getting this memory error. My local codebase runs fine (both on the devserver and on my local lighttpd),which leads me to think it's a server issue. I am hosted on textdrive - we're running lighttp + fcgi. This only happens when uploading large files (+1 MB) on the admin interface. This is my python stack trace: Switch back to interactive view Traceback (most recent call last): File "/home/stimuli/local/django_src/django/core/handlers/base.py" in get_response 74. response = callback(request, *callback_args, **callback_kwargs) File "/home/stimuli/local/django_src/django/contrib/admin/views/decorators.py" in _checklogin 54. return view_func(request, *args, **kwargs) File "/home/stimuli/local/django_src/django/views/decorators/cache.py" in _wrapped_view_func 40. response = view_func(request, *args, **kwargs) File "/home/stimuli/local/django_src/django/contrib/admin/views/main.py" in add_stage 253. errors = manipulator.get_validation_errors(new_data) File "/home/stimuli/local/django_src/django/forms/__init__.py" in get_validation_errors 58. errors.update(field.get_validation_errors(new_data)) File "/home/stimuli/local/django_src/django/forms/__init__.py" in get_validation_errors 351. self.run_validator(new_data, validator) File "/home/stimuli/local/django_src/django/forms/__init__.py" in run_validator 337. if self.is_required or new_data.get(self.field_name, False) or hasattr(validator, 'always_test'): File "/home/stimuli/local/django_src/django/utils/datastructures.py" in get 137. val = self[key] File "/home/stimuli/local/django_src/django/utils/datastructures.py" in __getitem__ 114. raise MultiValueDictKeyError, "Key %r not found in %r" % (key, self) File "/home/stimuli/local/django_src/django/utils/datastructures.py" in __repr__ 104. return "" % dict.__repr__(self) MemoryError at /admin/site_updater/demoreel/add/ and the lighttp error log entry: 2006-05-12 16:04:17: (mod_fastcgi.c.2851) backend died, we disable it for a 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 any input on this would be very welcome. thanks, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Problems with ForeignKey in magic-removal
Hi beewee, __repr__ has been replaced by __str__ . this is more of a return to python conventions than anything. try changing your __repr__ methods to __str__ ones. more on this here: http://groups.google.com/group/django-users/browse_frm/thread/9f6f205e0f9cbc8e/800b8c3367f79b38?q=__str__&rnum=1#800b8c3367f79b38 cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Tagging app
Hi Luke, Please do so. Tagging is, buzzword or not, pretty useful and many people have / will implement it on their own (I was mid way through just now). It would be great to leverage on your code, and I think it would benefit django users in general, as it could make more applications pluggable / easily distributable with tagging working. thanks, arthur ps: how is the GenericForeignKey going to work? will it be imported from the tagging app's package, or will it go into trunk? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Save method called twice on override?
Hi Alloy. Yes, it's a bug. more details here: http://code.djangoproject.com/ticket/639 basically you have to check for self.imatge != '' before doing anything with the file. cheers, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Weird behaviour
Hi Elver. This is a feature. This behaviour depends on wheter you want yor sessions to expire and when. More details in the docs: http://www.djangoproject.com/documentation/sessions/#browser-length-sessions-vs-persistent-sessions arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: one to one relationship and file upload issue
Hi james, regarding: > when I upload a file (a 10+MB mp3) on my local machine, it > takes quite a while and pegs the CPU. Is this expected and is this > going to be the behavior when I put it in production under fastcgi? django keeps the whole upload in memory. this has been discussed a few times ( [1] ,[2] ). patch 1484 ( [3] )may help you, with one caveat: doesn't work for admin. cheers [1] http://groups.google.com/group/django-developers/browse_frm/thread/6395fb49e432127e/07c65899ccb6f3f5#07c65899ccb6f3f5 [2] http://groups.google.com/group/django-users/browse_frm/thread/3fde60de4313478a/9efce043d4e8ffa9#9efce043d4e8ffa9 [3] http://code.djangoproject.com/ticket/1484 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: one to one relationship and file upload issue
Could this be it http://code.djangoproject.com/ticket/572 or http://code.djangoproject.com/ticket/1584 ? me thinks this was fixed recently. => http://code.djangoproject.com/changeset/3002 are you running an up to date svn version? see if that helps --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Creating a root object for a many-to-one relationship
won't this work for you: class Node(Model): parent = ForeignKey('self', blank=True, null=True) ... rest of your model... then fetch it like Node.objects.filter(parent__isnull=True) if you are worried with the possibility of ending up with mode that one root node you could do either (both seem a little hackish though): a) have a is_root field on your model (still possible to have more than one though) b) implement a check on the model's save such as: def save(self): if len(Node.objects.filter(parent__isnull=True)) >0: #node already exists => return or raise raise "bad, root node already exists" super(Node, self).save() (or maybe implement a custom manager for this?) arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Relations accros multiple apps
Hi Fabien. > App User: > class User: > #some fields > > App Blog > class Blog: > author = models.ForeignKey(User.user) > > Is-it possible to do that ? Sure. Models are regular python classes, all you must do is to import it's module before using it. Like: from django.contrib.auth.models import User (now you can use the User model on you bloggin app) If you want to import the Blog model from another app ,you can do the same: form myproject.blog.models import Blog # here myproject is the name where the blog app sits. One caveat though. If you are importing the user model, you can be sure that i will be on every django install and you already know the path to it. If you plan to "plug" you blog app into other projects, you have no way to know where on the path it will be (for example it could be on fabienapps.blog or myclient.blog). in this case you can find out where the app lives : from django.db.models.loading import get_app blog = get_app('blog') from blog.models import Blog cheers arthur > -- > Fabien SCHWOB > _ > Derrière chaque bogue, il y a un développeur, un homme qui s'est trompé. > (Bon, OK, parfois ils s'y mettent à plusieurs). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
GenericForeignKey in admin
I've been playig with GenericForeignKey and they are great. One question though, they do not show up on the admin app. For example on the object that should be 'tagged', I would like to edit tags inline. Is thart possible at all? thanks, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Photo gallery
Hi Guillermo. I haven't looked at those galleries but if you are going to code some of it, take a look at nesh's ImageWithThumbnail[1] field and related utilities. You might reduce the ammount of biolerplate code greatly. cheers arthur [1] http://djangoutils.python-hosting.com/wiki/Thumbnails --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Can a custom field have two database columns?
In a current project, I've got a lot of fields that must accept markup. Currently I am using markdown to parse the raw text. I am aware of the useful template tags to apply markdown on the template itself, but since reads are much more common than writes I would like to store the markup on the database, to improve performance. My current solution is something like class Article(Model): raw_text = TextField(maxlength=2000) markup_text = TextField(maxlength=2000, editable=False) def save(self): self.markup_text = mardown(self.raw_text) super(Article, self).save() Which works, but does not feel very DRYish, since this code is spread all over the place . I would like to create a MarkupField using it like: def my_func(text): return markdown.markdown(text) class Article(Model): body = MarkupField(, converter=my_func) # where converter would be a fucntion such as markdown or te=xtile or rest... or any other and the MarkupField would do the conversion before saving to the database, on another column in the database to store the markup text. Then when accessed from templates I could say {{article.body_markup}} and that's it. So I guess my question boils down to this: - can a custom field have 2 database columns (one for raw text, and another for the markup text)? Is this possible at all? Any pointers will be very much appreciated. Thanks, Arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Can a custom field have two database columns?
HI Ian. Thanks for the pointer. It's an interesting approach though, if I did understand it, that requeries the "raw" markup source's name to be hardcoded into the middleware, right (e.g. 'description')? If so, I am back to square one, for among all models I have quite a few that must be parsed and their names would vary (and again, on a next app, would have to changes names again...) thanks, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Model vanishes from Admin
Hi Steven. this one got me stuck for hours (grin). if your INSTALLED_APPS is right and your admin inner class too, you probably have an error on an import on your model class. fire up the shell on your server setup. can you import your model module? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Model vanishes from Admin
Hi Russel. Thanks for the patch. I am sure this one will save newbies a few hours of starting blankly at the screen. cheers Arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Sniffing around django
In your model, overide the save method : def save(self): # get number of objects maxNumber = 5 current = MyModel.objects.all().count() if current < maxNumber: super(MyModel, self).save() #you can either pass - object won't be saved, or raise an exception cheers, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django t-shirts: your ideas wanted!
"A Django Model" ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: video upload
Yes, you will probably run into memory issues for larger uploads if you are on a shared host. There is,however, ticket's 2070 patch that adrresses that issue. http://code.djangoproject.com/ticket/2070 arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: ForeignKey and Admin
What you are looking for is the edit_inline option for the event field: class EventDate(models.Model): ... event = models.ForeignKey(Event, edit_inline=True) more info here: http://www.djangoproject.com/documentation/tutorial2/#adding-related-objects [] arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: file upload with flash 8 uploader
On macrodobe's site, there's a reference implementation of php receiveing the flash upload. it's php, but you can have an idea of where things are on the request: http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=1591.html The flash upload capabilitie is pretty nifty... I wonder if there's any interest of creating a FileField(flash_uplload=True) option and have it and django as an alternative. spako: currently uploads are kept in memory, not streamed. that means if you are expecting large uploads (+2MB) and are on a shared server, you might have issues (since most of them hava a memory limit your processes can use). patch 2070 is suppouse to work around this, but I couldn't get it working here. cheers arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Specify order of content items
Hi drakepad. I am not aware of a good way to implement this, but this is how I have been doing it...If you must have an arbitrary order (not by date or alphabetical) you must create a field specifically to store your desired order. class MyModel(Model): ... regular fields go here... position = IntegerField() class Meta: ordering = 'position' this way your models will be ordered according to the value you supply on the 'position' field. The one caveat is that since it's inside the model, if you need to , for example swap to items position you will have to edit both model instances and change their field accordingly. I hope to implement some drag and drop for this in the admin...but this is trickier than it seems...and it might be a while unitll I get the chance. If you do the 'position' field trick, any query set will order by it... and at any point you can change the ordering (in your views): new_order = MyModel.objects.all().order_by('some_field') cheers, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: book recommendations?
also, simon willison's javascript introduction is excellent: http://flickr.com/photos/simon/sets/72057594077197868/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Views and 404 - render_to_response
Hi Bob. If you're getting 404's, then it's not in import problem on your view. >From your code this line grabbed my attention: p = get_object_or_404(Myclass, pk=slug) if your are searching against the pk, this will only get any results if the slug is the pk for your model (that will only happen if you've overriden django's pk) if your model has a field called 'slug' you must match it against that: p = get_object_or_404(Myclass, slug=slug) hope that helps arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Views and 404 - render_to_response
Bob wrote: > What would it be if I want to get my item from the database by the slug? this depends on the moel's ttribute name (the one that's a slug). If you can post you model's code, I can assiste further... cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Perspective on building a community blog in a short timeframe
Hi Joe. Also if you don't fell like reinventing the wheel, you might want to take a look at limodou's multi-user blog app written in django. It's been a while since I haven't played with it, but it's probably worth a look. More info here: http://groups.google.com/group/django-users/browse_frm/thread/cc39700cc7147ed9/0675e2d713071f39?q=limodou&rnum=3#0675e2d713071f39 cheers Arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Displaying thumbnails in the admin interface
You should also take a look at nesh's excellent ImageWIthThumbnailField: http://djangoutils.python-hosting.com/wiki/Thumbnails cheers arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: drag & drop for admin-interface
Hi Patrick. I've been planing to implement this, but haven't found the time to. I know code speaks louder than words... but I've done some thought over this and would like to share my opinions. > 1. right now, you can drag & drop table rows within the change-list. > NOT every action is stored immediately (to the database) - instead you > ´re having two buttons (SAVE/CANCEL) at the bottom of the page. after > you´re finished with dragging stuff around you may click SAVE - then, > the page reloads ... > question: would you prefer instant saving? live saving would be nice, but it opens up a few problems. I think having a 'batch' save will avoid many headaches. > > 2. the table-column which is affected is currently named "position" - > any other suggestions? > hm.. I am -1 on this one. Ideally you would be able to specify in your model if you want it to be draggable and with which field. let's say you've got these models class SlideShow(Model): title = CharField(maxlength=60) class Slide(Model): slideshow = ForeignKey(SlideShow) image = ImageField(upload_to='some_dir') order = IntegerField() class Admin: draggable_by = 'order' It would probably be cleaner to set this in the Admin inner class. It would make it easer to integrate legacy dbs and also avoid name clashes. Also this would make it explicit, which is good. > 3. within the change-list, you´re probably having filters and other > stuff which is not necessary for DnD-action. would you prefer a > button "REORDER" at the top of the page (e.g. within the object- > tools) which links to another page specifically designed for DnD- > stuff. if so, any ideas on how to get that button for certain tables > (because not every table needs reordering)? e.g. with extending class > admin? > I'm not in favor of having another page for this. Too cumbersome. Maybe if the model specifies it allows dragging you could on top (or bottom) of the change-list table have a text that says "Drag rows to reorder". Once you have a successful drop you could hide that text(with js) and change it to your buttons "SAVE ORDER" "REVERT ORDERING"(or something like that). > 4. do you prefer dragging the whole table-row or do you prefer having > a button for dragging (e.g. within the last column on the right hand > side)? I am +1 on the whole row. > > any other suggestions/feedback? > ### after the first drag, you are not able to click the link for the > detail-page anymore. I´m not sure if this is a bug or if it´s > intended. either way, also not good. having that in mind, it´d > probably be better to have a different page for reordering (see above). > How are you handling events? Maybe if you use event bubbling you can check if the click came from the details link and suppress dragging in that case? Thanks for getting this rolling... cheers arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
trouble getting make-messages.py to generate .po files
Hi Folks. I am trying to set up my first django i18n site, and when running make-messages.py on the command line I get the following error: 'errors happened while running xgettext on __init__.py language `Python' unknown' any ideas? thanks, arthur p.s.: I am running make-messages on my project directory I have gettext/xgettex installed I have no code in none of my __init__.py files : they are empty. I am running from svn (pre 0.96) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: trouble getting make-messages.py to generate .po files
Ok, got this one figured out, posting here if someone hits the same wall. The pre-installed gettext on the mac is version .10 something. gettext support for python is >.12 so you must install a newer version. installed it from darwin ports and it worked like a charm. cheers arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Calling a view from another view in the same app?
Hi facundo. this is an issue in python that is pretty confusing for newbies. What's happening here is that viajes is making a forward reference to viaje, meaning that when viajes is run viaje has not been defined yet, so it throws an exception(methods get parsed top to bottom in modules). The fix for this is to put the 'viajes' method after 'viaje' on your file. cheers arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
FileField :: mx file size
Hi there In an app we are coding, we are allowing users to upload image files - in django's admin nonetheless. we want to set a max file size (e.g. 400 kb) so we can keep our servers happy (those file will be processed by PIL). The idea is to avoid an uneducated user uploading his 10 mb digital camera files and giving the server a hard time. My question is, where would be the best place to check for the file size? Looking at this some what related thread, it seems that _pre_save() should do it: http://groups.google.com/group/django-users/browse_thread/thread/85715b106146ebc0/c852373a4d774984?q=filefield++&rnum=5#c852373a4d774984 if I do it in _pre_save() will this only get called AFTER the file has been uploaded? if so, is there a way to check for this BEFORE the file is uploaded? are more people interested / needing this? would it make any sense to add an optional maxsize parameter to the FileField object? thanks lot, arthur
Re: imagefield, admin, wrong link
Hi Gabor, I am dealing with the same issue here, and I've opened a ticked for this : http://code.djangoproject.com/ticket/1315 It seems that on the admin's template ('file.html'), filefields are susbtituted to "bound_field.original_url" which evaluates to blank even if you use the "bound_field.original_value" it's still doens't work... somehow the admin is appending the url to the model's edit view... I am pretty clueless to what can this be...
OneToOneField extending User: is this the best way?
Hi folks. I realize this is a recurring question on this list but I have not found an authoritative answer, maybe some one can show me the best path to take. I want to add new fields to a User class. should I: 1) extend from auth.User as described in the wiki. This seems nice, but I feel like fiddling too much into django internals doing it. Should I be afraid? 2) with a one to one relationship. This seems less threatening but, while trying to implement this, I don't know: a) how do I specify, in the admin, that users should be edited inline, is this possible at all? b)how to access user fields from the container class's admin, such as this: class UserContainer(meta.Model): #our contained user user = meta.OneToOneField(User) # add any additional info here user_is_mad = meta.BooleanField() class META: admin = meta.Admin( # HERE: how do I access user's first_name? list_display = ("user.first_name", "user_is_mad"), ) I am sorry if there are typos on this code, I am just trying to provide am example... Any thoughts on this? Thanks a lot, arthur p.s.: I guess after the new admin branch is merged it will be trivial to subclass user but I have an app to deliver sooner than that so...
multiple ManyToMany mess
Hi there. I am having trouble with two many to many fields on the same model. I've looked around and found this very similar to ticket 327 ( http://code.djangoproject.com/ticket/327 ) my models follow: class Project(meta.Model): name = name = meta.CharField(maxlength=100) ... class Account(meta.Model): authuser = meta.OneToOneField(users.User, edit_inline=meta.STACKED, core=True) owner = meta.ManyToManyField(Project, null=True, singular = "owned", related_name="owns") member = meta.ManyToManyField(Project, null=True, singular = "memberof", related_name="belongs" ) OK. I can fecht what projects are owned by an accout, then I can add an newly created Project instance (and properly saved with an id # - checked!). But when I fetch the get_owner_list() later... it's not there. after the second run the code runs on the same account I get an IntegrityError, with duplicates key. Looking at my mql database... the table that's relating accounts and projects (accounts_owned) is storing a project id of 0, but checking both at my python code and at the db the project id is right (it's aklready saved). Am I missing something obvious? Does the fact the the same model has an OneToOneField makes a difference? If it matters... I am running svn with mysqsl 4.1 on os x, python 2.4 Thanks a lot. Arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Extreme file uploading
Hi Andy. Regarding memory usage on the server, AFAIK this is something related to cgi.FieldStorage. more about this here: http://groups.google.com/group/django-developers/browse_frm/thread/2c379ec0fa30804a/# It would be great to have a streaming option, but aparentely this is trickier than it seems. I guess there's quite a few people with this kind on need hanging around this list... so maybe a solution can be implemented. I am not uploading anything near 200MB, but 8 MB with no progress feeback and no resume is pretty scary for me. Maybe at 200 MB you should try ftping it? Off topic, has anyone seen dropsend (http://dropsend.com/)? they've managed to get a reliable progress bar... cheers, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Assigning default value for field in admin
If I read you right: http://www.djangoproject.com/documentation/faq/#how-do-i-automatically-set-a-field-s-value-to-the-user-who-last-edited-the-object-in-the-admin I've solved almost this problem in an app, but that's because I would get the user from the session cookie and put it on the request for the form to be "auto-filled". It seems there's no out of the box way to achieve this. -arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
magic removal : problem when subclassing User
I am subclassing User in magic-removal, and ran into this gotcha. My model: class Account(User): tel = models.CharField(maxlength = 14, blank=True) book = models.ManyToManyField(Book, blank=True) in a view I when I try this: acc = Account.objects.get(username=test_username) print "returning type = %s " % type(acc) it does find the right record, but returns an User instance. it prints: returning type = JohnDoe >From there, if I try to use it as an Account instance (such as "acc.tel") python raises an execption. Can any one point me in the right direction? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
ContentType in magic removal :: how to?
Hi. I am trying to get a model's content type in magic-removal. I have a model's instance when I try : ContentTypeManager().get_for_model(instance) I get : AttributeError: 'NoneType' object has no attribute 'DoesNotExist' I got it working with: def get_content_type(model): opts = model._meta app_label = opts.app_label model_name= opts.module_name ct = ContentType.objects.get(app_label=app_label, model= model_name) return ct (which works both on instances or classes, which seems right) sorry if this is too basic. ;-( , am I missing the obvious? wouldn't a get_content_type() static method make sense for all model classes? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: ContentType in magic removal :: how to?
thanks a lot Jacob, I WAS missing the obvious. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Stupid newbie question about documentation
Hi Todd. I guess what you are looking for is: u = User.objects.get(username='namehere') but you could also: 1) fire the shell (cd to your project dir) then: python manage.py shell from django.contrib.auth.models import User dir(User) or dir(User,objetcts.all()[0]) 2) on the admin site, on the top bar there's a "Documentation" link (mut have docutils installed ) this is very usefull for newbies, I use it all the time. As a side bonus you get to see ForeignKey and ManyToMany methods also. 3) checkout the source itself, since you are using this sintax you're probably using magic-removal, then you can see the python module in : django/contrib/auth/models.py arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
mr: DateField and "global name 'date_query' is not defined" error
I stumbled upon this error message after porting a project to magic-removal. In the admin, if I try to get the list view for something like: class SomeModel(models.Model): title = models.CharField(maxlength=200) date_due = models.DateField(blank= True, null=True) class Admin: date_hierarchy ='date_due' I get this confusing error: "Exception Value: global name 'date_query' is not defined Exception Location: magic-removal/django/db/models/query.py in iterator, line 479" it took me sometime to realize that you can't have 'date_hierarchy' on a datefield that can be blank. anyways, I though I'd post it here in case someone struggles over this too. ps: on trunk I get no error. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: extend User in m-r
hi michael. inheritance is not working yet in magic-removal. the confusing thing about it is you can create the class and the table does get created, but when you access the same class later in your python code, it will be treated as the super class (User in your case). Extending User is a very common request and (me thinks) your best bet is to use a OneToOneField (not ForeignKey). arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: using django.core.mail with utf-8
right now this is not possible. there is, however, a patch in the ticket system #1541 ( http://code.djangoproject.com/ticket/1541 ) that will do it... ) sample usage on the ticket... cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Using _pre_delete() to stop execution
Hi Norbert, this is not possible on trunk , if you are using magic-removal, you can do it like this: def delete(self): if conditionIsMet == True: super(ModelName, self).delete() # Call the "real" delete() method. else: # Don't delete. pass more on this here: http://code.djangoproject.com/wiki/RemovingTheMagic#Addedamorepowerfulwayofoverridingmodelmethodsremovedhardcoded_pre_save_post_saveetc. cheers arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Using _pre_delete() to stop execution
Hi Glenn. the thing is, if there's anything in django's knowledge to avoid the save / delete it DOES raise an error. (such as trying to delete an non existant object or trying to save a model that does not pass validation). my guess here is if you need anything else in you logic that django doesn't know about (from validators and the db) you must implement it yourself. # try: amodel.delete() except: return HttpResponseRedirect("bad_detele_action") or something to that effect. maybe the so called validation aware models in m-r will do it? http://groups.google.com/group/django-developers/browse_frm/thread/4bc65cf676c93846/5d7db0f7a5f85006?q=validation+aware&rnum=2#5d7db0f7a5f85006 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Ecommerce & Django
hi folks... am I all for it. I've got no experience on e-commerce but there's a few things (I guess) I may help with... I guess this would be agreat project... I just suppose some "liberal licensing" would be nice (such as BSD or the like)... cheers arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
[offtopic] question on django naming choices for models relationships
Ok. This one is more of a "philosophy" question on django naming from someone who's learning django, webdev and databases at the same time. If I understand right, one of django's aim at the ORM level is to abstract the sql level, including naming. This makes a lot of sense, and when you see : ManyToMany OneToOne you can see that the name of these relationships between models is very descriptive and non-sqlish. they describe the nature of the relationship desregarding the underlying implementation (which feels right). Now, for the many-to-one relations the name chosen was ForeignKey why is that? Isn't ForeignKey very sqlish and little descriptive? Doesn't it points too much on the implementation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Ecommerce & Django
"Setup a free python project on python-hosting.com" +1 on this one. when getting started we better focus on the coding right away, and python hosting's capabilities (svn + trac ) setup with no fuss will be very helpfull (it seems). " Any brilliant ideas?" not really... djell, djuy , djart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Importing external modules/classes
Hi Cary. that depends if you're using magic-removal or trunk. On the m-r branch there are no "magic" modules, whatever is on your path can be imported as usual. if you're using trunk, you must import inside your models methods, or user module_constants ( http://www.djangoproject.com/documentation/model_api/#meta-options ) see also this thread: http://groups.google.com/group/django-users/browse_frm/thread/c3c4a1ff076ae357/a6a38c1e23f52ff6?q=imports+magic&rnum=1#a6a38c1e23f52ff6 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Ecommerce & Django
another thing that would be nice is a "downloadable type" of product where the order relates to a download. of course, this could get pretty complex if you add in things like serial numbers, versions, etc...but we can start simple.I (personally) would like this, and I guess quite a few of the early adopetrs migh want to sell software / digital goods (I don't know, maybe their wife are selling e-books or something) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: Ecommerce & Django
I like th idea of usign jazz musicians' names: "monk"! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Re: sinjan
just a quick extra on this one. The documentation on the admin site (link at top right, must have doc utils installed for this to work) is also available on the magic-removal branch and for newbies and people doing the transition from trunk t's pretty useful. cheers arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Slow initial startup on Django project
Clint, I believe this is a fcgi thing. Dreamhost kills it after a perdiod of inactivity, which means that the first request after a few minutes of stillness has to load django & everything else. Later request should respond better. There are mixed reviews on dreamhost and django on this list, quite a few topics bring this up. It seems to depend a little in which server you are (I am on pound, and haven't had any issues). But at any rate you are not going to achieve *great* performance on django. hope that helps, arthur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Slow initial startup on Django project
Oh My! my bad. yes that should read.. " are not going to achieve *great* performance on DREAMHOST." I just meant to say that dreamhost has nice price / feature ration but it's just a little unreliable to host a *critical* site on it. Isn't it great that you could just read through my mistake (and have no doubs that I was talink about dreamhost...)? cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---