How to simulate recursive inlines in admin?

2008-09-22 Thread Petar Marić
Hi everybody,

I'm creating a Django based web application for my Master thesis and I've got
a hard problem. This is my model (greatly simplified):

class Questionnaire(models.Model):
title = models.CharField()
description = models.TextField()
created_by = models.ForeignKey(User, editable=False)

class Question(models.Model):
title = models.CharField()
questionnaire = models.ForeignKey(Questionnaire)
position = PositionField(unique_for_field='questionnaire')

class Answer(models.Model):
title = models.CharField()
question = models.ForeignKey(Question)
position = PositionField(unique_for_field='question')

I'm using the admin app for creating Questionnaires and I'd like to let users
edit questions and answers in the same form. AFAIK recursive inlines aren't
supported in Django (a hard problem by itself) so the only other way I could
think of is to inject a TextArea form field inside of the QuestionInline and
then do the processing of it manually. Answers would then be separated by
newlines and the positions would be determined by the order of lines in the
TextArea.

The problem is I don't know how to inject the TextArea in the inline. I tried
many things from simple to complex - and the otherwise excellent documentation
doesn't give much help.

Thanks,
-- 
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*jabber: [EMAIL PROTECTED]
*web: http://www.petarmaric.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
-~--~~~~--~~--~--~---



DjangoCon video

2008-09-11 Thread Petar Marić
Hi everybody,

Unfortunately I was unable to participate on DjangoCon because of my
Master thesis. Will there be a video of some/all the talks?

Regards,
-- 
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*jabber: [EMAIL PROTECTED]
*web: http://www.petarmaric.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: auto_now_add bug with MySQL

2006-05-29 Thread Petar Marić
auto_now_add has been fixed in [3002]

Hurray for Luke ;)
-- 
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.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: auto_now_add bug with MySQL

2006-05-06 Thread Petar Marić
Fernando,

It looks it's my own fault I failed to mention I was adding a new
object via Djangos admin interface.

That means it's Djangos fault, not mine ;)
--
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.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
-~--~~~~--~~--~--~---



auto_now_add bug with MySQL

2006-05-05 Thread Petar Marić
class Paper(models.Model):
# ...
submited_on = models.DateField(
auto_now_add=True,
)
# ...

The above will spit out:
Exception Type: ValueError
Exception Value:year is out of range
Exception Location:
C:\Dev\Python24\lib\site-packages\MySQLdb\connections.py in
defaulterrorhandler, line 33

The saved value of submited_on for the corresponding Paper is
'-00-00' which is horribly wrong ;)

I'm using MySQL 4.1.12a-nt and freshly baked django svn copy
--
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.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: list_filter not working properly?

2006-05-05 Thread Petar Marić
Hi Malcolm,

If you wish I could give you Trac access to my code - just e-mail me.

Regards,
PS: I too am using the latest svn code (rev. 2847 at this moment)
--
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.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: list_filter not working properly?

2006-05-05 Thread Petar Marić
Anyone?

--
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.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
-~--~~~~--~~--~--~---



list_filter not working properly?

2006-05-04 Thread Petar Marić
Hi Djangonauts,

I've run into some weird problems with list_filter:

class User(models.Model):
core_user = models.OneToOneField(
DjangoUser, #django.auth.user
primary_key='True'
)
birthday = models.DateField()
city = models.ForeignKey("City")

def __repr__(self):
return self.core_user.username

class Admin:
list_display = ('core_user', 'birthday', 'city')
list_filter = ('birthday', 'city') #DJANGO BUG: DateField and
FK don't show a list_filter

class City(models.Model):
pass


Does anybody have an idea what's wrong with mine/djangos code?
--
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.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
-~--~~~~--~~--~--~---



[M-R] __repr__ or __str__?

2006-04-29 Thread Petar Marić
Looking through some recent changes I noticed that some M-R code uses
__repr__ and some new checkins use __str__

Is there anything we need to know?
--
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.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: Trac error on code.djangoproject.com

2006-04-20 Thread Petar Marić
Medic! :D

--
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.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: Changing filenames on an upload...

2006-03-13 Thread Petar Marić
Hi Tony,

You should look for rename_by_field() in
http://djangoutils.python-hosting.com/wiki/Utils

--
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.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
-~--~~~~--~~--~--~---



Has anybody been able to set up a django powered site on textdrive?

2005-11-06 Thread Petar Marić
Any experiences?

--
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*skype: petar_maric
*web: http://www.petarmaric.com/