Re: newforms: saving relations via intermediary table

2007-07-05 Thread va:patrick.kranzlmueller

solution:
user_extended_profile.userextendedprofilefavourites_set.all().delete()
before inserting the new related object works.

Am 05.07.2007 um 15:44 schrieb va:patrick.kranzlmueller:

>
> I´m having trouble using newforms with an intermediary table
> (although I´m not sure that my problem relates to newforms anyhow).
>
> models:
> class UserExtendedProfile(models.Model):
>   ...
> class UserExtendedProfileFavourites(models.Model):
>  userextendedprofile = models.ForeignKey(UserExtendedProfile,
> edit_inline=models.TABULAR, num_in_admin=5, max_num_in_admin=5,
> num_extra_on_change=1)
>  ...
>
> views:
> ...
> user_extended_profile.save()
> # set favourites
> user_extended_profile.userextendedprofilefavourites_set = [fav1,
> fav2, fav3]
>
> now, when saving the related favourites, the _old_ favourites are not
> deleted but the new ones are added.
> I thought it´s possible to update the favourites in a way that the
> old ones are deleted and the new ones are added. Am I wrong with my
> assumption or do I use the wrong code?
>
> thanks,
> patrick
>
>
>
>
>
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



newforms: saving relations via intermediary table

2007-07-05 Thread va:patrick.kranzlmueller

I´m having trouble using newforms with an intermediary table  
(although I´m not sure that my problem relates to newforms anyhow).

models:
class UserExtendedProfile(models.Model):
...
class UserExtendedProfileFavourites(models.Model):
 userextendedprofile = models.ForeignKey(UserExtendedProfile,  
edit_inline=models.TABULAR, num_in_admin=5, max_num_in_admin=5,  
num_extra_on_change=1)
 ...

views:
...
user_extended_profile.save()
# set favourites
user_extended_profile.userextendedprofilefavourites_set = [fav1,  
fav2, fav3]

now, when saving the related favourites, the _old_ favourites are not  
deleted but the new ones are added.
I thought it´s possible to update the favourites in a way that the  
old ones are deleted and the new ones are added. Am I wrong with my  
assumption or do I use the wrong code?

thanks,
patrick





--~--~-~--~~~---~--~~
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: Calling System Commands

2007-06-26 Thread va:patrick.kranzlmueller

sorry, didn´t read carefully enough.
the cookbook example refers to a template (not a view).

patrick

Am 26.06.2007 um 16:24 schrieb va:patrick.kranzlmueller:

>
> see:
> http://code.djangoproject.com/wiki/PyCallTag
>
> patrick
>
> Am 26.06.2007 um 16:22 schrieb Moses Ting:
>
>>
>> Does anyone know if it's possible to make a system command call  
>> from a
>> Django view?  For example, I'd like to make the following call
>> straight from Django.
>>
>> import os
>> os.system('echo Hello World')
>>
>> Thanks
>>
>>
>>>
>
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Calling System Commands

2007-06-26 Thread va:patrick.kranzlmueller

see:
http://code.djangoproject.com/wiki/PyCallTag

patrick

Am 26.06.2007 um 16:22 schrieb Moses Ting:

>
> Does anyone know if it's possible to make a system command call from a
> Django view?  For example, I'd like to make the following call
> straight from Django.
>
> import os
> os.system('echo Hello World')
>
> Thanks
>
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newforms, unicode and umlauts

2007-06-21 Thread va:patrick.kranzlmueller

the code below does not give a validation error when typing umlauts,  
but the umlauts are not saved to the database.

al_re = re.compile(r'^\w+$', re.UNICODE)

def clean_last_name(self):
 if 'last_name' in self.cleaned_data:
 if not al_re.search(self.cleaned_data['last_name']):
 raise forms.ValidationError('Error message.')
 return self.cleaned_data['last_name']

when doing "print self.cleaned_data" I´m getting this:
'last_name': u'M\xfcller',

how am I supposed to deal with umlautes when using newforms?
btw: all our data is utf-8

thanks,
patrick







--~--~-~--~~~---~--~~
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: strange template-rendering with \xef\xbb\xbf

2007-06-05 Thread va:patrick.kranzlmueller


Am 05.06.2007 um 16:38 schrieb Malcolm Tredinnick:

>
> On Tue, 2007-06-05 at 16:10 +0200, va:patrick.kranzlmueller wrote:
>> after doing a django-update yesterday, we have \xef\xbb\xbf at the
>> beginning of every rendered template which leads to strange display
>> errors in IE and older firefox-versions.
>>
>> I figured out that it´s a byte order mark (BOM), but I´m not sure how
>> to avoid it ...
>
> Nothing in Django has changed recently that would do that (it would  
> have
> had to be something in the template/ directory).
>
> How long since you last did a Django update?

I guess it´s been a month ...

>
> What else might have changed? It sounds like the template files are  
> now
> being loaded as UTF-16 data from disk. Is that possible? If so, you'll
> have to re-encode them yourself (or switch to using the unicode branch
> which handles different file encoding from output encoding).

this might be a stupid question, but how can I check the file- 
encoding using the shell?

thanks,
patrick


>
> Regards,
> Malcolm
>
>
>
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



strange template-rendering with \xef\xbb\xbf

2007-06-05 Thread va:patrick.kranzlmueller

after doing a django-update yesterday, we have \xef\xbb\xbf at the  
beginning of every rendered template which leads to strange display  
errors in IE and older firefox-versions.

