Re: newforms-admin replacement for core=True in inline models?
On Feb 1, 2008 7:52 PM, NickJ <[EMAIL PROTECTED]> wrote: > > Thanks for the response. So what code do I need to add so that, when > creating a new object, the admin doesnt try to create related fields > that are left entirely blank? I still see core=True as an option, but > it no longer does anything, and I still dont understand what the > solution is or will be. > You shouldn't have to do anything. Inline-edited items that are empty should be ignored during add processing. There was a problem at one point where entirely blank items were being flagged as validation errors, but that has been fixed. I'm don't recall ever seeing problems with entirely empty items being constructed. Could you give details of your models and what behavior you are seeing (I'm not sure if you are getting validation errors for blank items or spurious all-blank items added to the database?). Maybe check trac for reports of problems like what you are seeing. I haven't been able to keep up to date for a few weeks, but had been running on newforms-admin without running into what it sounds like you are reporting, so it's either something specific to your models or perhaps something that has changed recently. 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: Heads-down transaction-processing apps on Django
>> Not quite as much flexibility here. HTML defines accelerator >> keys which are browser-specific (sometimes Alt+letter, sometimes >> control+letter, or other combos). > > This is perhaps the only disappointing news from your experiences. I've found this isn't quite so important as long as the form-flow tab-order makes sense to the DE person. >> try to use control+W to delete the previous word while I'm typing >> in IE, only to have it close my whole window. Minutes of sotto >> voce oaths usually follow. > > Ug. This would be disastrous to a clerk on a tight queue. In the very > least it looks like I may have to make Firefox a requirement as there > appear to be fewer push-here-to-explode opportunities. The best way to prevent this is to make AJAX'y submissions in the background as they work, basically writing the application interface in JavaScript. It's an ugly job to code, but it can help save page-fulls of lossage. FireFox has similar behavior with control+W, but I believe if it's something you really want to prevent, you can bind it to a NOP to prevent it from occurring. I've not gone hacking FF configs/chrome to such a degree. > Would that be ReportLab perchance? Print solutions in Python seems to be > a scarce species. I've used ReportLab with mixed success. If you know of > another one to look at I'd sure be eager. A short dig in the c.p.l archives found the link I had seen: http://wiki.wxpython.org/Printing Again, that was for printing to a printer attached to the server, rather than a printer attached to the web-client. Another option is to send the direct PCL yourself. I've hand-cranked printer drivers for a couple thermal printers (Zebra and Oneil) that had some basic page-layout functions that I could use. I just sent the printer-specific codes over the wire (IrDA, BlueTooth serial-profile, or serial-port in case) for fast and simple printing. If you just need a text dump that you can do via simple escape codes, this isn't a bad way to go. A bit of a pain to decipher printer manuals to get those codes...but feasible. At least for those two printers, the PCL is pretty straight-forward and well documented. -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: FckEditor vs TinyMCE
im use meteora http://meteora.astrata.com.mx and work excelente for my djangoadmin interface. http://meteora.astrata.com.mx/demo/editor Cull escribió: > Thanks Jay, > > That's a huge help. Do you know if there's any code for doing text > versioning? We don't need a full blow wiki or CMS, but we do want to > add some versioning for our "notes." Any leads on this? > > > > On Feb 1, 1:38 pm, Jay Klehr <[EMAIL PROTECTED]> wrote: > >> It's certainly possible to implement FCK as a JS based editor, no python >> code necessary. It'll simply act as a textarea replacement to the user, >> but will still post the source of the editor when the form is submitted. >> >> Here's the integration guide for doing it this way: >> >> http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Integration/... >> >> If you want to do it in your django code, here's the Python integration >> guide: >> >> http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Integration/... >> >> Jay >> >> Cull wrote: >> >>> We're just starting to consider text editing. >>> What is our easiest path here? TinyMce or FckEditor. The latter has >>> been our choice previously, but is there a post somewhere that >>> discusses who to do it? I haven't been about to find more than bits >>> and pieces. If not, what about Tiny? >>> >>> Tips appreciated. >>> > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
DB query filter on member relations
I have a Model with two fields, a url and a title. If no title is given, it is initialized as the url (or at least the first 200 characters of the url). Is there a way to filter a DB query to get the rows that weren't initialized with a title? Something like MyModel.objects.filter(url__contains=self.title) I know that "self." there is mumbo jumbo. Any real solutions? If no good solution, I'm left making a new table or column to record these instances, or doing a crazy search on each row. Thanks, Ivan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Newbie sqlite3 dbshell confusion
On Feb 1, 2008 10:03 AM, bobhaugen <[EMAIL PROTECTED]> wrote: > > On Jan 31, 10:38 am, Jeff Anderson <[EMAIL PROTECTED]> wrote: > > My personal recommendation is to remove 0.96 and > > use django-svn. > > Ok, I did that. Or tried to do that, anyway. > > 1. Removed 0.96.1. > 2. did: svn co http://code.djangoproject.com/svn/django/trunk/ django- > trunk > 3. did: sudo ln -s /django-trunk/django /usr/lib/python2.5/site- > packages/django > 4. did: sudo ln -s /django-trunk/django/bin/django-admin.py /usr/local/ > bin > 5. started python interpreter > 6, typed: import django > got error message: ImportError: No module named django > > I also noticed that svn put django-trunk under my home directory - > that's not where 0.96.1 was installed by the package manager. > > And the django symlinks in site-packages and /usr/local/bin say they > are broken. > > So where did I go wrong? Always use absolute paths when creating symbolic links. Sounds like it should be something similar to "sudo ln -s /home/YOUR_USER/django-trunk/django /usr/lib/python2.5/site-packages/django" for you. This should make the import wrok. Hope it helps, Eduardo. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on MacOS X Leopard
It might be wise to consider separating the Python environment from Mac's Python using MacPorts. I have a recipe for installing a Django dev environ on Intel Tiger at: http://shinmaikeru.blogspot.com/. I am relatively new to Mac and Python (and Django, of course), but this was the only way to get things working comfortably. Please consider it one more possible solution. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newforms-admin replacement for core=True in inline models?
Thanks for the response. So what code do I need to add so that, when creating a new object, the admin doesnt try to create related fields that are left entirely blank? I still see core=True as an option, but it no longer does anything, and I still dont understand what the solution is or will be. Cheers Nick Russell Keith-Magee wrote: > On Feb 2, 2008 4:32 AM, NickJ <[EMAIL PROTECTED]> wrote: > > > > I wanted to bump this up, because if there is no solution I think this > > is an issue which needs to be rectified before it is merged to trunk. > > There is a solution - it just hasn't been documented yet. > > The oldforms 'core=True' approach has been deprecated in favour of > providing a checkbox that specifies that a row needs to be deleted. > When you set up the FormSet, you can specify if rows are deletable; if > they are, you get the checkbox on each row. This can be specified on a > per-form basis, rather than messing up the model definition. > Validation of individual rows (i.e., these three fields are required > as a minimum) is handled by the forms that are wrapped into a form > set. > > If you're still seeing core=True as an option, it's because work isn't > finished yet. There are still pieces of newforms-admin that rely upon > oldforms manipulators - we haven't finished housekeeping yet. > > Yours > Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Conditional admin template inheritance
Hi again, Found the answer in the documentation (right in front of my face...) Aaron Aaron Fay wrote: > Hi List :) > > I want to be able to include some javascript on a specific automated > admin page, is there a way to just include my custom template block if > I'm editing a specific model? I really like the automated admin forms, > but it may be that I just have to sit down and write custom templates... > > Thanks for your insight, > Aaron > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Heads-down transaction-processing apps on Django
Tim Chase wrote: Tim, thanks for taking time to respond in so much depth. You've given me enough encouragement to think we can move forward. I'm *really* tired of thick-client GUI development. >> - Data entry people use lots of F-keys, Ctrl-keys and Alt-keys to make >> things happen on the screen. > > Not quite as much flexibility here. HTML defines accelerator > keys which are browser-specific (sometimes Alt+letter, sometimes > control+letter, or other combos). This is perhaps the only disappointing news from your experiences. > As a vi/vim user, my fingers occasionally > try to use control+W to delete the previous word while I'm typing > in IE, only to have it close my whole window. Minutes of sotto > voce oaths usually follow. Ug. This would be disastrous to a clerk on a tight queue. In the very least it looks like I may have to make Firefox a requirement as there appear to be fewer push-here-to-explode opportunities. >> - Printouts need precise on-paper placement and instant delivery (no >> pop-ups to select printer or preview). > > printing from the web is a peculiar issue. If you're printing to > a local printer (attached/accessible to the browsing machine), > you pretty much always have to go through a print dialog. If the > printer is attached to the web-server, you have more control over > the immediacy of printing. You'd have to use a python printing > module (there was a recent post on comp.lang.python on this that > pointed at a popular library, though I don't have it on hand). Would that be ReportLab perchance? Print solutions in Python seems to be a scarce species. I've used ReportLab with mixed success. If you know of another one to look at I'd sure be eager. > Django+Python+JavaScript can handle most of the requirements. > Demand-printing on the web-client is the largest hurdle. And as > a web-user, I'd want it that way, as I wouldn't want arbitrary > websites to be able to send stuff to my printer unsolicited > without giving me an option to cancel. > > Hope my time in the trenches on the above gives you some pointers. Yes. Yes it does. Thanks. Michael --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: newforms-admin replacement for core=True in inline models?
On Feb 2, 2008 4:32 AM, NickJ <[EMAIL PROTECTED]> wrote: > > I wanted to bump this up, because if there is no solution I think this > is an issue which needs to be rectified before it is merged to trunk. There is a solution - it just hasn't been documented yet. The oldforms 'core=True' approach has been deprecated in favour of providing a checkbox that specifies that a row needs to be deleted. When you set up the FormSet, you can specify if rows are deletable; if they are, you get the checkbox on each row. This can be specified on a per-form basis, rather than messing up the model definition. Validation of individual rows (i.e., these three fields are required as a minimum) is handled by the forms that are wrapped into a form set. If you're still seeing core=True as an option, it's because work isn't finished yet. There are still pieces of newforms-admin that rely upon oldforms manipulators - we haven't finished housekeeping yet. Yours Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Complex relationship for user profile
Hi Peter, I did a little more digging, and I'm not sure if my answer is in option 1 or 2... I am just using the automatic admin interface for my model at this point, with Django configured to use AUTH_PROFILE_MODULE = 'myapp.myuserprofile'. Is it safe to assume either model is saved first, or is there a reference to this behavior somewhere? 2nd question: does option 1 assume that I am using a custom form/template? If 'no', is it then possible to have the UserProfile model display the Users.email within it's form? And what might that look like? I'm trying to wrap my head around this new framework...still puzzled :S Thanks again, Aaron Peter Rowell wrote: Failing a response to that one must mean I'm asking for something that is undoable. Uh, this isn't McDonald's. Slow/no response does not immediately equate to undoable. It more likely means that people who might have answered the question were doing something else (watching the debate, coding, sleeping, having a life). Regarding your question: Depending on the dynamics of your app, you might investigate the following: 1. If the profile is updated first and you want to propagate some changes to the associated User record, try overriding the save() method for UserProfile, do your thing, and then call super(UserProfile, self).save() to finish. 2. If the opposite is true (User is changed and you want to propagate to UserProfile), avoid the temptation to hack contrib/auth/models.py. Instead, use signals. See http://code.djangoproject.com/wiki/Signals. See http://www.martin-geber.com/weblog/2007/10/29/django-signals-vs-custom-save-method/ for a discussion on the difference between custom save and signals. 3. Modifying the admin can be useful, but can the data only be changed through the form? If yes, then proceed. If no, then option 1 or 2 is a better way to capture the change, regardless of the source of the change. 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 -~--~~~~--~~--~--~---
Conditional admin template inheritance
Hi List :) I want to be able to include some javascript on a specific automated admin page, is there a way to just include my custom template block if I'm editing a specific model? I really like the automated admin forms, but it may be that I just have to sit down and write custom templates... Thanks for your insight, Aaron --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Stylesheet Inheritance
Thank you both! I was using the reference in the base template, but was missing that first /. I appreciate you time. On Feb 1, 1:18 pm, Brian Rosner <[EMAIL PROTECTED]> wrote: > > I am having trouble getting my stylesheet to appear in each html > > file. I have a base template that contains the path to the css file. > > Each page that extends the base template simply adds the path of the > > css file on to its current uri to get the wrong location. Is there a > > way to specify the css file in one location and have the other > > templates find it regardless of the URI? > > It sounds like you are not using an absolute path. The way I handle a > CSS file across several pages is to have my base.html look similar to: > > > > something > > > > The first slash in /media/css/styles.css is critical since it tells the > webserver to look at the root of the domain. If left off it will become > relative to the page you are viewing. For > example:http://localhost/my_cool_urlwould then yield a lookup > forhttp://localhost/my_cool_url/media/css/styles.cssas opposed to > justhttp://localhost/media/css/styles.css. > > It is also common pratice to use MEDIA_URL to cut down on having to > always know the media path. Using it will change simple change the url > to {{ MEDIA_URL }}css/styles.css and MEDIA_URL = "/media/" in your > settings.py. Make sure you are using the RequestContext to ensure {{ > MEDIA_URL }} is displayed correctly in your templates. (This will only > work if you are using HEAD of Django trunk, otherwise you must write > your own context_processor). > > -- > Brian Rosnerhttp://oebfare.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
best solution for a tight model
hi all I have a model made up of customers, project, works and invoices (sounds familiar? :-)) every project belongs to a customer, has many works. When I want to create a new invoice I would like to select a customer and a list of works that belongs to projects done for that customer and that do not recur in other invoices... something like this Work.objects.filter( project__customer__id = pcustomer).filter( invoiced_in__isnull=True) where pcustomer is the selected customer. now my first thought was to extend a django admin template and put some JQuery magic, but I thought it is a very common problem: I have a bunch of data related from some logic and not just model constrins. any suggestions? thanks SammyRules --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Newbie trying to install django-trunk from svn on Ubuntu 7.10
On Feb 1, 3:37 pm, Brian Rosner <[EMAIL PROTECTED]> wrote: > export PATH=/path/to/django/bin:$PATH Thank you thank you! That is what I was missing. > Also, it appears you are relying on a relative path. I would highly > recommend you adjust the PYTHONPATH and how you setup the PATH to use > an absolute path. > > export PYTHONPATH=/home/user/django-trunk Will do. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Newbie trying to install django-trunk from svn on Ubuntu 7.10
> With echo @PYTHONPATH > django-trunk:django-trunk/django/bin:django-trunk/django/bin/django- > admin.py > same error message. > Ok, there is a subtle difference that you are missing. PYTHONPATH and PATH. They are two completely different environment variables. PYTHONPATH is only for Python in locating Python modules and PATH is to locate executable files in the shell. export PATH=/path/to/django/bin:$PATH Also, it appears you are relying on a relative path. I would highly recommend you adjust the PYTHONPATH and how you setup the PATH to use an absolute path. export PYTHONPATH=/home/user/django-trunk -- Brian Rosner http://oebfare.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie trying to install django-trunk from svn on Ubuntu 7.10
On Feb 1, 2:23 pm, Brian Rosner <[EMAIL PROTECTED]> wrote: > Okay, to be honest, pretend you never read that. The bottom line is > that Django only needs to be in your PYTHONPATH. By default Python > already has its site-packages directory on the PYTHONPATH which is > where this stems from. You can define the PYTHONPATH at anytime. Once > it is there it is completely installed. You will want to get the > django-admin.py file into your PATH so that you can easily access it > with referencing it on the filesystem. Thanks, Brian. I have tried several variations on PYTHONPATH. With echo @PYTHONPATH django-trunk I can import django in the Python interpreter, but django-admin.py startproject mysite gets this error message: bash: django-admin.py: command not found With echo @PYTHONPATH django-trunk:django-trunk/django/bin:django-trunk/django/bin/django- admin.py same error message. I'm still missing something, sorry to be so dense. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: how to speed up objects saving
In addition to Ivan's suggestions above, consider disabling auto- commits and making manual transaction commits say every 100 records or so. http://www.djangoproject.com/documentation/transactions/ This will eliminate the overhead of a commit on every instance save. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: url tag and reverse()
On Feb 1, 2008 12:17 AM, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > Strange, I had thought that wasn't working, but I guess it must be. So > with that change this gets the right URL: > reverse('entry', > kwargs={'translatorName':'johndoe','entryName':'blogentry'}) > > But trying to use the entry view, which requires two arguments, simply > gets a "Could not parse remainder of argument" for whatever comes > after the first word, whether I use positional or named arguments. > > And still, neither of these produces anything: > {% url translator translatorName=johndoe %} > {% url translator johndoe %} > > URL is meant to be able to take multiple arguments, isn't it? I am having this issue as well, I can user reverse('NAME') and it shows the right url, but the {% url NAME %} fails. Also if I move the entry down the list in my root url.py file it breaks the ability for all urls listed above it to be traced with {% url %} the following make it so I cannot use the {% url %} tag for any URL (r'^modules/', include('apps.modular.urls')), (r'^accounts/', include('apps.registration.urls')), (r'^news/', include('apps.news.urls')), (r'^blog/', include('apps.blog.urls')), (r'^gallery/', include('apps.photos.urls')), (r'^undo/', include('apps.undo.urls')), (r'^openid/', include('apps.openid.urls')), but if I move the openid entry to the top everything except the openid works. Reguardless of the order when I call reverse they all work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Newbie trying to install django-trunk from svn on Ubuntu 7.10
On 2008-02-01 12:54:48 -0700, bobhaugen <[EMAIL PROTECTED]> said: > > Following http://www.djangoproject.com/documentation/install/ > > I'm stuck at the steps of setting up the symlinks to django. > Step 3. ln -s `pwd`/django-trunk/django SITE-PACKAGES-DIR/django > Step 4. ln -s `pwd`/django-trunk/django/bin/django-admin.py /usr/local/ > bin Okay, to be honest, pretend you never read that. The bottom line is that Django only needs to be in your PYTHONPATH. By default Python already has its site-packages directory on the PYTHONPATH which is where this stems from. You can define the PYTHONPATH at anytime. Once it is there it is completely installed. You will want to get the django-admin.py file into your PATH so that you can easily access it with referencing it on the filesystem. It is useful to have Django installed in site-packages if you don't need to be switching between versions very often or it is a production server, for example. -- Brian Rosner http://oebfare.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Heads-down transaction-processing apps on Django
> - Lots of data entry yes...we've got some data-entry folks that are using one of the apps I've written, pulling information off paper phone-bills (for those we can't get electronically) > - What about data entry into a web form. Data entry people use 'Enter' > to move between fields, not Tab. And they won't touch a mouse. This may be a training issue...our DE folks use with no problems. However, if needed, you can use JavaScript to intercept and treat it as a tab. Several of the following answers can be resolved with a little JavaScript in the browser. > - Data entry people use lots of F-keys, Ctrl-keys and Alt-keys to make > things happen on the screen. Not quite as much flexibility here. HTML defines accelerator keys which are browser-specific (sometimes Alt+letter, sometimes control+letter, or other combos). > - Screens need to save and return *fast*. Instantaneous response is > expected. Depending on the source data, there are a couple options, and there are also issues with latency: - use AJAX to queue up DE, submitting the form in the background while allowing the user to continue with a new form. This gives you the best UI, but is more complex - if you're on a LAN you have different latency issues than if you're on a GSM aircard, dialup, or a satellite connection - you can create a form with subforms that can gather large batches of data and them submit them all at once. This one's fairly easy, but comes with the risk that an unsubmitted form can cause more data-loss if the user accidentally browses elsewhere or closes the window. As a vi/vim user, my fingers occasionally try to use control+W to delete the previous word while I'm typing in IE, only to have it close my whole window. Minutes of sotto voce oaths usually follow. > - Printouts need precise on-paper placement and instant delivery (no > pop-ups to select printer or preview). printing from the web is a peculiar issue. If you're printing to a local printer (attached/accessible to the browsing machine), you pretty much always have to go through a print dialog. If the printer is attached to the web-server, you have more control over the immediacy of printing. You'd have to use a python printing module (there was a recent post on comp.lang.python on this that pointed at a popular library, though I don't have it on hand). > - Screens are dense with lots of tightly-packed fields. This is a design issue... > - There may be requirements to interface with barcode scanners and > magstripe scanners (probably USB connected). Is it possible to integrate > these with a web app. Depends on how much data is coming off the barcode/magstripe scanner. Often the readers can be configured as a "keyboard wedge" which often means that the act as a virtual keyboard. For 1-d barcode scanners, this is pretty simple: read the barcode, send the data as keystrokes, and optionally send an or afterwards. Excellent for web. For mag-stripes such as credit-cards and loyalty cards, there are usually 2 tracks, of which usually only one is used for data. Much the same as a 1-d barcode reader, they send the data as keystrokes and optionally send a termination enter/tab character. This data being visible is usually not a problem. For 2-d barcodes and mag-stripes with 2 or 3 tracks of data (such as AMX credit-cards or US drivers'-licenses, most of which follow the 3-track AAMVA standard) on them, things get a little more complex. They send the data like keystrokes, including field and track/line delimiters and optionally a tab/enter afterwards. You'd have to have a text-box, click/tab into it, scan the card, get the data, and then parse the contents of that textbox (whether in JS or on the server-side). Scattering sub-fields of this data to the right places is...uh...an adventure :) You might look at Koha, OpenBiblio or Evergreen (three open-source library web OPAC systems, most of which at least deal with 1-d barcodes) for examples of how they treat barcode input. > Is anyone running apps like this? Yep :) > Can the above issues be dealt-with? Most of them, yes. > Can a browser provide the right kind of UI for these demanding but > unexciting applications? You don't give a lot of details on the characteristics of the data which may make a difference. Are there logical groupings in the data (in our instance, each phone is data-entered, each of which is usually on its own page, so there's a need to flip pages regularly, so they do a phone at a time, with 20-30 fields of data associated with each). Or, you can use AJAX something like Google Spreadsheets to dynamically add rows for DE use, submitting the row-content in the background. Django+Python+JavaScript can handle most of the requirements. Demand-printing on the web-client is the largest hurdle. And as a web-user, I'd want it that way, as I wouldn't want arbitrary websites to be able to send stuff to my printer unsolicited without giving me an option to cancel. Ho
Newbie trying to install django-trunk from svn on Ubuntu 7.10
Following http://www.djangoproject.com/documentation/install/ I'm stuck at the steps of setting up the symlinks to django. Step 3. ln -s `pwd`/django-trunk/django SITE-PACKAGES-DIR/django Step 4. ln -s `pwd`/django-trunk/django/bin/django-admin.py /usr/local/ bin One possible problem: not thinking very fast, I ended up checking out django-trunk into my home folder. Is that a mistake? Where shd it be? I tried several variations on Steps 3 and 4: sudo ln -s /django-trunk/django /usr/lib/python2.5/site-packages/ django sudo ln -s /django-trunk/django/bin/django-admin.py /usr/local/bin sudo ln -s django-trunk/django /usr/lib/python2.5/site-packages/django sudo ln -s django-trunk/django/bin/django-admin.py /usr/local/bin And also the same variations with passwords included inline instead using sudo. All of them resulted in broken links. Any clues? I did get django-trunk onto my PYTHONPATH, thanks to help from Brett Parker, so now when I type import django into the Python interpreter, I no longer get an error message. In other words, according to the instructions, django is actually installed, at least to some extent. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: newforms-admin replacement for core=True in inline models?
I wanted to bump this up, because if there is no solution I think this is an issue which needs to be rectified before it is merged to trunk. As Felix noted, without core=True support, anything listed as in-line *has to be created when you create the parent object. e.g. if a Pizza can have 1+ toppings, and the Topping name is a required field, and 3 Toppings fields are shown inline on Pizza creation, then *all three* have to be used, otherwise validation errors occur on Pizza. In the old django admin, this is not an issue with the Core fields, which identify what fields flag a field as "user is trying to be create me inline". (I apologise if this should be added as a bug to track etc instead of here. I am new to using a django branch, and I'm unsure on the policy on what I should be reporting. By looking in track, it seems that the current status of newforms-admin is very close to being merged with trunk (only a dozen or so minor issues listed as deal-breakers). However after a few days use, I have found various large issues, or at least undocumented backwards-incompatabilities. For example, this issue http://groups.google.com/group/django-users/browse_thread/thread/f889fce3e854257e# I posted in django users regarding one-to-one fields.) On Jan 25, 8:47 am, James T <[EMAIL PROTECTED]> wrote: > Felix, > > > Inline objects now have a 'delete' checkbox which is used for removing > > objects. > > Oh yeah! Well that answers the delete question, thanks. > > > I believe that the usual admin rules apply for creating models i.e. > > all fields without blank=True will be required, otherwise you'll get > > validation errors. > > I see, however there's still a feature of core=True which I can't seem > to find: if you left the core field blank the related record wouldn't > get created. > > As it is I've set blank=True on all the inline model's fields. > However, each time I save the parent object 3 blank related objects > are being created (as I have extra=3 set). > > Is there a way around this problem? > > James --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: FckEditor vs TinyMCE
Thanks Jay, That's a huge help. Do you know if there's any code for doing text versioning? We don't need a full blow wiki or CMS, but we do want to add some versioning for our "notes." Any leads on this? On Feb 1, 1:38 pm, Jay Klehr <[EMAIL PROTECTED]> wrote: > It's certainly possible to implement FCK as a JS based editor, no python > code necessary. It'll simply act as a textarea replacement to the user, > but will still post the source of the editor when the form is submitted. > > Here's the integration guide for doing it this way: > > http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Integration/... > > If you want to do it in your django code, here's the Python integration > guide: > > http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Integration/... > > Jay > > Cull wrote: > > We're just starting to consider text editing. > > What is our easiest path here? TinyMce or FckEditor. The latter has > > been our choice previously, but is there a post somewhere that > > discusses who to do it? I haven't been about to find more than bits > > and pieces. If not, what about Tiny? > > > Tips appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: ForeignKey displaying related values
Hi, > I am new to django, please excuse any naivity. Welcome to Django :) > I would like to list > child and related parent records from the scenario below. Although > quite happily displaying ChildFile records, I can't seem to display > any ParentFile records. > > models.py > class ParentFile(models.Model): > recnum = models.AutoField(primary_key=True) > number = models.FloatField(max_digits=12, decimal_places=0) > date = models.DateField() > time = models.CharField(maxlength=5) > city = models.CharField(maxlength=40) > country = models.CharField(maxlength=40) > ... > > class ChildFile(models.Model): > docket = models.ForeignKey(ParentFile, related_name = 'number', > unique=True) > recnum = models.TextField(unique=True) # This field type is a > guess. > docket = models.FloatField(max_digits=12, decimal_places=0, > primary_key=True) You've two fields called docket in this model. That's not allowed. Rename one of them and regenerate your model. > name = models.CharField(maxlength=40) > date = models.DateField() > ... > > views.py > def Outstanding(request): > fLatestRecs = ChildFile.objects.filter(name = > 'DAN').select_related().order_by('-date') > return render_to_response('/report.html', {'fLatestRecs': > fLatestRecs }) > > report.html > ... > {% if fLatestRecs %} > width="100%"> > > Date > Time > Name > City > Country > > {% for ChildFile in fLatestRecs %} > > {{ ChildFile.date }} > {{ ChildFile.time }} > {{ ChildFile.name }} > {{ ParentFile.city }} > {{ ParentFile.country }} Change those two lines like this (assuming docket is your ForeignKey field to ParentFile): {{ ChildFile.docket.city }} {{ ChildFile.docket.country }} Basically, you can get to a parent object by traversing the relevant ForeignKey field of the child object instance. You might want to read up on the DB API documentation for more details on this. Also, it's a common convention to use titlecasing in class names and not in instance names. So, in your template, I would suggest renaming ChildFile to childfile or child_file. -Rajesh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Heads-down transaction-processing apps on Django
Sorry for posting such a nebulous question... Is anyone using Django web apps as heads-down transaction processing applications that are heavy in the areas of: - Lots of data entry - Lots of "instant, right now" demands like POS A few - slightly more specific - issues: - What about data entry into a web form. Data entry people use 'Enter' to move between fields, not Tab. And they won't touch a mouse. - Data entry people use lots of F-keys, Ctrl-keys and Alt-keys to make things happen on the screen. - Screens need to save and return *fast*. Instantaneous response is expected. - Printouts need precise on-paper placement and instant delivery (no pop-ups to select printer or preview). - Screens are dense with lots of tightly-packed fields. - There may be requirements to interface with barcode scanners and magstripe scanners (probably USB connected). Is it possible to integrate these with a web app. Is anyone running apps like this? Can the above issues be dealt-with? Can a browser provide the right kind of UI for these demanding but unexciting applications? Any insight appreciated, Michael --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: when following along in the django book, i get a 'name 'django' is not defined' error when accessing the admin page (sorry if this is a double post)
Hi, On Feb 1, 12:43 pm, djrocks <[EMAIL PROTECTED]> wrote: > Hi, > I think there is a simple answer to this, but I was unable to find > it. While following along in the django book, i did the steps > necessary to activate the admin page, including uncommenting the admin > url in urls.py. But when I go tohttp://127.0.0.1:8000/admin/, I get > the following error: > > NameError at /admin/ > name 'django' is not defined It may be a Django installation or setup issue. It doesn't look like the module 'django' is in your PYTHONPATH. To confirm that, drop into a Python shell and do: import django If that fails, look at your PYTHONPATH and follow the Django installation docs once again. If that does work, include the full stack trace of the error page (be sure to set settings.DEBUG to True to get such a trace.) -Rajesh D --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: FckEditor vs TinyMCE
It's certainly possible to implement FCK as a JS based editor, no python code necessary. It'll simply act as a textarea replacement to the user, but will still post the source of the editor when the form is submitted. Here's the integration guide for doing it this way: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Integration/JavaScript If you want to do it in your django code, here's the Python integration guide: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Integration/Python Jay Cull wrote: > We're just starting to consider text editing. > What is our easiest path here? TinyMce or FckEditor. The latter has > been our choice previously, but is there a post somewhere that > discusses who to do it? I haven't been about to find more than bits > and pieces. If not, what about Tiny? > > Tips appreciated. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Stylesheet Inheritance
> I am having trouble getting my stylesheet to appear in each html > file. I have a base template that contains the path to the css file. > Each page that extends the base template simply adds the path of the > css file on to its current uri to get the wrong location. Is there a > way to specify the css file in one location and have the other > templates find it regardless of the URI? It sounds like you are not using an absolute path. The way I handle a CSS file across several pages is to have my base.html look similar to: something The first slash in /media/css/styles.css is critical since it tells the webserver to look at the root of the domain. If left off it will become relative to the page you are viewing. For example: http://localhost/my_cool_url would then yield a lookup for http://localhost/my_cool_url/media/css/styles.css as opposed to just http://localhost/media/css/styles.css. It is also common pratice to use MEDIA_URL to cut down on having to always know the media path. Using it will change simple change the url to {{ MEDIA_URL }}css/styles.css and MEDIA_URL = "/media/" in your settings.py. Make sure you are using the RequestContext to ensure {{ MEDIA_URL }} is displayed correctly in your templates. (This will only work if you are using HEAD of Django trunk, otherwise you must write your own context_processor). -- Brian Rosner http://oebfare.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Stylesheet Inheritance
On Fri, 2008-02-01 at 09:57 -0800, quizkiwi wrote: > I am having trouble getting my stylesheet to appear in each html > file. I have a base template that contains the path to the css file. > Each page that extends the base template simply adds the path of the > css file on to its current uri to get the wrong location. Is there a > way to specify the css file in one location and have the other > templates find it regardless of the URI? Why not put the reference to it in your base template? -a --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newforms validator_list
> I understand the preferred method is to create a custom form Field, > and do validation in its clean() method. However, this appears to be > lacking in a couple ways. This can be accomplished at the form level by defining a clean_FIELD method to clean the data as you see fit. The only time you would need to write your own custom field is to completely override a the default validation of a field. > > First of all, it assumes you're generating the form manually. What if > you're using form_for_model, or more critically, using the admin > interface? Is there a way to specify custom form Field instances for > a corresponding model Field in the admin? Ok, this seems to be a large misconception of what newforms-admin really is. Let's pretend the admin application doesn't exist for one second. You are left with newforms. You could go on your merry way writing forms that only authenticated users can access. Putting the admin application back in the mix isn't trying to stop you from doing that. It just provides you a thin layer of views, urls and many sensible defaults for an admin interface using newforms. The ModelAdmin class has two methods named form_add and form_change. This function returns a django.newforms.Form instance that will be used to render on the page. You could return anything from here. form_for_model should not be used and its ModelForm replacement is preferred. I am not 100% sure off the top of my head if there are any particular requirements the form must have, but if you notice anything wonky, please, open a ticket in Trac. > > Secondly, in the admin the potential to do multi-field validation is > gone (or seems to be). The old validator function passed the values > (field_data, all_data), allowing one to check the value of other > fields in the form via the all_data field. Is it no longer possible > to, for instance, trigger validation of one field off another via the > admin in newforms-admin? (ie, if field1 is None, field2 is required; > if field1 is filled, field2 is not required.) As I pointed out above this is still newforms. This type of validation is very possible since the form clean_FIELD methods are never passed its own value. It is the job of the developer to pull out the values from cleaned_data that a clean_FIELD method, you are implementing, should care about. -- Brian Rosner http://oebfare.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie sqlite3 dbshell confusion
On Feb 1, 11:09 am, Brett Parker <[EMAIL PROTECTED]> wrote: > On 01 Feb 08:00, bobhaugen wrote: > > > > On Feb 1, 7:45 am, Brett Parker <[EMAIL PROTECTED]> wrote: > PYTHONPATH is just an environmental variable, often if you're not > already using it it'll be empty ;) You can check it's current value > with: > echo $PYTHONPATH > > If it's empty then you can just do: > export PYTHONPATH=/path/to/django/trunk/checkout > > Otherwise: > export PYTHONPATH=$PYTHONPATH:/path/to/django/trunk/checkout > > That should give you enough to be able to run the development server > etc... For apache2 and mod_python you can just add it in the > PythonPath. Thanks again for your patience, Brett. That at least got me to the point where import django works. If I run into other problems down the road, I'll start another thread. We're way off topic in this one, altho I'm happy with the results so far. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Stylesheet Inheritance
I am having trouble getting my stylesheet to appear in each html file. I have a base template that contains the path to the css file. Each page that extends the base template simply adds the path of the css file on to its current uri to get the wrong location. Is there a way to specify the css file in one location and have the other templates find it regardless of the URI? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
FckEditor vs TinyMCE
We're just starting to consider text editing. What is our easiest path here? TinyMce or FckEditor. The latter has been our choice previously, but is there a post somewhere that discusses who to do it? I haven't been about to find more than bits and pieces. If not, what about Tiny? Tips appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
when following along in the django book, i get a 'name 'django' is not defined' error when accessing the admin page (sorry if this is a double post)
Hi, I think there is a simple answer to this, but I was unable to find it. While following along in the django book, i did the steps necessary to activate the admin page, including uncommenting the admin url in urls.py. But when I go to http://127.0.0.1:8000/admin/, I get the following error: NameError at /admin/ name 'django' is not defined Here is my urls.py file: from django.conf.urls.defaults import * from mysite.views import current_datetime from mysite.views import hours_ahead urlpatterns = patterns('', (r'^time/$', current_datetime), (r'^time/plus/(\d{1,2})/$', hours_ahead), # Example: # (r'^mysite/', include('mysite.foo.urls')), # Uncomment this for admin: (r'^admin/', include('django.contrib.admin.urls')), ) Any help would be greatly appreciated!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Flash and Django
http://djangoamf.sourceforge.jp/index.php?DjangoAMF_en On 1 фев, 18:33, "Ronaldo Z. Afonso" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm new in Django and Web development and I just want to know if it's > possible to have a flash script showing elements that was retrieve from > a data base by django? > Any link or documentation would be appreciated. > Thanks. > > Ronaldo. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Flash and Django
>I just want to know if it's > possible to have a flash script showing elements that was retrieve from > a data base by django? I'm not entirely sure what you are asking, but I think the answer is: Yes. Are you asking about the flash script calling a URL, getting data back and then displaying it? If so, yes. Django doesn't know or care who is calling the URL, just as long as it's a well-formed request. We have several places where Django is serving data to an AJAX app, piece of cake. If you need a good free/cheap flash player (with source) that is well written and that you can hack on, I strongly recommend http://www.jeroenwijering.com/. 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: Flash and Django
On 01 Feb 2008 Fri 17:33:50 Ronaldo Z. Afonso wrote: > Hi, > > I'm new in Django and Web development and I just want to know if it's > possible to have a flash script showing elements that was retrieve from > a data base by django? > Any link or documentation would be appreciated. > Thanks. > > Ronaldo. Yes that's possible. You can create a view that produces XML output from objects and parse it with your flash script. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Newbie sqlite3 dbshell confusion
On 01 Feb 08:00, bobhaugen wrote: > > Thanks again, Brett. > > On Feb 1, 7:45 am, Brett Parker <[EMAIL PROTECTED]> wrote: > > If you're just wanting to run the latest trunk then you can just use an > > svn checkout and add that in to PYTHONPATH on the command line (you > > might also want to add /bin to your PATH to get > > django-admin.py there). > > I appended django-trunk and django-trunk/django/bin to sys,path in the > Python interpreter and I can now import django with no errors. > > I did a bunch of googling for PYTHONPATH but am still confused about > how to add things to it. Clues welcome, but if I just go trial and > error am I likely to cause any damage? PYTHONPATH is just an environmental variable, often if you're not already using it it'll be empty ;) You can check it's current value with: echo $PYTHONPATH If it's empty then you can just do: export PYTHONPATH=/path/to/django/trunk/checkout Otherwise: export PYTHONPATH=$PYTHONPATH:/path/to/django/trunk/checkout That should give you enough to be able to run the development server etc... For apache2 and mod_python you can just add it in the PythonPath. Hope that helps, -- Brett Parker --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Complex relationship for user profile
I'll try those, Peter, thanks for the response... Aaron Peter Rowell wrote: Failing a response to that one must mean I'm asking for something that is undoable. Uh, this isn't McDonald's. Slow/no response does not immediately equate to undoable. It more likely means that people who might have answered the question were doing something else (watching the debate, coding, sleeping, having a life). Regarding your question: Depending on the dynamics of your app, you might investigate the following: 1. If the profile is updated first and you want to propagate some changes to the associated User record, try overriding the save() method for UserProfile, do your thing, and then call super(UserProfile, self).save() to finish. 2. If the opposite is true (User is changed and you want to propagate to UserProfile), avoid the temptation to hack contrib/auth/models.py. Instead, use signals. See http://code.djangoproject.com/wiki/Signals. See http://www.martin-geber.com/weblog/2007/10/29/django-signals-vs-custom-save-method/ for a discussion on the difference between custom save and signals. 3. Modifying the admin can be useful, but can the data only be changed through the form? If yes, then proceed. If no, then option 1 or 2 is a better way to capture the change, regardless of the source of the change. 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: Complex relationship for user profile
> Failing a response to that one must mean I'm asking for something that > is undoable. Uh, this isn't McDonald's. Slow/no response does not immediately equate to undoable. It more likely means that people who might have answered the question were doing something else (watching the debate, coding, sleeping, having a life). Regarding your question: Depending on the dynamics of your app, you might investigate the following: 1. If the profile is updated first and you want to propagate some changes to the associated User record, try overriding the save() method for UserProfile, do your thing, and then call super(UserProfile, self).save() to finish. 2. If the opposite is true (User is changed and you want to propagate to UserProfile), avoid the temptation to hack contrib/auth/models.py. Instead, use signals. See http://code.djangoproject.com/wiki/Signals. See http://www.martin-geber.com/weblog/2007/10/29/django-signals-vs-custom-save-method/ for a discussion on the difference between custom save and signals. 3. Modifying the admin can be useful, but can the data only be changed through the form? If yes, then proceed. If no, then option 1 or 2 is a better way to capture the change, regardless of the source of the change. 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 -~--~~~~--~~--~--~---
Flash and Django
Hi, I'm new in Django and Web development and I just want to know if it's possible to have a flash script showing elements that was retrieve from a data base by django? Any link or documentation would be appreciated. Thanks. Ronaldo. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Simultaneous edits
Filip, Thanks for your very informative explanations and ideas. I will be studying it closely. Thanks, Michael Filip Wasilewski wrote: > Hi Michael, > > On Jan 30, 6:25 pm, Michael Hipp <[EMAIL PROTECTED]> wrote: >> James Bennett wrote: >>> On Jan 30, 2008 9:18 AM, Michael Hipp <[EMAIL PROTECTED]> wrote: Does Django have any built-in way to handle or prevent simultaneous, incompatible edits to a database record? >>> No, that's what your database's concurrency handling is for. >> Ok, I probably didn't explain well enough... >> >> I'm using PostgreSQL so concurrency isn't a problem. >> >> What is a problem is that user A loads a record and begins making changes. >> Then user B loads the same record and begins making different changes. One of >> them saves it first followed by the other and the only trace that's left is >> what was saved by the one that got there last. >> >> No real issue at the database level. PG doesn't care. But possibly a very big >> issue at the application level (especially if each of the saves also modified >> related tables based on the different inputs of each user) and the >> application >> level of each could not know about the other so opportunities to prevent this >> disaster are few at the app level. > > The way in which you handle the application-level transactions that > span across a set of requests it entirely up to you :-) Thinking of > typical scenarios you could either synchronize data in real time > (something like google docs), synchronize on save (some kind of diff > and merge), warn users before they start editing a record which is > already opened for edit by another user (like in MoinMoin) or just > overwrite or ignore changes (like in all bad-user-experience-apps). > > > The third option seems quite reasonable and its also not very hard to > implement. All what you will need is a (generic) registry that will > hold information about checked out objects (rows, records, documents - > whatever the naming convention is) and some locking logic. > > The registry could be simply a model with three fields: [generic] > model foreign key, user foreign key, and a checkout time, with unique > constraint on the model foreign key. If you don't need to track > different models then a "classic" foreign key instead of a generic > contenttypes one should be just fine. > > The functions that will provide a locking interface should be atomic > (that's the place where the database level transactions come into > play). A typical pattern is to have at least an acquire (lock) and a > release (unlock) routines, plus a couple of additional helpers for the > typical use cases: > > * acquire_lock(object, user) - creates an entry/replaces expired one > in the registry, allows for re-entrant locking (the same lock can be > obtained many times by the user that already possess it without > raising an error), raises an exception if an object is already locked > by another user and the lock period hasn't expired. > > * release_lock(object, user) - removes lock from the registry > > * is_locked(object, user) - checks if a valid object lock entry exists > > Cyclic removal of expired entries from the registry should not be > necessary unless you count for every byte or need to reduce number of > queries (in a typical case they will consume considerably less space > than the other models' data). > > After setting this up you should have a pretty robust mechanism for > controlling parallel access attempts to database records/objects. Just > lock the object on edit, release the lock on save and issue a warning > on concurrent edit attempts. > >> I've seen some table layouts that included a column like "last_edit_serial" >> so >> that a steadily incrementing serial could provide a hint to the app level >> that >> something had changed since the record was loaded. > > Only when you want to notify someone that his effort has just been > cancelled because someone else has corrected a typo in the meantime > and saving changes is not permitted ;-) > >> But I don't see Django adding any such columns and was wondering if a >> different mechanism was in effect. Or if some other technique was widely used >> among Django users. > > What makes me wonder even more is the fact how fantastically people > seem to get away without all this stuff :-) > > > Hope that helps, > > f > > -- > http://filipwasilewski.pl > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Have get_profile() delegate to one of several profile models depending on type of user
Thanks for the responses everyone. My final approach to this issue has gone more along the lines of Ivan's response, though with a twist. I now have a generic UserProfile model which is returned by the get_profile() method. All this model stores is the foreign key to the user and a 'user_type'. I have a method on this model that uses a modified form of Auth's own get_profile() method to retrieve the appropriate model based on the user type. Essentially UserProfile acts as a middleman between the User model and the appropriate Profile model for the situation. I agree with Ivan. I'm not fond of this approach either, but short of something like single table inheritance (which Django doesn't support), there's really no other (good) way to approach the problem. I guess the best approach would be to actually write my own authentication system customized to my app. I could get rid of the hackiness of my solution here, but that approach seems to have problems of its own. Chris Pratt On Jan 29, 4:00 pm, forgems <[EMAIL PROTECTED]> wrote: > What is the criteria in the User model that gives you users profile > model ? If you don't have such a criteria in User's model then you > have answered your question, > > On Jan 28, 9:11 pm, Chris Pratt <[EMAIL PROTECTED]> wrote: > > > This question has been asked a few times before, but doesn't seem to > > be getting any responses. > > > I'm working on a project where we have three types of users, each > > requiring vastly different profile models. The AUTH_PROFILE_MODULE > > setting, obviously, allows only one profile to be specified. > > > One response to this question suggested branching from an intermediate > > profile model. Thereby, you could call something like: > > > request.user.get_profile().get_for_user() > > > and it would return the appropriate profile. This seems like a fair > > enough approach, but it's a bit kludgy, and certainly doesn't lend > > itself towards DRY code that anyone can manipulate. What happens if > > someone comes along later and doesn't know they're supposed to tack on > > the extra method call? > > > It would be easy enough to rewrite the get_profile() method to pull > > the right profile and then monkey patch the User model, but this feels > > wrong. > > > What would be considered best practice here? > > > Thanks, > > Chris Pratt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Complex relationship for user profile
Okay, Failing a response to that one must mean I'm asking for something that is undoable... could anyone provide an easy way to accomplish this by maybe extending the admin template or something? I'm convinced retrieving the data would be very simple, but is there a way to get it to save as well? Can you extend the form handler for an admin page? Thanks again, Aaron Aaron Fay wrote: > Hi list! (first post) > > I've created a small application to suit a new project I am working on, > however I have a question regarding using the user profile feature. I > have the setup working properly according to the documentation and it > works, what I need to know is if I can create a field in my user profile > model that will mimic or update fields on the users table. For example, > when I add a model for the profile, I would like to create a > relationship so I can display and update the user's email on my admin > page for the profile model, and not have to go to the users edit page to > do so (and actually it would be handy for a couple fields...) > > Not sure how to pull this off, I'm only a couple days into Django (and > loving it!) > > Thanks for the help, > Aaron > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: how to speed up objects saving
> I'll try to redefine save methods in all the objects to see how much time it > saves You may want to redefine the __init__ methods as well (it's called when you create your objects before save), it adds overhead of two more signals that are probably unused and can be removed for speed. You can try comment out all dispatcher.send() lines of __init__ and __save__ methods of Model class in /django/db/models/base.py and save the file as base2.py in the same place inside your Django package and say something like `from django.db.models.base2 import Model as MyModel' and replace model.Model with MyModel in class definitions. I know it's hackish, but it's easier and it works. :) Hope this helps, Ivan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Newbie sqlite3 dbshell confusion
Thanks again, Brett. On Feb 1, 7:45 am, Brett Parker <[EMAIL PROTECTED]> wrote: > If you're just wanting to run the latest trunk then you can just use an > svn checkout and add that in to PYTHONPATH on the command line (you > might also want to add /bin to your PATH to get > django-admin.py there). I appended django-trunk and django-trunk/django/bin to sys,path in the Python interpreter and I can now import django with no errors. I did a bunch of googling for PYTHONPATH but am still confused about how to add things to it. Clues welcome, but if I just go trial and error am I likely to cause any damage? > I haven't currently got an upto date ubuntu system about, but I could > build packages for the current svn when I get home if that would be of > use... That's a generous offer, but I hope to be able to get the svn checkout working. The sys.path additions suggest it is possible. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: how to speed up objects saving
Thanks a lot for the advice I'll try to redefine save methods in all the objects to see how much time it saves Alex Ivan Illarionov wrote: > > > You have two options: > 1. Execute raw SQL 'INSERT' queries > 2. Override the Model.save() or create new save_fast() method in your > Model class. The main speed eaters in Model.save() are > dispatcher.send() calls - so if you copy/paste the content of save > method from Django code without dispatcher.send() lines you'll get a > reasonable speed increase. > > --Ivan > > > > -- View this message in context: http://www.nabble.com/how-to-speed-up-objects-saving-tp1555p15227730.html Sent from the django-users mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ForeignKey displaying related values
Hello all, I am new to django, please excuse any naivity. I would like to list child and related parent records from the scenario below. Although quite happily displaying ChildFile records, I can't seem to display any ParentFile records. models.py class ParentFile(models.Model): recnum = models.AutoField(primary_key=True) number = models.FloatField(max_digits=12, decimal_places=0) date = models.DateField() time = models.CharField(maxlength=5) city = models.CharField(maxlength=40) country = models.CharField(maxlength=40) ... class ChildFile(models.Model): docket = models.ForeignKey(ParentFile, related_name = 'number', unique=True) recnum = models.TextField(unique=True) # This field type is a guess. docket = models.FloatField(max_digits=12, decimal_places=0, primary_key=True) name = models.CharField(maxlength=40) date = models.DateField() ... views.py def Outstanding(request): fLatestRecs = ChildFile.objects.filter(name = 'DAN').select_related().order_by('-date') return render_to_response('/report.html', {'fLatestRecs': fLatestRecs }) report.html ... {% if fLatestRecs %} Date Time Name City Country {% for ChildFile in fLatestRecs %} {{ ChildFile.date }} {{ ChildFile.time }} {{ ChildFile.name }} {{ ParentFile.city }} {{ ParentFile.country }} {% endfor %} {% else %} No Records available. {% endif %} Any help would be much appreciated. Many thanks, Eamon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Ruyan e-cigarette e-cigarettes v8 How to eliminate harm from second cigarette
As a former smoker, I know first hand how hard it is to quit smoking. My many efforts to stop failed until I was truly ready to quit. Whatever works is fair game in my book. The new e-cigarette, available mainly in China and Europe right now, may be just the answer for many who smoke not only for the nicotine but also the tactile pleasures of smoking itself. This new e-cigarette, made with a stainless steel shell, lithium ion battery, micro-electronic circuit, atomizing chamber, and indicator light at the tip delivers nicotine that is inhaled via a cartridge (that you refill as needed) that is inserted into the device. A vapor that mimics smoke is emitted (not much info on the vapor, presumably just water vapor) The "cigarette" even has a led light up on the tip to simulate the burning. At around 200.00 US dollars users will want to make sure they don't leave it in an ashtray (are there still ashtrays anymore?) The nicotine cartridges are sold in packages of 50 for around $90.00. While it isn't marketed in the United States yet, I see where a official company: RUYANHEALTH INTERNATIONAL LTD. (www.ruyanhealth.com) , is selling them online to US customers using pay-pay, etc here. They also sell eCigars. Who knows if this device will be anymore successful in helping people quit than the nicorette gum and patches but if helps cut down on people polluting our streets, houses, restaurants, and other public areas with toxic smoke I am all for it. Second-hand smoke is a killer. Nicotine is no sloucher either, last I heard Nicotine is a major contributer to coronary artery disease but if it helps the user actually quit it seems worth 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?hl=en -~--~~~~--~~--~--~---
Re: newforms file-upload troubleshooting
Clarification: in the above two 'Relevant info' paragraphs, when I note that "the file name appears in the table's 'name' field", by 'file name' I'm referring to the optional user-supplied title of the file (i.e. 'picture of our house') as opposed to the 'filename' (i.e. 'house.png'). /birkin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Newbie sqlite3 dbshell confusion
On 01 Feb 05:33, bobhaugen wrote: > > Brett, > > Thanks for the info on the Ubuntu 0.96 package. I really appreciate > the replies from you, Jeff and Ramiro. Sorry to be so clueless, I'm > new to Linux and Python as well as Django. (I know it's a bad idea to > adopt more than one new technology at a time, but I got no choice, > gotta plunge in...) > > On Feb 1, 6:22 am, Brett Parker <[EMAIL PROTECTED]> wrote: > > There are svn snapshot packages available from the debian experimental > > repository, with some pinning you should be able to pull in that and > > only that from the experimental repository. The latest snapshot was > > r7047 (thanks Gustavo). > > Will that be any better for running on Ubuntu than > http://code.djangoproject.com/svn/django/trunk/ , which I am currently > trying to get installed so it will work? (See previous message in this > thread http://groups.google.com/group/django-users/msg/43d4e4774b935cf8 > ). Better is subjective! It's just a snapshot of the svn trunk at rev 7074... it should be fairly easy to install though, and it'd get dropped in to site-packages for all python versions installed. However, I've just glanced at the version of python-support in gutsy and it appears to be older than the version that package relies on... If you're just wanting to run the latest trunk then you can just use an svn checkout and add that in to PYTHONPATH on the command line (you might also want to add /bin to your PATH to get django-admin.py there). I haven't currently got an upto date ubuntu system about, but I could build packages for the current svn when I get home if that would be of use... Thanks, -- Brett Parker --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 for a security/encryption programmer for small contract
> Emanuele, your said : As for safety, nothing is safer than OTP, but > are we sure that your customer > is able to go to great lengths to distribute long key streams over a > perfectly safe channel to the sales representatives? > > Isn't the encrypted string secure? > > The method to send the string can't be secure. It is sent by email. > The point is to encrypt it on the server, send it over an unsecure > network. Then, when the sales rep. receive it, he will decrypt it. The problem is not sending the encrypted string, but getting the decryption-key into the hands of the sales-rep so he can decrypt the encrypted string. And if you've solved that problem, you've solved the "how do I get a secret to the sales rep over the public internet?" problem. The aforementioned problems with one-time-pads is that *key* distribution and maint. becomes the problem. The only thing it does is allow you to defer transmission of an unknown secret. Useful Scenario: Alice and Bob are physically in the same room. Alice gives Bob a pad of OTPs and keeps a copy for herself. Bob goes to Supersekretistan where he uses the OTP to encrypt data and send it back to Alice, then destroys the generating OTP. Not So Useful Scenario: Alice is at home, Bob is in Supersekretistan. Alice uses $METHOD to securely send Bob a pad of OTPs, keeping a copy for herself. As above, Bob uses the OTP to send data back to Alice, destroying the OTP. In the NSUS, if you've solved $METHOD, then Bob can just use $METHOD to send the data back to Alice, and has no need for OTP[1]. $METHOD usually consists of something like public-key cryptography. -tim [1] The one caveat that occurs to me here is that it might be illegal in Supersekretistan to possess encryption software, but it might not be illegal to possess large volumes of random data and an XOR operator :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: allow user to update his record
Carl Karsten wrote: > Is there a built in way for users to update their own user record? > > I currently have a page that displays user data to any other user. I was > hoping > to re-use that for allowing a user to edit his own. > > If it matters, I am useing a user_profile as described: > http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/ (12:35:22 AM) ubernostrum: CarlFK: http://code.google.com/p/django-profiles/ (12:35:47 AM) ubernostrum: CarlFK: I wrote it so you won't have to :) thanks uber. Carl K --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie sqlite3 dbshell confusion
Brett, Thanks for the info on the Ubuntu 0.96 package. I really appreciate the replies from you, Jeff and Ramiro. Sorry to be so clueless, I'm new to Linux and Python as well as Django. (I know it's a bad idea to adopt more than one new technology at a time, but I got no choice, gotta plunge in...) On Feb 1, 6:22 am, Brett Parker <[EMAIL PROTECTED]> wrote: > There are svn snapshot packages available from the debian experimental > repository, with some pinning you should be able to pull in that and > only that from the experimental repository. The latest snapshot was > r7047 (thanks Gustavo). Will that be any better for running on Ubuntu than http://code.djangoproject.com/svn/django/trunk/ , which I am currently trying to get installed so it will work? (See previous message in this thread http://groups.google.com/group/django-users/msg/43d4e4774b935cf8 ). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: sudo under django or better solutions?
> mm... sudo is a much more fine grained way of granting permission. I don't > really like do give all power to a web application. > > What I would have liked was a sort of sudo module, so execute certain > *configured* funcions with more power. Another option might be a long-running process (LRP) that listens on a pipe for commands. In this case, the only command it would accept is "adduser", and it would create a user based on the syntax of the command sent. Thus, your LRP might listen on /tmp/adduser-pipe so your unpriv'ed web-process would connect to this pipe and write something like aup = file('/tmp/adduserpipe', 'w') aup.write("joe Joe Smith\n") aup.close() Your LRP would then read this command and create a user named "Joe Smith" with a login of "joe". One might get more elaborate for error-handling, but this would place clear lines of permission division between the dangerous user-adding code and the hairy world of teh intarweb. -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Image upload in user's directory
On 1 Lut, 11:35, django_user <[EMAIL PROTECTED]> wrote: > Thanks it worked.. :) Nice to hear that :) -- Maciej Wisniowski --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Simultaneous edits
Hi Michael, On Jan 30, 6:25 pm, Michael Hipp <[EMAIL PROTECTED]> wrote: > James Bennett wrote: > > On Jan 30, 2008 9:18 AM, Michael Hipp <[EMAIL PROTECTED]> wrote: > >> Does Django have any built-in way to handle or prevent simultaneous, > >> incompatible edits to a database record? > > > No, that's what your database's concurrency handling is for. > > Ok, I probably didn't explain well enough... > > I'm using PostgreSQL so concurrency isn't a problem. > > What is a problem is that user A loads a record and begins making changes. > Then user B loads the same record and begins making different changes. One of > them saves it first followed by the other and the only trace that's left is > what was saved by the one that got there last. > > No real issue at the database level. PG doesn't care. But possibly a very big > issue at the application level (especially if each of the saves also modified > related tables based on the different inputs of each user) and the application > level of each could not know about the other so opportunities to prevent this > disaster are few at the app level. The way in which you handle the application-level transactions that span across a set of requests it entirely up to you :-) Thinking of typical scenarios you could either synchronize data in real time (something like google docs), synchronize on save (some kind of diff and merge), warn users before they start editing a record which is already opened for edit by another user (like in MoinMoin) or just overwrite or ignore changes (like in all bad-user-experience-apps). The third option seems quite reasonable and its also not very hard to implement. All what you will need is a (generic) registry that will hold information about checked out objects (rows, records, documents - whatever the naming convention is) and some locking logic. The registry could be simply a model with three fields: [generic] model foreign key, user foreign key, and a checkout time, with unique constraint on the model foreign key. If you don't need to track different models then a "classic" foreign key instead of a generic contenttypes one should be just fine. The functions that will provide a locking interface should be atomic (that's the place where the database level transactions come into play). A typical pattern is to have at least an acquire (lock) and a release (unlock) routines, plus a couple of additional helpers for the typical use cases: * acquire_lock(object, user) - creates an entry/replaces expired one in the registry, allows for re-entrant locking (the same lock can be obtained many times by the user that already possess it without raising an error), raises an exception if an object is already locked by another user and the lock period hasn't expired. * release_lock(object, user) - removes lock from the registry * is_locked(object, user) - checks if a valid object lock entry exists Cyclic removal of expired entries from the registry should not be necessary unless you count for every byte or need to reduce number of queries (in a typical case they will consume considerably less space than the other models' data). After setting this up you should have a pretty robust mechanism for controlling parallel access attempts to database records/objects. Just lock the object on edit, release the lock on save and issue a warning on concurrent edit attempts. > I've seen some table layouts that included a column like "last_edit_serial" so > that a steadily incrementing serial could provide a hint to the app level that > something had changed since the record was loaded. Only when you want to notify someone that his effort has just been cancelled because someone else has corrected a typo in the meantime and saving changes is not permitted ;-) > But I don't see Django adding any such columns and was wondering if a > different mechanism was in effect. Or if some other technique was widely used > among Django users. What makes me wonder even more is the fact how fantastically people seem to get away without all this stuff :-) Hope that helps, f -- http://filipwasilewski.pl --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: My Django under Vista also lags
That's it ;-) now everthing is lightning fast. Thank you *.sebastian On 31 Jan., 04:32, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Jan 31, 2008 12:09 PM, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > > But I don't have ZoneAlarm - maybe it's a Python problem. The > > rendering time of a single request takes up to 8 seconds. On my > > ubuntu machine everything is lightning fast. Does anyone has some > > ideas? > > I've seen this before using Firefox on Vista. If you go to > about:config and set network.dns.disableIPv6 to True, the problem goes > away. I don't know why this works, or if there are any other > consequences of note, but it worked for me. > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie sqlite3 dbshell confusion
On 31 Jan 11:24, bobhaugen wrote: > > On Jan 31, 10:38 am, Jeff Anderson <[EMAIL PROTECTED]> wrote: > > The link you pasted assumes you are using the development version, which > > has some differences. My personal recommendation is to remove 0.96 and > > use django-svn. > > You are correct. I just tried some of the tutorial steps that > determine if I have the latest version, and I don't. > > Followup question: I understand some adjustments were made to the > ubuntu package to make it run better on ubuntu. > > Does anybody know what those are, and what I wd need to do to recreate > them if I uninstalled 0.96.1 (which at least seems to work) and > installed django-svn? The 0.96 package there is just the one from Debian, the only changes that are made to the debian package is that django-admin.py becomes django-admin as it's installed in to /usr/bin (django-admin.py is still in /usr/lib/python-django/bin, along with the other django scripts). (Except the version in hardy, which rewrites the shebang of manage.py when manage.py is created - which we used to have in the debian packages, but removed as using the system default python is the correct behaviour as a default, and if you're not using the default then you already know enough to run manage.py in the interpreter of your choice). There are svn snapshot packages available from the debian experimental repository, with some pinning you should be able to pull in that and only that from the experimental repository. The latest snapshot was r7047 (thanks Gustavo). Thanks, -- Brett Parker --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
صور وأشرطه جنس أجنبيه
sex sex sex أكبر موقع سكس عربي sex sex sex أكبر موقع سكس عربي خليجي عروض افلام الأن بالمجاتي http://www.groups-goole.l7n6rb.com/sex-free.html أكبر موقع جنسي عربي افلام مجانيه 100% http://sex.66rb.net/sex.htm http://www.l7n6rb.com أكبر المواقع الجنسيه http://www.66rb.net/e3lan/e3lan.html زواج مسيار http://msear.zw2j.com تعارف بنات , اميلات بنات http://t3arf.zw2j.com sex sex sex أكبر موقع سكس عربي sex sex sex شهيرات عاريات وفضائح http://sex.66rb.net/sex.htm صور نيك وشرمطه http://66rb.net صور وأشرطه جنس أجنبيه http://www.groups-goole.l7n6rb.com/sex-free.html تعارف جنسي للبالغين http://sex.66rb.net/sex.htm المكتبه الجنسيه http://www.groups-goole.l7n6rb.com/sex-free.html صور جنس عربيه http://sex.66rb.net/sex.htm بعيدا عن الجنس http://www.groups-goole.l7n6rb.com/sex-free.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
sex sex sex أكبر موقع سكس عربي sex sex sex أكبر موقع سكس عربي خليجي
sex sex sex أكبر موقع سكس عربي sex sex sex أكبر موقع سكس عربي خليجي عروض افلام الأن بالمجاتي http://www.groups-goole.l7n6rb.com/sex-free.html أكبر موقع جنسي عربي افلام مجانيه 100% http://sex.66rb.net/sex.htm http://www.l7n6rb.com أكبر المواقع الجنسيه http://www.66rb.net/e3lan/e3lan.html زواج مسيار http://msear.zw2j.com تعارف بنات , اميلات بنات http://t3arf.zw2j.com sex sex sex أكبر موقع سكس عربي sex sex sex شهيرات عاريات وفضائح http://sex.66rb.net/sex.htm صور نيك وشرمطه http://66rb.net صور وأشرطه جنس أجنبيه http://www.groups-goole.l7n6rb.com/sex-free.html تعارف جنسي للبالغين http://sex.66rb.net/sex.htm المكتبه الجنسيه http://www.groups-goole.l7n6rb.com/sex-free.html صور جنس عربيه http://sex.66rb.net/sex.htm بعيدا عن الجنس http://www.groups-goole.l7n6rb.com/sex-free.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to speed up objects saving
You have two options: 1. Execute raw SQL 'INSERT' queries 2. Override the Model.save() or create new save_fast() method in your Model class. The main speed eaters in Model.save() are dispatcher.send() calls - so if you copy/paste the content of save method from Django code without dispatcher.send() lines you'll get a reasonable speed increase. --Ivan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Newbie sqlite3 dbshell confusion
On Jan 31, 10:38 am, Jeff Anderson <[EMAIL PROTECTED]> wrote: > My personal recommendation is to remove 0.96 and > use django-svn. Ok, I did that. Or tried to do that, anyway. 1. Removed 0.96.1. 2. did: svn co http://code.djangoproject.com/svn/django/trunk/ django- trunk 3. did: sudo ln -s /django-trunk/django /usr/lib/python2.5/site- packages/django 4. did: sudo ln -s /django-trunk/django/bin/django-admin.py /usr/local/ bin 5. started python interpreter 6, typed: import django got error message: ImportError: No module named django I also noticed that svn put django-trunk under my home directory - that's not where 0.96.1 was installed by the package manager. And the django symlinks in site-packages and /usr/local/bin say they are broken. So where did I go wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on MacOS X Leopard
On Feb 1, 9:25 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > On Feb 1, 5:47 pm, omat <[EMAIL PROTECTED]> wrote: > > > I am using the built-in Python that ships with Leopard. Unfortunately > > I don't know what created the extra site-packages under /System/ > > Library/.../lib/python2.5/ > > I don't think that's quite right - the /System/Library/etc/etc version > seems to be the real Python install (I've got it, and I did a clean > install of Leopard), but it gives you a /Library/Python/2.5/site- > packages/ directory as a convenience. There aren't any other Python > files in that directory - it's not actually a Python install. If you > check your default python sys.path, you'll see that both locations are > present. > > It's caused a little bit of difficulty - running CherryPy setup > install, for instance, put all its *.py files in the /Library/Python > site-packages, and everything else in the Frameworks folder. Very odd. > But otherwise just using /Library/Python/2.5/site-packages should work > fine. I have checked three Leopard boxes I have access to, all done by fresh installs. None of then have a site-packages for Python 2.5 that is shipped with OS under the /System/Library/Frameworks/Python.framework directory. $ cd /System/Library/Frameworks/Python.framework/Versions/Current/lib/ python2.5 $ ls -las site* 32 -rw-r--r-- 1 root wheel 16283 10 Oct 13:42 site.pyc 32 -rw-r--r-- 1 root wheel 16283 10 Oct 13:42 site.pyo The only site-packages that sys.path references is that under /Library/ Python/2.5. $ python Python 2.5.1 (r251:54863, Oct 9 2007, 20:39:46) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> 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'] Except for one system, no additional Python packages have been installed. Even the one where only virtualenv was installed still didn't have the extra site-packages directory. So, something must be going on for you. Do any of the .pth files in /Library/Python/2.5/site-packages have a reference to the other site-packages directory, indicating perhaps that some third party package is what has created the extra site- packages directory and added a reference to it so it gets added to sys.path. Graham --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: How to attach multiple images to a blog post?
Just for the record: http://code.djangoproject.com/ticket/2413 http://code.djangoproject.com/ticket/2534 http://code.djangoproject.com/ticket/3297 On Jan 31, 6:23 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > I'm trying to write simple blog tool but I ran into some problems. I > would like to attach multiple images to a post. Here's my models: > > class Entry(models.Model): > title = models.CharField(max_length=200) > date = models.DateTimeField(auto_now=True) > body = models.TextField() > > class Photo(models.Model): > entry = models.ForeignKey(Entry, edit_inline=models.TABULAR, > num_in_admin=10) > photo = models.ImageField(upload_to='photos/%Y/%m/%d', core=True, > blank=True) > > Now, when I create very new Entry via admin, I can add 10 images, ok. > So I add some. Then, when I would like to add another ones or to > change the ones already in, it goes wild: all the pictures are deleted > and it is not even possible to add anything. Please, any help? > > I read somewhere that perhaps edit_inline is broken or something, is > there another way how to attach multiple images to a post via admin? > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Image upload in user's directory
Thanks it worked.. :) On Feb 1, 2:15 pm, django_user <[EMAIL PROTECTED]> wrote: > Thanks Maciej, It should work. > > On Feb 1, 1:30 pm, Pigletto <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > I am using the following in my Image model: > > > file = models.ImageField(upload_to='/%y/%m/%d') > > > > I want every image to be uploaded in the users directory like '// > > > %y/%m/%d' instead of all files in default location. > > > > Is it possible ? > > > Try:http://www.djangosnippets.org/snippets/531/ > > > -- > > Maciej Wisniowski --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on MacOS X Leopard
On Feb 1, 5:47 pm, omat <[EMAIL PROTECTED]> wrote: > I am using the built-in Python that ships with Leopard. Unfortunately > I don't know what created the extra site-packages under /System/ > Library/.../lib/python2.5/ I don't think that's quite right - the /System/Library/etc/etc version seems to be the real Python install (I've got it, and I did a clean install of Leopard), but it gives you a /Library/Python/2.5/site- packages/ directory as a convenience. There aren't any other Python files in that directory - it's not actually a Python install. If you check your default python sys.path, you'll see that both locations are present. It's caused a little bit of difficulty - running CherryPy setup install, for instance, put all its *.py files in the /Library/Python site-packages, and everything else in the Frameworks folder. Very odd. But otherwise just using /Library/Python/2.5/site-packages should work fine. Eric --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 for display, not edit
I also have something similar: I created a bunch of display widgets (displaytextinput, displaytextarea, displayselect, displayselectmultiple etc.), which override the render method of their parents and created a subclass of forms.ModelForm for this, which has a display_only argument on the __init__. If that argument is made True, I replace the widgets on the fields with my custom ones. Pretty ugly, but works ok for now. In my case, I wanted all elements display_only or editable, but off course you could fine-tune this. Notice I am not using the form_for_model stuff anymore, since it will be deprecated soon. Koen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Persistent data (other than sessions)
> Is there anyway I can make g persistent? In other words, I want to > build it once, and then search that copy for each additional request. > If this thing doesn't change, then you could build it once and then stick it in a module-level variable. Something like: final_graph = None def graph_search(request): if not final_graph: final_graph = build_graph() result = search_graph(final_graph, some_parameters_from_request) return render_to_response('template.html',{'result': result}) Note that this is a *very* naive implementation - you'll need some locking around final_graph access to prevent race conditions. You might want to consider using a thread-local storage. You'll also need to unset this module-level variable (again with locking) if your underlying graph data changes. Cheers, Dan -- Dan Fairs <[EMAIL PROTECTED]> | http://www.stereoplex.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how to speed up objects saving
Hello, I have a problem: on my website I periodically need to transfer some data from a DB, to the Django DB of the website (I currently use MySQL) what i do in my view is to call some SQL queries on the "from" database, make some calculations and rearrangements on the data to transfer, then call several times the .save() method to store the data in the (django) destination database. this procedure takes a long time (about 40 minutes) on the server is there a way to speed up the insert process? I mean, in MySQL it is common practice to use long INSERT instructions to speed up the process, is there a way to do something similar in Django, rather than calling .save() thousands of times? Thanks, Alex -- View this message in context: http://www.nabble.com/how-to-speed-up-objects-saving-tp1555p1555.html Sent from the django-users mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Using a drop down list as widget for filter in admin
Hello there, The list_filter meta attribute lets you add filters in the admin interface. It's great, but the problem is that the field I'm filtering (a ForeignKey) has thousands of values, so I get thousands of links put in the right end side of the page. Is it possible to have a drop down list or something that compresses the space taken by that list of values? Thanks a lot! Julien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 for display, not edit
Carl Karsten wrote on 02/01/08 01:34: > newforms is great for creating forms. I need something similar to generate a > display form from a model. > > I looked at subclassing form, but what I would need to override is in the > widgets. which is probably why my hope isn't a good one. but for what I > need, > I only am using char fields, so I don't have to worry about widgets. > > So, is there some way to render a form as just text? > I've been using the following for something similar: class PlainText(forms.HiddenInput): def render(self, name, value, attrs=None): return u'%s%s' % (forms.HiddenInput.render(self, name, value, attrs), value) def myobject_formfield_callback(field, **kwargs): if field.name in ('hostname', 'ipaddress'): kwargs['widget'] = PlainText() return field.formfield(**kwargs) else: return field.formfield(**kwargs) def myview(request): myobject = get_object_from_somewhere() initial = myobject.__dict__ FormClass = forms.form_for_instance(myobject, formfield_callback=myobject_formfield_callback) form = FormClass(initial=initial) ... In my example I just want certain fields to show as text. If you want that for all of them change the formfield_callback to always change the widget. If you only want the plain value without a hidden field change the PlainText.render method accordingly. Works for me. hth Steven --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on MacOS X Leopard
I am using the built-in Python that ships with Leopard. Unfortunately I don't know what created the extra site-packages under /System/ Library/.../lib/python2.5/ I had some trouble with Eclipse-carbon installation, I removed it and installed EasyEclipse for python. Maybe this brought the duplicates in. On Feb 1, 12:36 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Feb 1, 2:05 am, omat <[EMAIL PROTECTED]> wrote: > > > When I install Django on Leopard, py files went into: > > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > > site-packages/django/ > > If you are running Python 2.5.1 that ships with Leopard,then the > directory: > > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ > python2.5/site-packages > > should not exist and Python will not look in there. > > > And template htmls, etc. went into: > > /Library/Python/2.5/site-packages/django/ > > Instead Python will look here in: > > /Library/Python/2.5/site-packages > > So, if you have a site-packages under: > > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ > python2.5 > > something has screwed up your installation. > > Did you create the site-packages directory in that location, or do you > know what created it? > > Graham > > > This resulted in some weird behavior such as templates of contrib > > applications such as admin not being located. > > > My patch for this was to create a symlink as follows: > > sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/ > > lib/python2.5/site-packages /Library/Python/2.5/site-packages > > > and then install Django. > > > Thought this may save some time for ones having this problem. > > > I would like to hear if there are any better approaches. > > > oMat --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: sudo under django or better solutions?
On 31 Jan 2008, at 5:27 pm, sandro dentella wrote: > i'd like to make an application that should execute commands with > permission that are not normally for www-data (eg: create user). Of > course > I know I could use sudo and execute the command via subprocess or > similar. But it happens that the command is a python script so i'd > prefer > to use the python library directly. > > Is there any reccomanded way/ a sudo-module or similar? > > thanks in advance > sandro > *:-) I generally think it's a bad idea for web apps to be able to run system commands. Another approach might be to save any data into the database that you need and then run a cronjob as a sudo privileged user to run the actual system jobs. This will obviously only work well if it's something that can be batched. Thanks, David -- David Reynolds [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: *Idea-Share* How to secure auth
Ravi Kumar wrote on 01/31/08 12:07: > On Jan 31, 2008 2:49 PM, Steven Armstrong <[EMAIL PROTECTED]> wrote: > >> Maybe something like this in your apache config? >> >> RedirectMatch permanent /(login|securepage) https://www.example.com/$1/ >> >> > One idea is to redirect user login to HTTPS in same django apps but in > different apache virtual than HTTP (80). This way two django instances would > be running, that is why I don't want to use that method. If you want http and https you will need two virtual hosts. There is no way around it. Maybe it's easier to just use https for everything. I often use the following config: ServerName www.example.com Redirect permanent / https://www.example.com/ ... django and other config here ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Image upload in user's directory
Thanks Maciej, It should work. On Feb 1, 1:30 pm, Pigletto <[EMAIL PROTECTED]> wrote: > > Hi, > > I am using the following in my Image model: > > file = models.ImageField(upload_to='/%y/%m/%d') > > > I want every image to be uploaded in the users directory like '// > > %y/%m/%d' instead of all files in default location. > > > Is it possible ? > > Try:http://www.djangosnippets.org/snippets/531/ > > -- > Maciej Wisniowski --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: SVN7049 - bug with development server ?
Jarek Zgoda a écrit : > I see this error frequently when using Firefox. Never saw this with > Opera, IE or Safari. I confirm it's with Firefox. I do not have this with konqueror. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Image upload in user's directory
> Hi, > I am using the following in my Image model: > file = models.ImageField(upload_to='/%y/%m/%d') > > I want every image to be uploaded in the users directory like '// > %y/%m/%d' instead of all files in default location. > > Is it possible ? Try: http://www.djangosnippets.org/snippets/531/ -- Maciej Wisniowski --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: url tag and reverse()
> Have you tried this: > (?Pjohndoe|janedoe) Strange, I had thought that wasn't working, but I guess it must be. So with that change this gets the right URL: reverse('entry', kwargs={'translatorName':'johndoe','entryName':'blogentry'}) But trying to use the entry view, which requires two arguments, simply gets a "Could not parse remainder of argument" for whatever comes after the first word, whether I use positional or named arguments. And still, neither of these produces anything: {% url translator translatorName=johndoe %} {% url translator johndoe %} URL is meant to be able to take multiple arguments, isn't it? Thanks for your help... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: SVN7049 - bug with development server ?
Nicolas Steinmetz napisał(a): > On my Debian Lenny box, with Python 2.5.1, I have the following error > the first time I generate a page. When I refresh the page, I have the > normal output (ie listing css, html, images files) > > > Traceback (most recent call last): >File > "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line > 278, in run self.finish_response() >File > "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line > 317, in finish_response self.write(data) >File > "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line > 396, in write self.send_headers() >File > "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line > 460, in send_headers in self.send_preamble() >File > "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line > 378, in send_preamble 'Date: %s\r\n' % http_date() >File "/usr/lib/python2.5/socket.py", line 262, in write self.flush() >File "/usr/lib/python2.5/socket.py", line 249, in flush > self._sock.sendall(buffer) > error: (32, 'Broken pipe') I see this error frequently when using Firefox. Never saw this with Opera, IE or Safari. -- Jarek Zgoda Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 "We read Knuth so you don't have to." (Tim Peters) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Image upload in user's directory
On Feb 1, 2008 12:57 AM, django_user <[EMAIL PROTECTED]> wrote: > I want every image to be uploaded in the users directory like '// > %y/%m/%d' instead of all files in default location. There is no built-in automatic solution for this. However, like many things which are not built-in or automatic, it is quite easy to write a view which accepts a user's file upload and places it wherever you like. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---