Re: Postgres LATIN1 to UTF-8

2010-11-07 Thread Christophe Pettus
On Nov 7, 2010, at 2:17 PM, Tim Sawyer wrote: > Does anyone have a recommended method for converting a Postgres database from > LATIN1 to UTF-8? Probably the most efficient way is to use pg_dump with the --encoding option: Dump the database in UTF8, and then import it back into a new database c

Re: grouping of fields inside a model into a class

2010-11-07 Thread Jani Tiainen
On Friday 05 November 2010 22:53:06 nitm wrote: > Hi, > > Is there a way to combine a set of fields I have in a model class into > a different class without it having it's own separate table? > An example: > > I want to implement the user profile model class, and in it I would > like to have the

Postgres LATIN1 to UTF-8

2010-11-07 Thread Tim Sawyer
Hi Folks, Does anyone have a recommended method for converting a Postgres database from LATIN1 to UTF-8? Am I best sticking to postgres tools or will dumpdata help? I already have accents in my LATIN1 data, and postgres doesn't like importing these back into a database with encoding utf8.

Re: Why INSERT instead of UPDATE?

2010-11-07 Thread cootetom
This is a tough one, everything looks okay. I would try removing the categories variable from your model class just to see if that is causing problems. By the way, you can get that categories list from an instance of the Course class in the following way c.coursecategories_set.all() presuming Cours

Suspicious Operation from session decoding

2010-11-07 Thread pjrhar...@gmail.com
Hi all, I've recently updated to svn trunk and I think the new HMAC changes are causing me an issue. I have a custom admin view that handles uploads from the YUI flash uploader. Unfortunately the flash applet doesn't send cookies with it, so in order to check authentication in the page javascript

Re: Why INSERT instead of UPDATE?

2010-11-07 Thread Torbjorn
Here is the model: class Course(models.Model): title = models.CharField(max_length=255) owner = models.ForeignKey(User) def __unicode__(self): return self.title def _getCategories(self): cc = CourseCategories.objects.filter(course=self) return cc cate

Re: Django inline formset gotcha

2010-11-07 Thread h3
Well .. nevermind. http://haineault.com/blog/142/ On Nov 6, 10:50 pm, h3 wrote: > I've been banging my head on this problem for many hours and nobody > came up with a > working solution .. > > I've tried so many things to work around this problem that I've > decided to write a blog > listing th

Re: help with django comments

2010-11-07 Thread Bobby Roberts
here's my complete code: {%if allowcomments%} {% get_comment_count for galleryview.GalleryPhoto picid as comment_count %} {%ifequal comment_count 0%} Be the first to comment.

LEFT JOIN with Django's QuerySet?

2010-11-07 Thread Alisue
Hi, I'm using ObjectPermission backend explained at `http:// djangoadvent.com/1.2/object-permissions/` and I create timeline model which save `content_type` and `object_id` for each object when the object is saved for making website update history timeline. what my problem is that how can i filter

Re: Why INSERT instead of UPDATE?

2010-11-07 Thread Marc Aymerich
On Sun, Nov 7, 2010 at 4:21 PM, Torbjorn wrote: > Hi, I want to update a record but somehow it becomes an INSERT > instead. This is my code: > > def editcourse(request, course_id): >    course= Course.objects.get(id=course_id) >    if request.method == 'POST': >        form = PartialCourseForm(req

Re: Displaying link in template based on m2m data

2010-11-07 Thread cootetom
Don't do it in the template layer! Why not get the list of events in the view layer, do the iterate there and mark which ones the current user is attending. Then you have the logic in python and he template layer is kept simple. On Nov 7, 2:34 am, Patrick Deuley wrote: > I've got a list of even

Re: Why INSERT instead of UPDATE?

2010-11-07 Thread cootetom
What does your PartialCourseForm class look like? The code you have there looks okay to me. On Nov 7, 3:21 pm, Torbjorn wrote: > Hi, I want to update a record but somehow it becomes an INSERT > instead. This is my code: > > def editcourse(request, course_id): >     course= Course.objects.get(id

Why INSERT instead of UPDATE?

2010-11-07 Thread Torbjorn
Hi, I want to update a record but somehow it becomes an INSERT instead. This is my code: def editcourse(request, course_id): course= Course.objects.get(id=course_id) if request.method == 'POST': form = PartialCourseForm(request.POST, instance=course) if form.is_valid():

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-07 Thread ringemup
Thank you for the pointer to ticket #11618, Stefan. At this point, I don't care if the workaround is ugly -- if it actually works, at least I'll be able to move forward with this project. I'll test it out and check back in to confirm whether it does. On Nov 7, 9:03 am, Stefan Foulis wrote: > A

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-07 Thread ringemup
Thank you, Michael, but I need to use multi-table rather than abstract inheritance in this instance, as the Place model already exists as a concrete model, and I'm adding the Restaurant model. Also, for database design reasons, I'd prefer to keep the tables separate. On Nov 6, 9:02 pm, Michael S

Re: help with django comments

2010-11-07 Thread Chris Lawlor
Assuming your app is named 'gallery' with a model named 'photo', I believe the call should be: {% get_comment_count for gallery.photo as comment_count %} On Nov 6, 5:12 pm, Bobby Roberts wrote: > howdy - > > i'm trying to use comments on my site as follows: > > {% get_comment_count for gallery

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-07 Thread Stefan Foulis
As far as I know there is no existing api to convert a 'Place' into a 'Restaurant' with multi-table inheritance in django. There is a ticket about this [1]. And in another ticket [2] that is marked as a duplicate but seems to have an example of how to solve this problem until there is a standard ap