I figured out that it´s a byte order mark (BOM), but I´m not sure how  
to avoid it ...

patrick
--~--~-~--~~~---~--~~
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: get objects in templates

2007-05-09 Thread va:patrick.kranzlmueller

just a guess.

for the first image:
{% for image in object.images.all.0 %}
...
and for the rest:
{% for image in object.images.all %}
{% if not forloop.first %}
...

note: what you described here (object.images.all) is not a foreignkey  
but a m2m-relationship.

patrick.

Am 09.05.2007 um 14:52 schrieb Alessandro Ronchi:

>
> I have an item in my model with one or more photos, linked by a  
> foreign key.
> I want to put in my template the first image at the head of the page,
> and the second in another place.
>
> The result i need is that:
> ixx
> ixx
> x
> iii
> iii
> iii
>
> where x is text and i is image
> and so on.
>
> I can't use the default
> {% for image in object.images.all  %}
>  %}{{image.get_image_url}}{% endfilter %}" />
> {% endfor %}
>
> because it gets all the images.
>
> Is it possible to select the first, the second and so on image of the
> list object.images.all ?
> -- 
> Alessandro Ronchi
> Skype: aronchi - Wengo: aleronchi
> http://www.alessandroronchi.net - Il mio sito personale
> http://www.soasi.com - Sviluppo Software e Sistemi Open Source
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: complex data retrieval?

2007-05-02 Thread va:patrick.kranzlmueller

here´s an example of how the page should look like:
http://www.skip.at/AT/kinoprogramm/abfrage/prog_film.php? 
blnr=1=0=3_tag=02.+05.=9315=Das 
+wilde+Leben

(we´re just redesigning that page using django)

patrick


Am 02.05.2007 um 17:47 schrieb [EMAIL PROTECTED]:

>
> Oops... that should have been
>
>   {{ screens.screening_date }}
>   {{ screens.screening_time }}
>
> Forgot the 's'.
>
> If this isn't quite what you mean...let me know... I may have
> misunderstood what you were looking for.
>
> On May 2, 11:44 am, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
>> You should be able to do something like this:
>>
>> {% for cinema in cinema_list %}
>>   {{ cinema }}
>>   {% for screens in cinema.cinemaprogram_set.all %}
>>   {{ screen.screening_date }}
>>   {{ screen.screening_time }}
>>   {% endfor %}
>>  {% endfor %}
>>
>> Go to this page:http://www.djangoproject.com/documentation/db-api/
>> and check out the one-to-many relationships, backward section.
>>
>> va:patrick.kranzlmueller wrote:
>>> I´m having 2 models:
>>
>>> class CinemaProgram(models.Model):
>>>  cinema = models.ForeignKey(Cinema)
>>>  movie = models.ForeignKey(Movie, raw_id_admin=True)
>>>  
>>
>>> class CinemaProgramDate(models.Model):
>>>  cinemaprogram = models.ForeignKey(CinemaProgram,
>>> edit_inline=models.TABULAR, num_in_admin=20, max_num_in_admin=200,
>>> num_extra_on_change=100)
>>>  screening_date = models.DateField('Screening Date', core=True)
>>>  screening_time = models.TimeField('Screening Time', core=True)
>>>  add_screen = models.CharField('Screen', maxlength=50,
>>> blank=True, null=True)
>>>  
>>
>>> for the template, I´d like to have something like this:
>>
>>> {% for cinema in cinema_list %}
>>>  {{ cinema }}
>>>  {% for screens in cinema %}
>>>  {{ screen }}
>>>  {% for screening_time in screens %}
>>>  {{ screening_time }}
>>>  {% endfor %}
>>>  {% endfor %}
>>> {% endfor %}
>>
>>> Now, my question is: how do I get/construct the dict for this  
>>> template?
>>
>>> Note: The output should be:
>>
>>> Movie XXX on Date YYY is shown in these Cinemas:
>>> Cinema 1
>>> Screen 1: 18:00 20:00 23:00
>>> Screen 2: 20:00
>>> Cinema 2
>>> Screen 1: 18:30
>>> Cinema 3
>>> Screen 1: 20:00
>>> Screen 4: 22:30
>>
>>> I don´t really know if I need a custom manager or a custom method or
>>> if I have to refactor my models.
>>
>>> any hints are really appreciated (I´ve been working on this one  
>>> for a
>>> couple of days and it´s getting frustrating ...).
>>
>>> so far, I´ve been using this one:
>>> movie_list = CinemaProgramDate.objects.filter
>>> (cinemaprogram__cinema__place_state__slug=state,  
>>> screening_date=date,
>>> cinemaprogram__movie=movie_id).select_related().order_by
>>> ('cinemas_cinema.name', 'add_screen')
>>
>>> with what I get here, I´m not able to do the template accordingly
>>> (because I´d need an {% ifnotchanged %} which doesn´t exist).
>>
>>> well, enough for now - I hope somebody has the time to help me with
>>> this.
>>
>>> Thanks,
>>> patrick
>
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: complex data retrieval?

2007-05-02 Thread va:patrick.kranzlmueller

I´m not quite sure about this.
how would you retrieve the "cinema_list" queryset?
moreover, your template misses one for-loop (the one for the screens/ 
auditoriums).

don´t know if this is helpful, but here´s what the template looks  
like currently (which is a mess):

 
 {% for object in object_list %}
 {% ifchanged object.cinemaprogram %}
 {% if not forloop.first %}{% endif %}
 
 
  
