Re: Download counter?

2006-09-18 Thread spacedman
frank wrote: > Sure, I could create a download button for each > item, but that would be an extra step for the user. 'It would be nice' > if that weren't necessary. > BTW the downloads are static files, served by Apache. That extra > button > is looking more and more likely... At some point

Re: Download counter?

2006-09-19 Thread spacedman
Malcolm Tredinnick wrote: > The minor problem with that approach is that it means people can avoid > the Django counter and directly fetch the URL. So if counting is a > requirement, that solution needs an extra tweak to ensure that you have > first visited the counter page. This can be done wit

Re: sharing session information with plone

2006-10-02 Thread spacedman
ashwoods wrote: > does anybody have experience of sharing session information from a > plone site. I want our intranet users that are authenticaded in plone > to be able to access django without having to relog. Haven't done this directly, but what you'd have to do is get the __ac cookie that p

Re: Saving arbitrary data without database

2006-10-24 Thread spacedman
This sounds like you want to use my 'single row database' trickery pokery: http://groups.google.com/group/django-developers/browse_frm/thread/2caa976249783fae/# Just create a Django model 'Properties' with your 'threshold' as one field, then access it just like a normal Django model. The databas

Re: Best way to administer static configuration data?

2006-12-06 Thread spacedman
[EMAIL PROTECTED] wrote: > I could create a model and then only have one row, but that seems > clunky. I did exactly this and overrode the .save() method so that the model was constrained to only have one row by resetting self.id to 1 in the .save() (I think...). Effect was that if you added a

Re: Best way to administer static configuration data?

2006-12-06 Thread spacedman
Ah, and you also have to override the .delete() method! http://groups.google.com/group/django-developers/browse_frm/thread/2caa976249783fae/# --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: Singleton model instance

2006-12-07 Thread spacedman
My slightly graceless method is to override .save and .delete: http://groups.google.com/group/django-developers/browse_frm/thread/2caa976249783fae/# Then whatever model you define, it can only ever have one row (well, it will have zero rows before you put anything it). Barry --~--~-~-

Re: a simple django CMS anyone?

2007-01-13 Thread spacedman
ashwoods wrote: a simple open and free CMS would be good for a lot of people, specially the newcomers. the problem is how to design a CMS that doesn't limit the freedom you learn to love when you choose to use django over some cms. Someone looks like they tried to start a project like this,

Re: Admin Functionality Enhancement

2006-05-07 Thread spacedman
I've had a few thoughts on this: 1. on the main admin page, just list the names of the apps and not the db tables as well. 2. clicking an app takes you to a per-app admin page, by default it would just be the one pretty blue-headed box for the app. 3. then it would be easy to have a custom per-

Authentication by email+pass

2006-05-24 Thread spacedman
I dont want my users to have to bother with a username. I want them to authenticate with their email as their username. But django wont allow valid @ signs (and other stuff) in a username. I could patch that but that could bite me badly. So I found a better way. First I create a manipulator: fro

Re: Authentication by email+pass

2006-05-25 Thread spacedman
This is to avoid duplicate usernames? My idea is to call them all userXXX where XXX is the id value (the primary key in the User table). Another thought that came to me yesterday was whether there are any issues if a user wants to change his or her email address. I don't think it causes any probl

Re: How to automatically generate a password input field

2006-05-27 Thread spacedman
just use PasswordField() in your model. Might be a recent introduction. Its literally a two-liner in django.forms: class PasswordField(TextField): input_type = "password" http://code.djangoproject.com/browser/django/trunk/django/forms/__init__.py Barry --~--~-~--~

Re: Django and daemon?

2006-05-30 Thread spacedman
Wouldn't it be better to setup 'procmail' to process incoming emails as they arrive. Then your procmail script could update the database. As long as you are using a decent database server (*cough*POSTGRES*cough*) then concurrency shouldnt be a problem. --~--~-~--~~~--

Re: users editing only their own info

2006-05-30 Thread spacedman
Ground up would be my way of doing it. Lets break it down... You need an 'update' view that only shows the fields you want changing. That means a custom manipulator that only mentions the fields you want to modify. Protect this view by making sure the logged-in user is the user mentioned in the U

Re: Django and daemon?

