Re: Related tags ala del.icio.us
Jay Parlar wrote: >I'm doing a personal app for myself that tracks academic papers I've >read. As is the style these days, I can apply multiple tags to each >paper. My basic model is this: > >class Tag(models.Model): >name = models.CharField(maxlength=200, core=True, unique=True) > >class Paper(models.Model): >title = models.CharField(maxlength=200) >tags = models.ManyToManyField(Tag) > > >What I'd like to be able to do is get "Related Tags" like they have in >del.icio.us, ie. for a given Tag, I need a reasonably efficient way to >find all the other tags that it's ever been used with. > > I would do something like this: def related_tags(tag_name): return Tag.objects.filter(paper__tag__name__exact=tag_name).exclude(name__exact=tag_name).distinct() Filter expression reads like "all tags that linked to any papers that linked to this tag". Exclude and distinct should be self-explanatory. Note that with this Tag architecture the search is constrained to only specific model (Paper in this case). If you have these same tags linked to another models you won't have them as "related". But this what one wants usually anyway. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Tagging app
Luke Plant wrote: >I've been writing some tagging functionality for my site, and I've >developed it in a way that is reusable and generic, similar in some >ways to the 'comments' app in contrib. > Seems that tags are hot in Django these days :-). Couple of days ago I've done my TagsField as a Django app (http://softwaremaniacs.org/soft/tags/). It's a bit different than yours and Ian's. Now I only need the time to translate the page in English :-) >Tag model >= >- The central model. A *simplified* version is below: > >class Tag(models.Model): >text = models.CharField() >target = GenericForeignKey() > > The single target means that one tag can't be used for different models? I have chosen a different approach in my app: tags are basically just text labels that are linked with models with ManyToMany. This allows to do some interesting things. For example in my music exchange service I have users with tags meaning their likings like "blues", "rock", "hard-rock" so one can easily search both albums and artists with these same tags. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Tagging app
Hi Luke, Please do so. Tagging is, buzzword or not, pretty useful and many people have / will implement it on their own (I was mid way through just now). It would be great to leverage on your code, and I think it would benefit django users in general, as it could make more applications pluggable / easily distributable with tagging working. thanks, arthur ps: how is the GenericForeignKey going to work? will it be imported from the tagging app's package, or will it go into trunk? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Authentication by email+pass
Op wo, 24-05-2006 te 23:51 -0700, schreef Rudolph: > One of my customers also wants this. One thing I thought of is making > the e-mailadress case insensitive; only storing lowercase e-mailaddress > and lowercase the user input address when loggin in. Remember that the part to the left of the "@" in an e-mail address is not defined in the RFCs to be case-insensitive (even if every mail server I know treats it as case-insensitive, there might be exceptions). -- Jan Claeys --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)
> Ok. So if work, what reason you have for ditch it for Apache? There were really four reasons I moved from IIS to Apache: 1) Virtual hosting: although you _can_ do virtual hosting on IIS, you really need IIS6 on Win2k3 to support the host header fields. The default IIS on XP Pro doesn't allow this and I wanted my dev and prod environments to behave the same way. Apache's virtual hosting support is a head and shoulders above IIS, in my opinion. 2) Performance: while I don't have specific numbers at hand, the IIS configuration (of Django and the MoinMoin wiki) always felt a little sluggish for what should have been snappy apps. I tried them out under Apache2 and they felt much more responsive. I can't really say if I was using IIS in the best way, but I did the quick-and-dirty setup in both IIS and Apache2 and Apache seemed faster. I especially notice this when I haven't accessed a page in a while. It seems that IIS takes a while to "warm up" but once it does its not bad. Apache seems to always be pretty fast. 3) Consistency: I like that my configuration on Windows and Linux is very similar now. And I've even been thinking of buying a Mac so that becomes even more important. 4) Community/documentation: once I decided to start using Python, MySQL and now Django, I find it a lot easier to find information on the web for using Apache with those technologies. Its sort of the "go with the grain" mentality. I didn't want to run into the very kinds of problems you are now - where its hard to find good examples of how to use the various technologies you have chosen. I used to be a C#/ASP.NET guy so I have used IIS quite a bit. Its not bad, and I haven't had the problems with security that other note - at least not in any of the more recent versions of Windows and IIS. But I just find for the development platform I've chose, Apache is a better fit than IIS. That's all. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Slicing [-1] on objects.all()
Op do, 25-05-2006 te 11:28 -0400, schreef Ian Maurer: > Django's QuerySet handles slicing through the LIMIT and OFFSET clauses > of the database. Since the clauses cannot handle python's "negative > indexing" scheme, you have 2 choices: [...] > 2. Use an order_by method to set the reverse order and then get the > first item, use a minus sign to denote DESC order: > >Foo.objects.order_by("-column")[0] > > The second option is FAR superior. The first solution is, IMO, totally > unacceptable since it retrieves all of the records just to access one > row. Quick thought: can't the QuerySet do that itself then? -- Jan Claeys --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: New Django manage.py bugs
i've saw too that manage.py syncdb create tables out of order, disobeying the foreign keys, many to many tables, etc... On 5/25/06, Siah <[EMAIL PROTECTED]> wrote: > > Thanks for the response adrian. > > Somehow I felt the result of Alter Table is not as efficient as > properly creating the table in the first place. If I'm incorrect, that > I think I am, your suggestion is actually very good and should make my > life more efficient. > > I guess if I go with above, I don't have to cry over 'init' again, and > thanks for the quick tutorial on install django_apps. > > In terms of broken pieces. My sqlall worked fine right now, but my > sqlclear generates something like this: > ... > ALTER TABLE "ss_accountinfo" DROP CONSTRAINT > "bill_address_id_referencing_ss_address_id"; > ... > > that gives me this error: > > ERROR: constraint "bill_address_id_referencing_ss_address_id" does not > exist > > Thanks, > Sia > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Related tags ala del.icio.us
I'm doing a personal app for myself that tracks academic papers I've read. As is the style these days, I can apply multiple tags to each paper. My basic model is this: class Tag(models.Model): name = models.CharField(maxlength=200, core=True, unique=True) class Paper(models.Model): title = models.CharField(maxlength=200) tags = models.ManyToManyField(Tag) What I'd like to be able to do is get "Related Tags" like they have in del.icio.us, ie. for a given Tag, I need a reasonably efficient way to find all the other tags that it's ever been used with. I've done very little SQL in my career, so I'm not even sure of the best way to do this with raw SQL. Any thoughts? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Tagging app
Luke, I'm definitely interested, since I've been thinking about doing this very thing. Regards, -scott On Fri, 2006-05-26 at 00:57 +0100, Luke Plant wrote: > Hi all, > > I've been writing some tagging functionality for my site, and I've > developed it in a way that is reusable and generic, similar in some > ways to the 'comments' app in contrib. Would anyone be interested in > me tidying it up for release as a Django app? It would require a > little bit of tidying up (mainly fixing Python 2.3 incompatibilities), > and if popular, it could do with a bit of community input. I'd be > happy to release it under a BSD license. > > Below is an overview of what is included. > > Tag model > = > - The central model. A *simplified* version is below: > > class Tag(models.Model): > text = models.CharField() > target = GenericForeignKey() > creator = GenericForeignKey() > added = models.DateTimeField() > > GenericForeignKey works like a foreign key field except that it is > identified by two pieces of information - an 'id' (stored as a string > for maximum generality), and a ContentType id. (The model actually > requires other parameters and other fields to be present, not shown). > For the most part, however, you can ignore this implementation detail. > Externally, you just set/get mytag.target or mytag.creator to any > Django ORM object and it will work. > > Tag objects also have other methods to do efficient SQL queries for > summarising Tag information. e.g. .count_tagged_by_others() returns > the number of other 'creator' objects that have tagged the same object, > and there are other methods on the TagManager for doing this kind of > thing (see below). > > If you want, you can have different types of object that are taggable, > so: > > [t.target for t in Tag.objects.all()] > > could be a heterogeneous list. In templates that show lists of Tag > objects in detail, this could be a problem, since you don't know what > type of object mytag.target is, and you might want to customise how you > display a tagged target object. So I've added a 'render_target' method > which is pluggable i.e. you can provide different ways of rendering > different types of target objects, and then just use tag.render_target > in the template. > > (You could also have different types of 'creator' object, but in my case > I haven't used this, so haven't tested it much, but I'm not aware of > any problems). > > Tag Manager > === > The Manager class for Tag has various methods to return database > information about tagged objects. It uses efficient SQL to do so, > which means that most of them can't build up queries the way you > normally do in Django, but instead the methods provide optional > parameters that should cover most of the kind of queries you want to > do, including searching for objects that are tagged with multiple text > values. > > The methods tend to return either simple values, or 'partially > aggregated' versions of the Tag object: > > TagSummary > -- > Contains 'text' and 'count', where count is the number of Tag objects > with that 'text' value. > > TagTarget > - > The 'text' + 'target' half of a 'Tag' object, used for answering the > question: "What objects are the target of a certain 'text' value (or > values) and how many 'creator' objects have tagged it like that?" > > The tag manager methods also work correctly in a 'related' context (see > below). > > Tag relationships > = > A Tag is essentially two foreign key fields (plus metadata), but since > it isn't actually a ForeignKey object, and can point to multiple > models, it doesn't appear on the 'pointed to' models automatically (e.g. > as in mypost.tags.all() or myuser.created_tags.all()). However, you can > set this up with the add_tagging_fields() utility method, which allows > you add attributes to models with complete flexibility. You don't > define the tags as part of your model, but use this utility method > after creating the model to add the attributes. > > This has been done like this mainly for ease of implementation, but it > also keeps your model decoupled from 'tagging' -- after you've defined > your model, or imported someone else's, you can add tagging fields very > easily. > > In this related context, you also get methods that parallel normal > foreign keys i.e. mypost.tags.create() and mypost.tags.add(), which > work as expected. > > Finally, the Tag Manager methods for advanced queries also work > correctly in the 'related' context e.g. > mypost.tags.get_distinct_text() limits itself to the relevant Tag > objects. > > Views > = > A simple tagging facility will allow users to tag objects, and then > display those tags inline on the object that is tagged (e.g. a post or > a topic etc). To enable this, a 'create_update' view is provide, with > a sample template -- a del.icio.us style form for
Re: Tagging app
just as an aside, I've also written a similar tagging app, which covers about 70% of the same functionality as Luke's personally I'd love a 'standard' tagging app in contrib which combines the best of both worlds, as it seems like this functionality is what most users: a) want b) struggle with implementing, as the stuff to implement it isn't the most obvious. the main differences as I see them between the 2 different implementations is: - the concept of 'creator' ( I use 'User', while Luke isn't limited by this) - object-id .. ( I use int's, Luke uses strings) (my code is here: http://svn.zyons.python-hosting.com/trunk/zilbo/ common/tag/ for reference.. and is BSD/ASL licensed) On 26/05/2006, at 9:57 AM, Luke Plant wrote: > > Hi all, > > I've been writing some tagging functionality for my site, and I've > developed it in a way that is reusable and generic, similar in some > ways to the 'comments' app in contrib. Would anyone be interested in > me tidying it up for release as a Django app? It would require a > little bit of tidying up (mainly fixing Python 2.3 incompatibilities), > and if popular, it could do with a bit of community input. I'd be > happy to release it under a BSD license. > > Below is an overview of what is included. > > Tag model > = > - The central model. A *simplified* version is below: > > class Tag(models.Model): > text = models.CharField() > target = GenericForeignKey() > creator = GenericForeignKey() > added = models.DateTimeField() > > GenericForeignKey works like a foreign key field except that it is > identified by two pieces of information - an 'id' (stored as a string > for maximum generality), and a ContentType id. (The model actually > requires other parameters and other fields to be present, not shown). > For the most part, however, you can ignore this implementation detail. > Externally, you just set/get mytag.target or mytag.creator to any > Django ORM object and it will work. > > Tag objects also have other methods to do efficient SQL queries for > summarising Tag information. e.g. .count_tagged_by_others() returns > the number of other 'creator' objects that have tagged the same > object, > and there are other methods on the TagManager for doing this kind of > thing (see below). > > If you want, you can have different types of object that are taggable, > so: > > [t.target for t in Tag.objects.all()] > > could be a heterogeneous list. In templates that show lists of Tag > objects in detail, this could be a problem, since you don't know what > type of object mytag.target is, and you might want to customise how > you > display a tagged target object. So I've added a 'render_target' method > which is pluggable i.e. you can provide different ways of rendering > different types of target objects, and then just use tag.render_target > in the template. > > (You could also have different types of 'creator' object, but in my > case > I haven't used this, so haven't tested it much, but I'm not aware of > any problems). > > Tag Manager > === > The Manager class for Tag has various methods to return database > information about tagged objects. It uses efficient SQL to do so, > which means that most of them can't build up queries the way you > normally do in Django, but instead the methods provide optional > parameters that should cover most of the kind of queries you want to > do, including searching for objects that are tagged with multiple text > values. > > The methods tend to return either simple values, or 'partially > aggregated' versions of the Tag object: > > TagSummary > -- > Contains 'text' and 'count', where count is the number of Tag objects > with that 'text' value. > > TagTarget > - > The 'text' + 'target' half of a 'Tag' object, used for answering the > question: "What objects are the target of a certain 'text' value (or > values) and how many 'creator' objects have tagged it like that?" > > The tag manager methods also work correctly in a 'related' context > (see > below). > > Tag relationships > = > A Tag is essentially two foreign key fields (plus metadata), but since > it isn't actually a ForeignKey object, and can point to multiple > models, it doesn't appear on the 'pointed to' models automatically > (e.g. > as in mypost.tags.all() or myuser.created_tags.all()). However, you > can > set this up with the add_tagging_fields() utility method, which allows > you add attributes to models with complete flexibility. You don't > define the tags as part of your model, but use this utility method > after creating the model to add the attributes. > > This has been done like this mainly for ease of implementation, but it > also keeps your model decoupled from 'tagging' -- after you've defined > your model, or imported someone else's, you can add tagging fields > very > easily. > > In this related context, you also get methods that parallel normal > foreign keys i.e.
Tagging app
Hi all, I've been writing some tagging functionality for my site, and I've developed it in a way that is reusable and generic, similar in some ways to the 'comments' app in contrib. Would anyone be interested in me tidying it up for release as a Django app? It would require a little bit of tidying up (mainly fixing Python 2.3 incompatibilities), and if popular, it could do with a bit of community input. I'd be happy to release it under a BSD license. Below is an overview of what is included. Tag model = - The central model. A *simplified* version is below: class Tag(models.Model): text = models.CharField() target = GenericForeignKey() creator = GenericForeignKey() added = models.DateTimeField() GenericForeignKey works like a foreign key field except that it is identified by two pieces of information - an 'id' (stored as a string for maximum generality), and a ContentType id. (The model actually requires other parameters and other fields to be present, not shown). For the most part, however, you can ignore this implementation detail. Externally, you just set/get mytag.target or mytag.creator to any Django ORM object and it will work. Tag objects also have other methods to do efficient SQL queries for summarising Tag information. e.g. .count_tagged_by_others() returns the number of other 'creator' objects that have tagged the same object, and there are other methods on the TagManager for doing this kind of thing (see below). If you want, you can have different types of object that are taggable, so: [t.target for t in Tag.objects.all()] could be a heterogeneous list. In templates that show lists of Tag objects in detail, this could be a problem, since you don't know what type of object mytag.target is, and you might want to customise how you display a tagged target object. So I've added a 'render_target' method which is pluggable i.e. you can provide different ways of rendering different types of target objects, and then just use tag.render_target in the template. (You could also have different types of 'creator' object, but in my case I haven't used this, so haven't tested it much, but I'm not aware of any problems). Tag Manager === The Manager class for Tag has various methods to return database information about tagged objects. It uses efficient SQL to do so, which means that most of them can't build up queries the way you normally do in Django, but instead the methods provide optional parameters that should cover most of the kind of queries you want to do, including searching for objects that are tagged with multiple text values. The methods tend to return either simple values, or 'partially aggregated' versions of the Tag object: TagSummary -- Contains 'text' and 'count', where count is the number of Tag objects with that 'text' value. TagTarget - The 'text' + 'target' half of a 'Tag' object, used for answering the question: "What objects are the target of a certain 'text' value (or values) and how many 'creator' objects have tagged it like that?" The tag manager methods also work correctly in a 'related' context (see below). Tag relationships = A Tag is essentially two foreign key fields (plus metadata), but since it isn't actually a ForeignKey object, and can point to multiple models, it doesn't appear on the 'pointed to' models automatically (e.g. as in mypost.tags.all() or myuser.created_tags.all()). However, you can set this up with the add_tagging_fields() utility method, which allows you add attributes to models with complete flexibility. You don't define the tags as part of your model, but use this utility method after creating the model to add the attributes. This has been done like this mainly for ease of implementation, but it also keeps your model decoupled from 'tagging' -- after you've defined your model, or imported someone else's, you can add tagging fields very easily. In this related context, you also get methods that parallel normal foreign keys i.e. mypost.tags.create() and mypost.tags.add(), which work as expected. Finally, the Tag Manager methods for advanced queries also work correctly in the 'related' context e.g. mypost.tags.get_distinct_text() limits itself to the relevant Tag objects. Views = A simple tagging facility will allow users to tag objects, and then display those tags inline on the object that is tagged (e.g. a post or a topic etc). To enable this, a 'create_update' view is provide, with a sample template -- a del.icio.us style form for editing tags for an item. A more complete solution will involve the ability to browse/search tags, view recent tags etc. For this, I've written a 'recent_popular' view, that shows recent tags, optionally limiting to a specific target or 'text' value etc, with paging, and shows a list of popular tags (limited by the same query). Finally, there is 'targets_for_text' which
Re: New Django manage.py bugs
Thanks for the response adrian. Somehow I felt the result of Alter Table is not as efficient as properly creating the table in the first place. If I'm incorrect, that I think I am, your suggestion is actually very good and should make my life more efficient. I guess if I go with above, I don't have to cry over 'init' again, and thanks for the quick tutorial on install django_apps. In terms of broken pieces. My sqlall worked fine right now, but my sqlclear generates something like this: ... ALTER TABLE "ss_accountinfo" DROP CONSTRAINT "bill_address_id_referencing_ss_address_id"; ... that gives me this error: ERROR: constraint "bill_address_id_referencing_ss_address_id" does not exist Thanks, Sia --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)
Ok. So if work, what reason you have for ditch it for Apache? For this hosting setup, I don't have problems in the security or performance arena... but maybe because is the main plataform for python/django? I'm more worry about crash or glacial performance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)
> Speaking from experience of setting up IIS and within 3 minutes of it being on the net with the latest updates it being backdoored and viruses roaming free That is YOUR experience. My web server never have that kind of troubles. I have my small developer company with Windows 2003 and I expose my svn, and other 3/4 internal websites. I don't have problems with viruses or hacking and run well all this time. I know that windows by default can be more insecure. But that is not my experience and that is not the point. The point is: Is possible run well django/python under IIS, yes or not? > All eggs, one basket? Sounds like a good way to run a business there. The other option is try another basket I DON'T KNOW and lets see. I don't know why the rude acctitude... I'm a former Windows Developer for 7 years and found a compelling reason to try python and put it for my company. I'm risking because a)My experience in python is 1 month 2)My experience in django is 2 weeks? I'm triying to lowe the risk. And if is not possible, I'm willing to try linux... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)
I should have clarified: I use Apache2 on Windows (and Linux for that matter). As Ian pointed out, Apache2 is multi-threaded and works very well on both Linux and Windows. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)
On 26/05/2006, at 7:15 AM, Jeremy Dunck wrote: Note that if you are stuck on Windows, Apache + mod_python + MySQL + Django works very well. Doesn't pre-forking apache on windows scale badly due to window's high process startup cost? I guess it'd depend how often you recycle your httpd processes... Apache2 hasn't pre-forked on windows for years, it uses threads inside a single process,and is about as fast (or faster.. it was close) as the version running on linux last time I checked. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)
On 5/25/06, DavidA <[EMAIL PROTECTED]> wrote: > > I've used Python with IIS for the MoinMoin wiki (where do they get > these names?). They speak German. > Note that if you are stuck on Windows, Apache + mod_python + MySQL + > Django works very well. Doesn't pre-forking apache on windows scale badly due to window's high process startup cost? I guess it'd depend how often you recycle your httpd processes... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)
I've used Python with IIS for the MoinMoin wiki (where do they get these names?). They have a good doc on configuring IIS for Python: http://moinmoin.wikiwikiweb.de/HelpOnInstalling/InternetInformationServer#head-890abdbd0d21bf874ce794be87067abf433a51d7 I've done it. It works fine. And then I woke up and installed Apache and turned off the IIS service. Note that if you are stuck on Windows, Apache + mod_python + MySQL + Django works very well. I run that at work and do a lot of my personal Django development on that and then just "svn up" and "service httpd restart" on my Linux box to roll out changes. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: variable
On May 25, 2006, at 12:59 PM, Mary Adel wrote: > how could i get a variable from the database in the views > > for example i have a model like this: > class Menu (models.Model): > menu_text=models.TextField(maxlength=200) > > and i need to get this variable from the database under certain > condition > for example when menu_text ='test' then write it in file You want something like:: Menu.objects.filter(menu_text="test") This is covered in the first tutorial (http://www.djangoproject.com/ documentation/tutorial1/), and in depth in the DB-API doc (http:// www.djangoproject.com/documentation/tutorial1/). Jacob --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
New Django manage.py bugs
I am 7 months into coding a large django application. Due to needing extra bytea fields with my database, I started maintaining my own SQL instead of django-admin install app. Everytime I made changes to my model, I would take django-admin sqlall app and apply those changes. Its been a few days I've been trying to upgrade my django from 9.1 to 9.2. My biggest problem so far is how broken sqlall and sqlclear are. sqlall generates sql with tables out of order, thus my postgresql cannot create constraints. And sqlclear generates non-working sql. Furthermore, I needed django-admin init that would create initial tables before I manually add my own tables. Please give it back to me. What could make my day would be if there was a way for me to supply an alternate 'sql' for the CREATION of that specific model. It would save me a lot of time not going through my gizilioon tables everytime I made a change. Thanks, Sia --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: FYI: Primitive Python Version of GWT Working
Good work. Sia --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Foreign keys in views
Hi all, I've written (well copied) the following view. In my model I have a defined an attribute "station = models.ForeignKey(Station)". Now, if I call the change view, the station is selected. However, if I submit the change view with some errors, the station is de-selected in the new view. I've also written a create view that is given a station id on creation an pre-populates the interface. Here I found that the foreign key's id comes in as new_data["station"] but has to go out as new_data["station_id"]. Is that correct and do the generic views stuff like that under the hood? Form fields for many-to-many relations work as expected, so maybe I'm doing something wrong with the foreign key fields.Any hints are - as always - welcomechrisdef change_recording(request, recording_id): try: manipulator = Recording.ChangeManipulator(recording_id) except: raise Http404 recording = manipulator.original_object errors = {} new_data = {} if request.POST: new_data = request.POST.copy() errors = manipulator.get_validation_errors(new_data) if not errors: manipulator.do_html2python(new_data) new_recording = manipulator.save(new_data) return HttpResponseRedirect("/dwasrod/") else: new_data = recording.__dict__ form = FormWrapper(manipulator, new_data, errors) return render_to_response('aufnahmen/recording_form.html', {'form': form}) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
variable
how could i get a variable from the database in the views for example i have a model like this: class Menu (models.Model): menu_text=models.TextField(maxlength=200) and i need to get this variable from the database under certain condition for example when menu_text ='test' then write it in file Thanks Mary --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
views
i need your help in the following : how to write in the views a function that has a loop and this loop gets one field from my database so that i can take each field and put it in a file Thanks, Mary --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Admin, display related 'last modified' field
On Thursday 25 May 2006 10:34, Joseph Kocherhans wrote: > On 5/25/06, Eric Walstad <[EMAIL PROTECTED]> wrote: > > Yes, I suspect this is more than a one-off issue. I'd also like to see > > the last modified timestamp on the Project's related ProjectFiles. Can > > you point me to documentation on how to whip up a new admin widget and > > direct the admin code to use it for particular fields? Is this a 'use > > the source, Luke' instance? > > Yeah it is. :( You'll want to start out by looking at > django/contrib/admin/templates/widget > Also, FieldWidgetNode is where the template name get's determined... I > think. It seems like it might just be a MyModel -> > widgets/my_model.html conversion, but I don't remember for sure. > > Joseph Cool, thanks for the leads, Joseph. I'll see what I can do. 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 -~--~~~~--~~--~--~---
Re: Admin, display related 'last modified' field
On 5/25/06, Eric Walstad <[EMAIL PROTECTED]> wrote: > > Yes, I suspect this is more than a one-off issue. I'd also like to see the > last modified timestamp on the Project's related ProjectFiles. Can you point > me to documentation on how to whip up a new admin widget and direct the admin > code to use it for particular fields? Is this a 'use the source, Luke' > instance? Yeah it is. :( You'll want to start out by looking at django/contrib/admin/templates/widget Also, FieldWidgetNode is where the template name get's determined... I think. It seems like it might just be a MyModel -> widgets/my_model.html conversion, but I don't remember for sure. Joseph --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Django AJAX Framework
I've started this as SoC project, however is hasn't passed so I'm publising the sources, maybe you'll find them useful. I've uses Json as the transport layer. You will need Json-py library (http://sourceforge.net/projects/json-py/). To make server-side code you need to make a new django view: from django.http import HttpResponse from cmh.apps.rpc.minjson import write as JsonWrite import re def rpc(request): if ('module' in request.GET) and ('function' in request.GET): rx = re.compile('^[a-z]+$') if rx.match(request.GET['module']): try: rpc_fn = getattr(__import__('testproject.%s.rpc'%request.GET['module'], '', '', ['']), request.GET['function']) except ImportError, e: return HttpResponse('module not found') return HttpResponse(JsonWrite(rpc_fn(request))) else: return HttpResponse('bad module name') else: return HttpResponse('bad module') This request accepts only module names from small latin chars, you need to change regular expression ('^[a-z]+$') if you have other module names. RPC functions are stored at modules' directories in files rpc.py. You need to change 'testproject.%s.rpc' so that it point to your module's rpc file, e.g. my CMS uses 'cmh.apps.%s.rpc' (all my modules are stored in apps folder). The client-side is handled by MochiKit. // Point to your rpc view var baseURL = "http://localhost:8000/rpc/"; function processRPC(req) { json = evalJSONRequest(req); for(var i in json) { switch(json[i].action) { case "replace": var element = getElement(json[i].id); element.innerHTML = json[i].value; break; // handle additional operations like add_before, add_after, hide, show, etc. } } } function doRPC(mod, func, method, s_get, s_post) { var d; var req = getXMLHttpRequest(); if (req.overrideMimeType) { req.overrideMimeType("text/plain"); } if(method == "GET") { req.open("GET", baseURL + "?module=" + mod + "&function=" + func + s_get, true); d = sendXMLHttpRequest(req).addCallback(processRPC); } else { req.open("POST", baseURL + "?module=" + mod + "&function=" + func + s_get, true); d = sendXMLHttpRequest(req, s_post).addCallback(processRPC); } return d; } sample usage: GET POST here's how you handle this call (testproject/rpc/rpc.py): def test(args): action1 = { 'action': 'replace', 'id': 'footer', 'value': 'footer changed ;)' } action2 = { 'action': 'replace', 'id': 'content-related', 'value': 'some more modifications' } return [action1, action2] Maybe this code doesn't look a django-way, but I'm still working on it. -- Sincerely, Vladimir "Farcaller" Pouzanov http://www.hackndev.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 -~--~~~~--~~--~--~---
Re: Admin, display related 'last modified' field
On Thursday 25 May 2006 09:50, Joseph Kocherhans wrote: > On 5/25/06, Eric Walstad <[EMAIL PROTECTED]> wrote: > > My 'Projects' admin form has 'Notes'. Notes have a non-user-editable > > 'note date' DateTimeField. I haven't been able to figure out how to get > > the note date to get displayed in the admin interface in such a way that > > it's visible but not editable. Any ideas? > > I assume you mean on the edit form since doing this in the change list > if straightforward. I've done this a few times by overriding the > appropriate change_form.html template. It's probably your best bet for > now. You also might try creating a custom field and a new admin widget > template if this is more than a one off type of thing. > > Joseph Hi Joseph, Yes, I'm talking about the edit form. Yes, I suspect this is more than a one-off issue. I'd also like to see the last modified timestamp on the Project's related ProjectFiles. Can you point me to documentation on how to whip up a new admin widget and direct the admin code to use it for particular fields? Is this a 'use the source, Luke' instance? Thanks, 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 -~--~~~~--~~--~--~---
Re: Admin, display related 'last modified' field
On 5/25/06, Eric Walstad <[EMAIL PROTECTED]> wrote: > > My 'Projects' admin form has 'Notes'. Notes have a non-user-editable 'note > date' DateTimeField. I haven't been able to figure out how to get the note > date to get displayed in the admin interface in such a way that it's visible > but not editable. Any ideas? I assume you mean on the edit form since doing this in the change list if straightforward. I've done this a few times by overriding the appropriate change_form.html template. It's probably your best bet for now. You also might try creating a custom field and a new admin widget template if this is more than a one off type of thing. Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Admin, display related 'last modified' field
Hi all, My 'Projects' admin form has 'Notes'. Notes have a non-user-editable 'note date' DateTimeField. I haven't been able to figure out how to get the note date to get displayed in the admin interface in such a way that it's visible but not editable. Any ideas? Thanks in advance. Below is the model stuff. Eric. class Project(models.Model): client = models.ForeignKey(Contact, db_column='contacts_id', related_name='contact') job_number = models.CharField(maxlength=20) ... class Meta: db_table = 'projects' ordering = ['-job_number', 'status'] class Admin: list_display = ('job_number', 'name', 'assigned_to', 'status', 'due_date', 'address', 'client',) search_fields = ['job_number', 'client', 'name',] list_filter = ['status', 'project_type'] date_hierarchy = 'last_modified' fields = ( (None, {'fields': ('job_number','assigned_to','status','project_date','due_date','client','bid_price','name','address','city','state','zip','project_type','last_modified',)}), ) class ProjectNote(models.Model): notes = models.TextField("Note", core=True) note_date = models.DateTimeField(default=models.LazyDate(), blank=True, editable=False) project = models.ForeignKey(Project, db_column='projects_id', edit_inline=models.TABULAR, num_in_admin=3) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: 'str' object has no attribute 'write'
mary wrote: >i wrote this view >def index(request): >output=open( '/var/www/xml-python/xmleditor/test.xml','w') >output.write('') >output.write('') >latest_menu_list = Menu.objects.all().order_by('-id') >output = ', '.join([m.menu_text for m in latest_menu_list]) >output.write(output) > > > >return HttpResponse(output) > > After fixing what others have pointed you will probably have a next problem with empty output in a browser. You're passing your "output" object to HttpResponse while output's position is at its end. You should move to the beginning: output.seek(0) return HttpResponse(output) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Slicing [-1] on objects.all()
On 5/25/06, Ian Maurer <[EMAIL PROTECTED]> wrote: > > Django's QuerySet handles slicing through the LIMIT and OFFSET clauses > of the database. Since the clauses cannot handle python's "negative > indexing" scheme, you have 2 choices: > > 1. Do the actual evaluation, by converting to a list and then doing your > slice: > >list(Foo.objects.all())[-1] > > 2. Use an order_by method to set the reverse order and then get the > first item, use a minus sign to denote DESC order: > >Foo.objects.order_by("-column")[0] > > The second option is FAR superior. The first solution is, IMO, totally > unacceptable since it retrieves all of the records just to access one > row. > > For more information about the amazing Django QuerySets, check out this link: > > http://www.djangoproject.com/documentation/db_api/ > > This section discusses slicing specifically: > > http://www.djangoproject.com/documentation/db_api/#limiting-querysets > Perfect, the 'order_by' worked beautifully! Maybe a note should go into the db_api docs about -1 not working? I did look at those docs before sending my original message, and didn't see anything about that. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Unhappy, reinventing
On 25/05/06, Paul Smith <[EMAIL PROTECTED]> wrote: > > > On May 24, 2006, at 9:33 PM, Elver Loho wrote: > > > > > I used to code stuff with TurboGears, which started sucking rather > > fast. I still liked their templating engine, Kid. Sort of. I've also > > tried Zope 3's and Django's, a couple of homegrown ones, Interchange's > > as used on our big webstore and a bunch of others. As far as I'm > > concerned, they all have fundamental design flaws. > > > > > Elver, > The promise of being able to plug in different templating is one of > the things that drew my interest in Django, but Django's templates > started to grow on me. I'd say maybe give 'em a little time to learn > to live with Django's templates. Indeed, it's common to think that something looks 'ugly' or 'unclean' before getting used to it. > However, I saw a presentation by a fellow named Chris McDonough at > this year's Plone symposium on his templating system called meld3. > Although it doesn't look entirely prime-time, it's closer to the > patterns/ideas you described in your article. Cool ideas in there. > Take a look: > > http://www.plope.com/software/meld3 > > > > > --P > > -- > Paul Smith > [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 -~--~~~~--~~--~--~---
Re: Searching on a calculated value
Adrian Holovaty wrote: > You're best off searching by the exact fields rather than messing with > derived fields. Would you offer some insight please? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Slicing [-1] on objects.all()
Django's QuerySet handles slicing through the LIMIT and OFFSET clauses of the database. Since the clauses cannot handle python's "negative indexing" scheme, you have 2 choices: 1. Do the actual evaluation, by converting to a list and then doing your slice: list(Foo.objects.all())[-1] 2. Use an order_by method to set the reverse order and then get the first item, use a minus sign to denote DESC order: Foo.objects.order_by("-column")[0] The second option is FAR superior. The first solution is, IMO, totally unacceptable since it retrieves all of the records just to access one row. For more information about the amazing Django QuerySets, check out this link: http://www.djangoproject.com/documentation/db_api/ This section discusses slicing specifically: http://www.djangoproject.com/documentation/db_api/#limiting-querysets Hope that helps, ian On 5/25/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > I'm seeing some strange slicing behaviour (using sqlite3 and the dev server). > > All I want to do is grab the last element in the table, so I'm trying this: > > Foo.objects.all()[-1] > > When I do that in a shell (via manage.py shell) it works fine, and > respects my 'ordering' Meta. However, when my application is actually > running, that same line will ALWAYS return the first row in the table, > not the last one. > > Am I missing something here? > > Jay P. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: 'str' object has no attribute 'write' Exception
Mary, In your code you have assigned output to be a string. So output as a string would cease to have the operation write on it. so change the last two lines of your code to be tempOutput = ', '.join([m.menu_text for m in latest_menu_list]) output.write(tempOutput) I hope that this helps cheers Darren Mary Adel wrote: > dear all > > i have this error:Request Method: > > GET Request URL: http://127.0.0.1:8000/xmlmenu/ > Exception Type: AttributeError Exception Value: 'str' object has no > attribute 'write' Exception > Location: /var/www/xml-python/xmleditor/../xmleditor/menues/views.py in > index, line 14 > > when i wrote this view: > > def index(request): > output=open( '/var/www/xml-python/xmleditor/test.xml','w') > output.write('') > output.write('') > latest_menu_list = Menu.objects.all().order_by('-id') > output = ', '.join([m.menu_text for m in latest_menu_list]) > output.write(output) > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: 'str' object has no attribute 'write'
mary wrote: > and i got this error > 'str' object has no attribute 'write' ... > output = ', '.join([m.menu_text for m in latest_menu_list]) > output.write(output) In the first line there, you're setting "output" (which used to be a file object) to a string, and then in the next line you're trying to call the "write" method again (which would work if it were still a file object, but it's not anymore). Do you instead mean this: output.write(', '.join([m.menu_text for m in latest_menu_list])) or even: menulist = ', '.join([m.menu_text for m in latest_menu_list]) output.write(menulist) Either of those two should work. -joh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: 'str' object has no attribute 'write'
On 5/25/06, mary <[EMAIL PROTECTED]> wrote: > > i wrote this view > def index(request): > output=open( '/var/www/xml-python/xmleditor/test.xml','w') > output.write('') > output.write('') > latest_menu_list = Menu.objects.all().order_by('-id') > output = ', '.join([m.menu_text for m in latest_menu_list]) > output.write(output) > > > > return HttpResponse(output) > > and i got this error > 'str' object has no attribute 'write' > > > can anyone help please > > Thanks, > Mary > > When you do this: output = ', '.join([m.menu_text for m in latest_menu_list]) you rebound the name 'output' to a string, it no longer references your file descriptor. Try this: output_str = ', '.join([m.menu_text for m in latest_menu_list]) output.write(output_str) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
'str' object has no attribute 'write' Exception
dear all i have this error:Request Method: GET Request URL: http://127.0.0.1:8000/xmlmenu/ Exception Type: AttributeError Exception Value: 'str' object has no attribute 'write' Exception Location: /var/www/xml-python/xmleditor/../xmleditor/menues/views.py in index, line 14 when i wrote this view: def index(request): output=open( '/var/www/xml-python/xmleditor/test.xml','w') output.write('') output.write('') latest_menu_list = Menu.objects.all().order_by('-id') output = ', '.join([m.menu_text for m in latest_menu_list]) output.write(output) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Searching on a calculated value
On 5/25/06, Gary Wilson <[EMAIL PROTECTED]> wrote: > Yes, I would like to provide my users with a single search box where > they could enter a first name, a last name, or a first name and last > name. So maybe... > > if one word entered: > search in last name OR first name > elif two words entered: > search in (last name AND first name) OR (first name AND last name) > elif more than two words entered: > ignore words in between first and last and treat as two words > entered That's precisely what I'd recommend -- and it's not very difficult to implement, unless you want to let your users put phrases in double quotes, which can be a pain to parse. Adrian -- Adrian Holovaty holovaty.com | djangoproject.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 -~--~~~~--~~--~--~---
Re: Unhappy, reinventing
On May 24, 2006, at 9:33 PM, Elver Loho wrote: > > I used to code stuff with TurboGears, which started sucking rather > fast. I still liked their templating engine, Kid. Sort of. I've also > tried Zope 3's and Django's, a couple of homegrown ones, Interchange's > as used on our big webstore and a bunch of others. As far as I'm > concerned, they all have fundamental design flaws. > Elver, The promise of being able to plug in different templating is one of the things that drew my interest in Django, but Django's templates started to grow on me. I'd say maybe give 'em a little time to learn to live with Django's templates. However, I saw a presentation by a fellow named Chris McDonough at this year's Plone symposium on his templating system called meld3. Although it doesn't look entirely prime-time, it's closer to the patterns/ideas you described in your article. Cool ideas in there. Take a look: http://www.plope.com/software/meld3 --P -- Paul Smith [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 -~--~~~~--~~--~--~---
'str' object has no attribute 'write'
i wrote this view def index(request): output=open( '/var/www/xml-python/xmleditor/test.xml','w') output.write('') output.write('') latest_menu_list = Menu.objects.all().order_by('-id') output = ', '.join([m.menu_text for m in latest_menu_list]) output.write(output) return HttpResponse(output) and i got this error 'str' object has no attribute 'write' can anyone help please Thanks, Mary --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Slicing [-1] on objects.all()
I'm seeing some strange slicing behaviour (using sqlite3 and the dev server). All I want to do is grab the last element in the table, so I'm trying this: Foo.objects.all()[-1] When I do that in a shell (via manage.py shell) it works fine, and respects my 'ordering' Meta. However, when my application is actually running, that same line will ALWAYS return the first row in the table, not the last one. Am I missing something here? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: unescaped html in admin column
On 5/25/06, qhfgva <[EMAIL PROTECTED]> wrote: > > In order to fit more columns of data on the screen in the admin, I > tried the following: > > # for use in list_display > def combined_cols(self): > return '%s%s%s' % (self.col1, self.col2,sel.col3) > > Which displayed the '' in the output. > > Is there some way to prevent the output from being html escaped in this > case? Or is there some other way to format columns in a more condensed > form? Yep. Set an allow_tags attribute on your method to True. def combined_cols(self): return '%s%s%s' % (self.col1, self.col2,sel.col3) combined_cols.allow_tags = True Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django memory leak?
On 5/25/06, Christian Schneider <[EMAIL PROTECTED]> wrote: > And > sorry for any confusion, I don't have 30 processes the output of ps was for > one process taken every 5 seconds to show the increase in memory usage. Sorry I'm an idiot. The PID was clearly the same. :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
unescaped html in admin column
In order to fit more columns of data on the screen in the admin, I tried the following: # for use in list_display def combined_cols(self): return '%s%s%s' % (self.col1, self.col2,sel.col3) Which displayed the '' in the output. Is there some way to prevent the output from being html escaped in this case? Or is there some other way to format columns in a more condensed form? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django memory leak?
Malcolm,thanks a lot! That really hit it.I definitely don't need DEBUG to be True because I never knew about it in the first place. Now my memory usage stays nicely constant.I already saw me re-writing the server to use hand-rolled SQL ... chris --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
installing process
HI TEAM I am new userI have some question like i have shared hosting with cpanel for controling the web space i dont have shell access , well i like to know how i can find pythom is installed or not well which file should i download to upload via ftp ? to my web space ANY SUGGESTION --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Unhappy, reinventing
Elver Loho wrote: > http://elver.cellosoft.com/2006/05/24/acceptable-use-of-programming-in-templates/ The XML in Python trick is somewhat similar to how Django's syndication (RSS/Atom) framework works, and it is great for such structured XML documents. On the other hand, HTML is a weird thing and not something that I'd want to build with the DOM approach. -- --Max Battcher-- http://www.worldmaker.net/ "I'm gonna win, trust in me / I have come to save this world / and in the end I'll get the grrrl!" --Machinae Supremacy, Hero (Promo Track) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)
On Wed, May 24, 2006 at 07:18:06PM -, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I know... > > I have the option to get Linux as a fallback. Shouldn't ever be a fallback, it should be the primary choice - unless you're fond of having your webserver compromised... (speaking from experience of setting up IIS and within 3 minutes of it being on the net with the latest updates it being backdoored and viruses roaming free...) > The reason? I have everything now under this package, the databases, > the sites, the expertise. I have almost zero experience in run linux > and configure this... All eggs, one basket? Sounds like a good way to run a business there. > Anyway, despite the fact if I go to Linux or not, I think that persue > the option of easy to run under IIS can help python/django in the > exposure side of the things... Not at the expense of doing more useful things, like finishing off for the 1.0 release! > Take in account that if something is under IIS is because run also > ASP/ASP.NET and have some investiment here... Or because the space is going cheap because no one else wants to touch it with a barge pole... > Add another web server is hard to sell... Really? I've not noticed that, but the I'm a single user and have 3 web servers in different places. Thanks, Brett. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Authentication by email+pass
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 problems - foreign keys into the User table are using the primary key id so thats not a problem. B --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Authentication by email+pass
Hi, One of my customers also wants this. One thing I thought of is making the e-mailadress case insensitive; only storing lowercase e-mailaddress and lowercase the user input address when loggin in. Another thing when not really using the username field is to fill it with an as long as possible random value (substring of SHA of e-mailadress for example). Rudolph --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---