{{ object.cinemaprogram.cinema }},  
{{ object.cinemaprogram.cinema.place_state }}
 Andere Filme in diesem Kino
 
 {% endifchanged %}
 {% ifchanged object.add_screen %}
 {% if not forloop.first %}{% endif %}
 Saal {% if  
object.add_screen %}{{ object.add_screen }}{% else %}k.A.{% endif %}
 {% endifchanged %}
 {{ object.screening_time|time:"H:i" }}
 {% if forloop.last %}{% ifequal forloop.counter  
1 %}{% endifequal %}{% endif %}
 {% endfor %}
 

thanks,
patrick

Am 02.05.2007 um 17:47 schrieb [EMAIL PROTECTED]:

>
> Oops... that should have been
>
>   {{ screens.screening_date }}
>   {{ screens.screening_time }}
>
> Forgot the 's'.
>
> If this isn't quite what you mean...let me know... I may have
> misunderstood what you were looking for.
>
> On May 2, 11:44 am, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
>> You should be able to do something like this:
>>
>> {% for cinema in cinema_list %}
>>   {{ cinema }}
>>   {% for screens in cinema.cinemaprogram_set.all %}
>>   {{ screen.screening_date }}
>>   {{ screen.screening_time }}
>>   {% endfor %}
>>  {% endfor %}
>>
>> Go to this page:http://www.djangoproject.com/documentation/db-api/
>> and check out the one-to-many relationships, backward section.
>>
>> va:patrick.kranzlmueller wrote:
>>> I´m having 2 models:
>>
>>> class CinemaProgram(models.Model):
>>>  cinema = models.ForeignKey(Cinema)
>>>  movie = models.ForeignKey(Movie, raw_id_admin=True)
>>>  
>>
>>> class CinemaProgramDate(models.Model):
>>>  cinemaprogram = models.ForeignKey(CinemaProgram,
>>> edit_inline=models.TABULAR, num_in_admin=20, max_num_in_admin=200,
>>> num_extra_on_change=100)
>>>  screening_date = models.DateField('Screening Date', core=True)
>>>  screening_time = models.TimeField('Screening Time', core=True)
>>>  add_screen = models.CharField('Screen', maxlength=50,
>>> blank=True, null=True)
>>>  
>>
>>> for the template, I´d like to have something like this:
>>
>>> {% for cinema in cinema_list %}
>>>  {{ cinema }}
>>>  {% for screens in cinema %}
>>>  {{ screen }}
>>>  {% for screening_time in screens %}
>>>  {{ screening_time }}
>>>  {% endfor %}
>>>  {% endfor %}
>>> {% endfor %}
>>
>>> Now, my question is: how do I get/construct the dict for this  
>>> template?
>>
>>> Note: The output should be:
>>
>>> Movie XXX on Date YYY is shown in these Cinemas:
>>> Cinema 1
>>> Screen 1: 18:00 20:00 23:00
>>> Screen 2: 20:00
>>> Cinema 2
>>> Screen 1: 18:30
>>> Cinema 3
>>> Screen 1: 20:00
>>> Screen 4: 22:30
>>
>>> I don´t really know if I need a custom manager or a custom method or
>>> if I have to refactor my models.
>>
>>> any hints are really appreciated (I´ve been working on this one  
>>> for a
>>> couple of days and it´s getting frustrating ...).
>>
>>> so far, I´ve been using this one:
>>> movie_list = CinemaProgramDate.objects.filter
>>> (cinemaprogram__cinema__place_state__slug=state,  
>>> screening_date=date,
>>> cinemaprogram__movie=movie_id).select_related().order_by
>>> ('cinemas_cinema.name', 'add_screen')
>>
>>> with what I get here, I´m not able to do the template accordingly
>>> (because I´d need an {% ifnotchanged %} which doesn´t exist).
>>
>>> well, enough for now - I hope somebody has the time to help me with
>>> this.
>>
>>> Thanks,
>>> patrick
>
>
> >


--~--~-~--~~~---~--~~
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: direct_to_template, extra_context

2007-02-27 Thread va:patrick.kranzlmueller

from django.conf.urls.defaults import *

urlpatterns = patterns('',
  (r'^stars/', 'django.views.generic.simple.direct_to_template',  
{'template': 'site/stars/stars_overview.html'}, extra_context=  
{'category': 'stars', 'subcategory': 'none'}),
)

isn´t that supposed to work? did I miss something?

thanks,
patrick


Am 27.02.2007 um 17:36 schrieb Joseph Kocherhans:

>
> On 2/27/07, va:patrick.kranzlmueller <[EMAIL PROTECTED]>  
> wrote:
>>
>> why doesn´t this work?
>>   (r'^stars/', 'django.views.generic.simple.direct_to_template',
>> {'template': 'site/stars/stars_overview.html'}, extra_context=
>> {'category': 'stars', 'subcategory': 'none'}),
>>
>> the error is "invalid syntax".
>
> You'll need to show more of your surrounding code for us to be able to
> help you with this one. The problem in that particular snippet is the
> "extra_context=".
>
> Jospeh
>
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



direct_to_template, extra_context

2007-02-27 Thread va:patrick.kranzlmueller

why doesn´t this work?
  (r'^stars/', 'django.views.generic.simple.direct_to_template',  
{'template': 'site/stars/stars_overview.html'}, extra_context= 
{'category': 'stars', 'subcategory': 'none'}),