2006-05-31 Thread spacedman
DavidA wrote: > An alternative that stays inside Django is to setup a trigger in cron > (or NT's Task Scheduler) that gets a URL every few minutes and the view > code for that URL does the email processing you mention. You avoid > creating a true daemon/service just by "waking" up periodically a

Re: Using AJAX to deal with slow views

2006-06-02 Thread spacedman
Jay Parlar wrote: > The thing is, I'm not sure how to fit that into Django. Currently, my > view function just blocks on the generation/compilation. To do this > with AJAX, it feels like I'd have to spawn a thread from Django to do > the processing, and let the view return immediately. But when

Re: Problems interating through arrays passed through render to response

2006-06-08 Thread spacedman
fyleow wrote: > keyword = books.objects.get(headline__icontains=keyword) I would then split/reshape this list into a list of (keyword, list_of_books) tuples, so you have a structure like this: keywordsearch = [('python', [,]), ('coding',[,])] then in the template you loop "for kwmatch in

Re: Generating models from a class diagram

2006-06-13 Thread spacedman
I'd rather go the other way - generate a class diagram from django model source! If you generate model code from a diagram you'll probably still have to edit the source to add new methods or tweak verbose_names, or add Admin meta classes, so then if you change the model you will lose all those ch

Re: Recursive delete problem

2006-06-19 Thread spacedman
Viktor wrote: > But when I delete a round, with round.delete(), all games conected with > that round are also deleted, but the Score table isn't updated, that is, > the delete method from the game objects is not called?!?! Looking at the code I see that when an objects is .delete()d all the rel

Re: Recursive delete problem

2006-06-19 Thread spacedman
Indeed! Perhaps nobody thought anyone would ever override the delete() method... I'm not sure why the strategy is to gather together all the related objects and then do the SQL rather than call the delete() method on each of them. Perhaps its more efficient. Perhaps it avoids possible loops where

Re: Template to Render Unknown Number of Arguments

2006-06-22 Thread spacedman
> On Thu, 2006-06-22 at 12:47 +, Paul Childs wrote: > > I have tried a number of ways of doing this but can't come up with a > > solution. I don't think pre-processing the data will help since the > > template still doesn't know how many keys there will be. Changing the > > structure of the

Re: session management

2006-08-10 Thread spacedman
Well, you could encode the information that is normally transferred in the cookie by adding a parameter to the URL all the time, so that your URLs are always something like: /foo/bar/info?session_id=0873556323 BUT if anyone gets that URL they get that person's session. Which is a BAD thing. So d

Re: session management

2006-08-10 Thread spacedman
ihomestore wrote: > A simple case would be: once users login, if we do not keep track of > user session, how do we know it is the same user once he / she diverts > to other pages (we do not want to ask user to login for every new page > s/he visits). Okay, so duplicating the functionality of d

Re: Google-like API keys

2006-08-11 Thread spacedman
Felix Ingram wrote: > Well that's true but 128 bits still gives you 3 x 10^38 possible > strings, so you could probably give everyone on the planet a key an > still not have a collision. Understatement of the week! The human population is currently about 6.5x10^9. You could give every teaspoon

Re: imbricated tags

2006-08-12 Thread spacedman
[EMAIL PROTECTED] wrote: > I just tried two loops "for" imbricated, it does'nt seems to work. Imbricated? That's a new one on me. I just looked it up and it means overlapping like roof tiles, edge over edge, which makes me think of two for loops like this: for i = 1 to 10 for j = 1 to 10 print

Re: How to build a tree on the page?

2006-08-16 Thread spacedman
一首诗 wrote: > I have a table like this > > id | name | parentid > > And parentid is a Foreign Key to ID. > > So I have a tree in my database. My question is that, how can I > represent it on the web as a tree. If you can rework your database slightly you can use Modified Preorder Tree Traversal

Re: django <-> cms like typo3

2006-08-17 Thread spacedman
Someone is working on a Django CMS: http://groups.google.com/group/dynamite-developers?lnk=li but there's no code available yet... Barry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: extract keywords from model

2006-08-21 Thread spacedman
[EMAIL PROTECTED] wrote: > suppose i have a model with 2 keywords like > > class Test(models.Model): >result_id = models.IntegerField(maxlength=10) > lab_id = models.IntegerField(maxlength=10) > > is there a method to extract all the keywords from this class. > So in this example i

Re: extract keywords from model

2006-08-22 Thread spacedman
[EMAIL PROTECTED] wrote: > thanks, > > that worked > > richard Ah, now I see my confusion. What you wanted was the 'field names', not 'keywords', and you said: [result_id,lab_id] when you really meant ['result_id','lab_id']. Barry --~--~-~--~~~---~--~~ You rec

Re: Dynamic Menus...

2006-08-25 Thread spacedman
And (obviously?) dont rely on the correct make and model coming back from your form. You'll eventually get someone constructing their own POST data for a laugh and seeing what happens if they had selected Renault Impala... :) --~--~-~--~~~---~--~~ You received thi

Re: How about a Django apps public repository?

2006-09-07 Thread spacedman
Sean Schertell wrote: > Am I alone on this? If I created such a repository would anyone use it? Why not just use SourceForge[1] as repository and just keep a list of django-related projects on the django main site? Barry [1] Or similar. --~--~-~--~~~---~--~~

Re: Mac vs. PC for Django work.

2006-09-14 Thread spacedman
I use Windows at home for video and audio editing, and getting Django things to work on there can be annying at times - its usually file paths to python, and things like #!/bin/env and all that, and whether you run from cygwin or DOS shell. Aaargh, the horror. I wrote my poker blog at home on Wind

Re: Forking a new process

2006-04-28 Thread spacedman
I did something like this in perl using HTML::Mason. However I used 'system' to start the background process, and files for communication... Its an on-demand backup system. The HTML::Mason code creates a temp file and then uses 'system' to run the backup job, passing the filename. The backup then