the error is "invalid syntax".

thanks,
patrick
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



podcast-feed

2007-02-20 Thread va:patrick.kranzlmueller

has anyone done a podcast-feed (iTunes) using django syndication?

I know that it´s possible by changing feedgenerator.py.
if somebody has already done it, it´d be great to share the code and/ 
or give some advice.

thanks,
patrick


--~--~-~--~~~---~--~~
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: per-view cache and CACHE_MIDDLEWARE_SECONDS

2007-01-18 Thread va:patrick.kranzlmueller


x = cache_page(x, 60 * 15)

that´s right, isn´t it?


Am 18.01.2007 um 17:35 schrieb Robert:



Did you specify the timeout ? in your cache_page decorator ?

--  
Robert



>



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



per-view cache and CACHE_MIDDLEWARE_SECONDS

2007-01-18 Thread va:patrick.kranzlmueller


I´m trying to use the per-view cache, but I get the error that  
CACHE_MIDDLEWARE_SECONDS is missing in settings.py:

Error was: 'Settings' object has no attribute 'CACHE_MIDDLEWARE_SECONDS'

why do I need this, I´m not using the middleware?

thanks,
patrick


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to hack admin interface?...and should I?

2006-12-14 Thread va:patrick.kranzlmueller


Am 14.12.2006 um 17:05 schrieb Daniel Kvasnicka jr.:

>
> Hi djangees,
> I'm a TurboGears user, I like CherryPy, Kid and so. I like Django as
> well and tried the tutorials.
> What I like about Django is (obviously) the auto-generated admin
> interface.
>
> However, what I need to know is how
> easy/difficult/deprecated/encouraged is to hack the auto-generated
> admin interface. I'm doing this app, where our customers login and  
> vote
> for features that we plan to implement in our services. And besides
> CRUD, I need to enable my boss to login and view a whole bunch of  
> stats
> about who voted for what and how is that particular guy important for
> us etc... So, my question is, how easy would it be to "add a page" to
> admin, that would have the same auth restrictions, same GUI but would
> only display bars and graphs generated from the DB? Or would you write
> an admin section from scratch in that case?

write custom views (or use generic views).
making your site _look_ like the admin is probably harder than  
writing the views.

adding a page to the admin is quite easy though:
just extend the index-template and link to your site ... and don´t  
forget to use
myview = staff_member_required(never_cache(myview))

patrick


>
> Right now I'm writing everything on my own in TurboGears. It's not  
> bad,
> since auth/auth management is pretty intuitive in TG, but it's kinda
> boring...
>
> Thanks for your opinions,
> Dan
>
>
> >


--~--~-~--~~~---~--~~
 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: offtopic: delete *.pyc from subversion

2006-11-29 Thread va:patrick.kranzlmueller

thanks.

Am 29.11.2006 um 17:51 schrieb Marcin Jurczuk:

>
> find . -name '*pyc' |xargs svn delete
> to delete them:
> find . -name '*pyc"|xargs rm -f
>
>
> >


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



offtopic: delete *.pyc from subversion

2006-11-29 Thread va:patrick.kranzlmueller

in my svn-repository, I´m having *.pyc-files.
question is: how do I get rid of these files?

global-ignores is set to *.pyc now (after initial import and some  
changes).

do I have to manually delete the pyc-files?

since my svn-repos is django-related I dare to ask.

thanks,
patrick
--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



seeking clarification: custom manipulator foreign key / many-to-many

2006-09-20 Thread va:patrick.kranzlmueller

for the last couple of hours, I´ve read all entries about custom  
manipulators but I´m still not able to get my stuff working.
I probably just don´t see what´s wrong anymore:

this is part of my MODEL:

class UserProfile(models.Model):
 music = models.ManyToManyField(Music, blank=True, null=True,  
related_name="music")
 


this is part of my CUSTOM MANIPULATOR:

class UserprofileManipulator(forms.Manipulator):
 def __init__(self):
 MUSIC_CHOICES = [(str(c.id), str(c)) for c in  
Music.objects.all()]
 self.fields = (
 forms.CheckboxSelectMultipleField(field_name="music",  
choices=MUSIC_CHOICES),
...
 )
 def save(self, data):
 temp = UserProfile(
...
 )
 temp.set_gadgets(data['gadgets'])
 temp.save()
#temp.gadgets = Gadgets.objects.filter(id__in=data.getlist('gadgets'))


in the VIEW:

manipulator = UserprofileManipulator()
user_profile_manipulator = UserProfile.ChangeManipulator 
(request.user.id)
user_profile = user_profile_manipulator.original_object
if request.POST:
new_data = request.POST.copy()
 errors = manipulator.get_validation_errors(new_data)
 if not errors:
manipulator.do_html2python(new_data)
 manipulator.save(new_data)
else:
errors = {}
 new_data = user_profile_manipulator.flatten_data()
...


PROBLEMS:
1. the m2m-relationship doesn´t get saved.
2. in the template i have to write {{ form.gadgets_id }} to output  
the checkboxes ... instead of {{ form.gadgets }}

thanks,
patrick









--~--~-~--~~~---~--~~
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: off-topic: why does it take so long for emails ...

2006-08-29 Thread va:patrick.kranzlmueller

I see. any chance to get me off the spam-list?

kenneth: I didn´t check that before. yesterday it was on the web  
interface immediately and I was waiting for the e-mail for about half  
an hour.

thanks,
patrick

Am 29.08.2006 um 05:14 schrieb Adrian Holovaty:

>
> On 8/28/06, patrickk <[EMAIL PROTECTED]> wrote:
>> when I send an email to the group, it takes about one hour for this
>> mail to show up on the list.
>> is that intended?
>
> Hi Patrick,
>
> Some django-users (and django-developers) messages are flagged
> automatically by Google Groups as potential spam. In that case, Google
> Groups e-mails the list admins for our confirmation that it's not
> spam. I think some of your messages may have gotten such false
> positives. In that case, the delay is just the time it takes for
> either Jacob or me to manually OK the message.
>
> 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
-~--~~~~--~~--~--~---



translating app-name

2006-08-03 Thread va:patrick.kranzlmueller

the language-code for my site is german, but the app-names and the  
models are english.
in the admin-interface, it´s no problem to have german names for the  
tables. but how can I change the names of my installed apps?

thanks,
patrick
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how to email a password

2006-07-18 Thread va:patrick.kranzlmueller

next problem with my user registration process:
how do I send the password to registered users after they confirmed  
their registration?

the process should look like this:
1. registration
2. email confirmation
3. account activation & email with username and password
4. now the user can log in

since the password is stored encrypted, I´m not sure how to send it.

patrick
--~--~-~--~~~---~--~~
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: FileBrowser Test Version

2006-07-11 Thread va:patrick.kranzlmueller

a new version of the filebrowser is available for download.

CHANGES:
001: You may define an initial directory for each FileBrowseField by  
adding a path to the help_text: Like "FileBrowser: /images/blog/" or  
"FileBrowser: /documents/pdf/".
002: Sorting algorithm also works with Python 2.3 now (thanks Archatas)
003: Additional slashes are only used for folders now

I still need to look at the breadcrumbs.

thanks for your feedback,
patrick


Am 11.07.2006 um 12:39 schrieb Archatas:

>
> Very nice, but there are some gotchas/bugs:
>
> 1. to make it work on Python 2.3, you need to change
> line 198 in views.py
> file_list.sort(cmp, lambda x: x[int(o)])
> to
> file_list.sort(lambda x, y: cmp(x[int(o)], y[int(o)]))
> (sort method takes only the comparisson function as a parameter in
> Python 2.3)
>
> 2. The links in the admin breadcrubs are not relative as in the
> original admin, therefore I need to change all templates if I have my
> django project in some directory instead of in the root of the domain.
>
> 3. If I upload an image to the root of uploads, the thumbnail isn't
> showed, because of additional slash in the path that is added next to
> the dir_name which doesn't exist. I think, you should also check
> whether dir_name is set at all, and only then add that slash at the
> end.
>
> 4. It works in Firefox, but it seems a little bit strange and may not
> work in other browsers, because all the uploaded images are being
> accessed with additional slash at the end of the URL.
>
> That were my notices. But on the whole, great work!
>
> Aidas Bendoraitis [aka Archatas]
>
> patrickk wrote:
>> today we´ve finished the test version of our django filebrowser.
>>
>> some screenshots are here:
>> http://www.vonautomatisch.at/django/filebrowser/
>>
>> you can download the filebrowser here:
>> http://www.vonautomatisch.at/django/filebrowser/FileBrowser.zip
>>
>> installation shouldn´t take more than 5-10 minutes.
>> requirements: we are using PIL to create the thumbnails.
>>
>> this version is for testing (although we´re already using it). I hope
>> that some of you will find the time to install the filebrowser.
>> feedback is more than welcome.
>>
>> thanks,
>> patrick
>
>
> >


--~--~-~--~~~---~--~~
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: FileBrowser Test Version

2006-07-11 Thread va:patrick.kranzlmueller

thanks.

I will take a look at the bugs mentioned by archatas - so there'll  
probably be a new version for download later today.

SVN: I´ve never worked with SVN (well, besides using django), no idea  
how to do the setup. It´d be very useful but I don´t have the time to  
digg into that right now.

patrick


Am 11.07.2006 um 12:53 schrieb Phil Powell:

>
> This is fantastic stuff!  I'll be taking a look at testing it out and
> possibly implementing for a current project (thousands of image files
> to manage).
>
> Any plans for a SVN address?
>
> -Phil
>
> On 08/07/06, patrickk <[EMAIL PROTECTED]> wrote:
>>
>> today we´ve finished the test version of our django filebrowser.
>>
>> some screenshots are here:
>> http://www.vonautomatisch.at/django/filebrowser/
>>
>> you can download the filebrowser here:
>> http://www.vonautomatisch.at/django/filebrowser/FileBrowser.zip
>>
>> installation shouldn´t take more than 5-10 minutes.
>> requirements: we are using PIL to create the thumbnails.
>>
>> this version is for testing (although we´re already using it). I hope
>> that some of you will find the time to install the filebrowser.
>> feedback is more than welcome.
>>
>> thanks,
>> patrick
>>
>>
>>
>>>
>>
>
> >


--~--~-~--~~~---~--~~
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: generic relations in the admin interface

2006-07-06 Thread va:patrick.kranzlmueller

sounds a bit complicated: save first, go back to the entry, add  
tag ... not sure if that works for me.
I´ll check out your scripts later.

for now, I´ll stick with many-to-many ...

thanks for your answer,

patrick


Am 06.07.2006 um 15:31 schrieb Jay Parlar:

>
> On 7/6/06, va:patrick.kranzlmueller <[EMAIL PROTECTED]> wrote:
>>
>> just tested generic relations for tagging.
>> to my surprise, there´s no possibility to enter tags (for my blog-
>> entries) in the admin interface.
>>
>> however, i do get additional user permissions:  "can add tagged
>> item", ...
>> did I miss something?
>
> There's not been any explicit Admin support added for generic  
> relations, yet.
>
> The extra permission is automatically added for anything in your  
> model.
>
> My solution to generic relations and the admin is to use some custom
> JavaScript. What happens is I'll add, for example, a blog entry. Once
> that's entered and saved, anytime I go to that entry in the admin, I
> have a link pop up that says "Add Tag for this item".
>
> That link then takes me to a TaggedItem page, and pre-populates the
> content_type and object_id fields. So all I have to do myself is
> provide the tag.
>
> You can see my javascript here:
> http://svn.jayparlar.com/website/trunk/jayparlar/site_media/js/
> And my blog and tags apps are found here:
> http://svn.jayparlar.com/website/trunk/jayparlar/
>
> Don't laugh at my JavaScript too much, I'm still just learning it.
>
> This is certainly not an ideal solution, but it's the best I could
> come up with for now.
>
> 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
-~--~~~~--~~--~--~---



generic relations in the admin interface

2006-07-06 Thread va:patrick.kranzlmueller

just tested generic relations for tagging.
to my surprise, there´s no possibility to enter tags (for my blog- 
entries) in the admin interface.

however, i do get additional user permissions:  "can add tagged  
item", ...
did I miss something?

code:

class TaggedItem(models.Model):
 """A tag on an item."""
 tag = models.SlugField()
 content_type = models.ForeignKey(ContentType)
 object_id = models.PositiveIntegerField()
 content_object = models.GenericForeignKey()

 class Meta:
 ordering = ["tag"]

 def __str__(self):
 return self.tag

class Entry(models.Model):
 ...
 tags = models.GenericRelation(TaggedItem)
 ...


thanks,
patrick




--~--~-~--~~~---~--~~
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: dojo

2006-05-18 Thread va:patrick.kranzlmueller

just found out an easier way:

forget nr. 3 and change AddRichTextEditing.js to this:

document.write('');
document.write('dojo.require 
("dojo.widget.Editor2");');

var AddEditor = {
init: function() {
var helptext = document.getElementsByTagName('p');
for (var i = 0, ht; ht = helptext[i]; i++) {
if (ht.firstChild.data == "Rich Text Editing.") 
{

ht.previousSibling.previousSibling.setAttribute("dojoType",  
"Editor2");
}
}
},
}

addEvent(window, 'load', AddEditor.init);

btw, i´ve tested this with m-r on Firefox 1.5.

patrick


Am 18.05.2006 um 13:07 schrieb va:patrick.kranzlmueller:

>
> i guess you mean the editor widget:
>
> 1. drop dojo (kitchen sink) into /media/ (like /media/dojo)
> 2. add this script as AddRichTextEditing.js into /media/js/admin/
> ### this script looks for the help text "Rich Text Editing" and
> replaces the textarea before with the dojo widget
>
> var AddEditor = {
>   init: function() {
>   var helptext = document.getElementsByTagName('p');
>   for (var i = 0, ht; ht = helptext[i]; i++) {
>   if (ht.firstChild.data == "Rich Text Editing.") 
> {
>   
> ht.previousSibling.previousSibling.setAttribute("dojoType",
> "Editor");
>   }
>   }
>   },
> }
> addEvent(window, 'load', AddEditor.init);
>
> 3. in change_form.html add the dojo js to block extrahead (it should
> look like this):
>
> {% block extrahead %}{{ block.super }}
> 
> {% for js in javascript_imports %}{% include_admin_script js %}{%
> endfor %}
> 
> 
>  dojo.require("dojo.widget.Editor");
> 
> {% endblock %}
>
> ### i don´t know why, but the dojo-js has to be included AFTER the
> admin-scripts
> ### it´d be cool to integrate this into AddRichTextEditing.js (but i
> don´t know how ...)
>
> 4. in your models, define the areas for richtext editing like this:
>
> class Blog(models.Model):
>  body = models.TextField('Body', help_text='Rich Text Editing.',
> blank=True, null=True)
>  class Admin:
>  js = ['js/admin/AddRichTextEditingDirectly.js']
>
>
> that´s it. if there are any further questions, don´t hesitate to ask.
>
> additionally, you might wanna change the widget styles (dojo/src/
> widget/templates/HTMLEditorToolbar.css):
>
> add margin-left: 110px to EditorToolbarSmallBg
> add this:
> .RichTextEditable {
>  margin-left: 110px;
> }
>
> with changing the styles a bit more, the whole thing might look like
> this:
> http://www.vonautomatisch.at/django/dojoeditor.jpg
>
> patrick
>
>
>
> Am 18.05.2006 um 09:06 schrieb Mary Adel:
>
>>
>> hi all
>> I am using magic removal
>> i need to use text widget in my admin interface so can anyone tell me
>> how i could do this
>>
>> 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: dojo

2006-05-18 Thread va:patrick.kranzlmueller

i guess you mean the editor widget:

1. drop dojo (kitchen sink) into /media/ (like /media/dojo)
2. add this script as AddRichTextEditing.js into /media/js/admin/
### this script looks for the help text "Rich Text Editing" and  
replaces the textarea before with the dojo widget

var AddEditor = {
init: function() {
var helptext = document.getElementsByTagName('p');
for (var i = 0, ht; ht = helptext[i]; i++) {
if (ht.firstChild.data == "Rich Text Editing.") 
{

ht.previousSibling.previousSibling.setAttribute("dojoType",  
"Editor");
}
}
},
}
addEvent(window, 'load', AddEditor.init);

3. in change_form.html add the dojo js to block extrahead (it should  
look like this):

{% block extrahead %}{{ block.super }}

{% for js in javascript_imports %}{% include_admin_script js %}{%  
endfor %}


 dojo.require("dojo.widget.Editor");

{% endblock %}

### i don´t know why, but the dojo-js has to be included AFTER the  
admin-scripts
### it´d be cool to integrate this into AddRichTextEditing.js (but i  
don´t know how ...)

4. in your models, define the areas for richtext editing like this:

class Blog(models.Model):
 body = models.TextField('Body', help_text='Rich Text Editing.',  
blank=True, null=True)
 class Admin:
 js = ['js/admin/AddRichTextEditingDirectly.js']


that´s it. if there are any further questions, don´t hesitate to ask.

additionally, you might wanna change the widget styles (dojo/src/ 
widget/templates/HTMLEditorToolbar.css):

add margin-left: 110px to EditorToolbarSmallBg
add this:
.RichTextEditable {
 margin-left: 110px;
}

with changing the styles a bit more, the whole thing might look like  
this:
http://www.vonautomatisch.at/django/dojoeditor.jpg

patrick



Am 18.05.2006 um 09:06 schrieb Mary Adel:

>
> hi all
> I am using magic removal
> i need to use text widget in my admin interface so can anyone tell me
> how i could do this
>
> 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: hack for file-browser

2006-05-03 Thread va:patrick.kranzlmueller

rephrasing my question: i´m trying to implement a FileBrowseField  
which should look like
http://www.vonautomatisch.at/django/ftp/get_image.jpg

it will open the file-browser (http://www.vonautomatisch.at/django/ 
ftp/) in a pop-up window, where the user can select the file as well  
as upload files, ...

advantage compared with current solutions (FileField, FilePathField):
- ONE field for both selecting and uploading
- not limited to a certain directory
- thumb-preview (important if you have lots of files uploaded by  
different editors)

any help is appreciated,
patrick


Am 02.05.2006 um 21:48 schrieb patrickk:

>
> actually, referring to the add-image was inaccurate.
> i´d like to have something like this
> http://www.vonautomatisch.at/django/ftp/get_image.jpg
>
> when clicking on the search-image near the image-field, the file-
> browser should open in a pop-up window in order to search for images/
> files or upload images/files.
> my question is: what file(s) do i have to change in order to get that
> functionality (this is not easy, i guess).
> btw, i´d prefer not using a change-manipulator.
>
> thanks,
> patrick
>
>
> Am 02.05.2006 um 21:11 schrieb Adrian Holovaty:
>
>>
>> On 5/2/06, va:patrick.kranzlmueller <[EMAIL PROTECTED]>  
>> wrote:
>>> now i´d like to implement that browser for file- resp. image-fields.
>>> i´m thinking about a "+" right near an input-field, which opens
>>> another window where the user can select the appropriate image/file.
>>>
>>> hopefully someone can give me a hint on how to get that "+" near an
>>> image-field. i´ve been looking through several django-files but  
>>> can´t
>>> figure out where that "+" is constructed.
>>
>> Hey Patrick,
>>
>> That's looking good! Here's where the "+" image lives in the Django
>> source tree:
>>
>> django/contrib/admin/media/img/admin/icon_addlink.gif
>>
>> Adrian
>>
>> --
>> Adrian Holovaty
>> holovaty.com | djangoproject.com
>>
>>>
>
>
> |||
> vonautomatisch werkstaetten | www.vonautomatisch.at
> Zieglergasse 69 | A-1070 Wien
>
> |||
> [EMAIL PROTECTED] | +43 (0) 699 196 787 28
>
>
>
>
>
>
> >


--~--~-~--~~~---~--~~
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: hack for file-browser

2006-05-02 Thread va:patrick.kranzlmueller

i still have to work on some stuff like multiple delete, rename,  
permissions ...
it´ll be available soon.

patrick

Am 02.05.2006 um 15:28 schrieb [EMAIL PROTECTED]:

>
> On Tue, May 02, 2006 at 02:47:33PM +0200, va:patrick.kranzlmueller  
> wrote:
>> i?m working on a file-browser for/with the django-admin.
>> screenshots are here:
>> http://www.vonautomatisch.at/django/ftp/
>
> Wow, that looks great!  I would love to use that in my apps.
>
> Nate
>
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



hack for file-browser

2006-05-02 Thread va:patrick.kranzlmueller

i´m working on a file-browser for/with the django-admin.
screenshots are here:
http://www.vonautomatisch.at/django/ftp/

now i´d like to implement that browser for file- resp. image-fields.
i´m thinking about a "+" right near an input-field, which opens  
another window where the user can select the appropriate image/file.

hopefully someone can give me a hint on how to get that "+" near an  
image-field. i´ve been looking through several django-files but can´t  
figure out where that "+" is constructed.

thanks in advance,
patrick
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



slugify & umlauts

2006-04-11 Thread va:patrick.kranzlmueller

shouldn´t slugify resp. the SlugField convert umlauts?

additionally: does anyone have an idea on how to convert umlauts "on  
the fly"?
we´re having a tag-cloud where words have umlauts. still, we´d like  
to have the tags in the URL.

thanks,
patrick
--~--~-~--~~~---~--~~
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: problem getting the admin to work (in tutorial)

2006-03-10 Thread va:patrick.kranzlmueller

see
http://dev.mysql.com/doc/refman/4.1/en/charset-database.html
http://dev.mysql.com/doc/refman/4.1/en/charset-table.html

e.g.
CREATE DATABASE db_name CHARACTER SET latin1 COLLATE latin1_swedish_ci;

regards,
patrick


Am 10.03.2006 um 14:54 schrieb [EMAIL PROTECTED]:

>
> thanks, patrick.. i forgot to mention..
>
> i am using mysql on linux on a remote machine for this...
>
> can i do it from the command line on the linux machine?
>
> thanks!
>
>
>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: order_with_respect_to

2006-02-24 Thread va:patrick.kranzlmueller
good point.i´d still appreciate some help with my initial question though.thanks,patrickAm 24.02.2006 um 17:10 schrieb Amit Upadhyay:On 2/24/06, va:patrick.kranzlmueller <[EMAIL PROTECTED]> wrote: class Filmstarts(meta.Model): id = meta.AutoField('ID', primary_key=True)Why are you doing this? Every model has a file named `id` if you do not specify any primary_key. If there is no strong reason to do it, consider removing this line, and recreating tables. -- Amit UpadhyayBlog: http://www.rootshell.be/~upadhyay+91-9867-359-701

--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---


order_with_respect_to

2006-02-24 Thread va:patrick.kranzlmueller

i´m having the following model which gives me an error when trying to  
save something:

class Filmstarts(meta.Model):
 id = meta.AutoField('ID', primary_key=True)
 film = meta.ForeignKey(Film, raw_id_admin=True)
 class META:
 order_with_respect_to = "film"
 admin = meta.Admin(
 list_display = ('film',),
 )

any idea what´s wrong with this?

thanks,
patrick
--~--~-~--~~~---~--~~
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: ManyToMany and Admin Interface

2006-02-24 Thread va:patrick.kranzlmueller

hmm, what about using "edit_inline" like:

class Article(meta.Model):
headline = meta.CharField(maxlength=100)
publications = meta.ManyToManyField(Publication,  
edit_inline=meta.TABULAR)

i didn't try that btw.

patrick


Am 24.02.2006 um 16:14 schrieb Philippe Mironov:

>
> [EMAIL PROTECTED] a écrit :
>
>> The following model was taken from :
>> http://www.djangoproject.com/documentation/models/many_to_many/
>>
>> **
>> from django.core import meta
>>
>> class Publication(meta.Model):
>>title = meta.CharField(maxlength=30)
>>
>>def __repr__(self):
>>return self.title
>>class META:
>>admin = meta.Admin()
>>
>> class Article(meta.Model):
>>headline = meta.CharField(maxlength=100)
>>publications = meta.ManyToManyField(Publication)
>>
>>def __repr__(self):
>>return self.headline
>>class META:
>>admin = meta.Admin()
>> **
>>
>> How do I give the Publication admin interface the ability to add
>> Articles to a certain publication?
>>
>> Say I have two articles.  When I create a publication called "My
>> Articles" I want to be able to add article 1 and article 2.   
>> Currently
>> I can add articles to a Publication through the ManyToManyField but I
>> need that same functionality in the Publication model.  Any  ideas?
>>
>>
>
> Hi did you get any response (off list) ?
> I'm interested with the issue.
>
>
>
>


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



edit_inline & raw_id_admin

2006-02-24 Thread va:patrick.kranzlmueller

i have 2 tables, films and stars, each with lots of entries (>1).
each film has a list of cast-members which relate to the table stars.

i´m trying to do that relation using M2M with an intermediary table  
to add a job for every star (like actor, director, camera ...).

class Cast(meta.Model):
 film = meta.ForeignKey(Film, edit_inline=meta.TABULAR,  
num_in_admin=20)
 star = meta.ForeignKey(Star, raw_id_admin=True)
 job = meta.CharField(Job)

with using the above model, i only get ONE input field for the cast- 
members, which probably occurs because raw_id_admin doesn´t work with  
edit_inline.

any suggestions on how to solve that problem?

thanks,
patrick
--~--~-~--~~~---~--~~
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 interface table detail showing incorrect number of entries

2006-02-24 Thread va:patrick.kranzlmueller

(sorry, i´ve accidentally replied to one of the previous messages)

i´m having the problem described here:
http://code.djangoproject.com/ticket/480

1. wrong numbers are displayed
2. it´s not possible to use the foreign keys for sorting - Exception
Value: (1054, "Unknown column 'films.-id' in 'order clause'")

any suggestions?

thanks,
patrick
--~--~-~--~~~---~--~~
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 interface table detail showing incorrect number of entries

2006-02-24 Thread va:patrick.kranzlmueller

i´m having the problem described here:
http://code.djangoproject.com/ticket/480

1. wrong numbers are displayed
2. it´s not possible to use the foreign keys for sorting - Exception  
Value: (1054, "Unknown column 'films.-id' in 'order clause'")

any suggestions?

thanks,
patrick
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---