Re: Using new messages framework within built-in admin ?

2010-05-27 Thread Nicolas Steinmetz
Nobody on this issue ?

On 21 mai, 15:46, Nicolas Steinmetz <nsteinm...@gmail.com> wrote:
> Hi,
>
> For some actions I made from the Django built-in admin, I would like
> to improve the user experience with a better distinction between
> sucess & error messages.
>
> With Django 1.1.x, I used to use Model admin actions [1] with
> statements like :
>
>     modeladmin.message_user(request, "%s successfully marked as
> published." % message_bit)
>
> With the new 1.2 version, I was about to use the messages framework
> and the messages.success() / messages.error() shortcuts to provide a
> better experience. I now have in my code :
>
>     messages.success(request, "%s successfully marked as published." %
> message_bit)
>
> So running my own admin/base.html file, I replaced the messages
> section by the example provided in the doc [2] :
>
> {% if messages %}
> 
>     {% for message in messages %}
>     <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message 
> }}
>
>     {% endfor %}
> 
> {% endif %}
>
> What happens is that messages.tags is empty.If I understand well the
> doc, I should have an "error" or "success" tags for my error/success
> messages.
>
> What did I miss ? Or is it a bug ? Or the admin do not use yet the new
> message framework ?
>
> [1]http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#actio...
> [2]http://docs.djangoproject.com/en/1.2/ref/contrib/messages/#ref-contri...
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



Using new messages framework within built-in admin ?

2010-05-21 Thread Nicolas Steinmetz
Hi,

For some actions I made from the Django built-in admin, I would like
to improve the user experience with a better distinction between
sucess & error messages.

With Django 1.1.x, I used to use Model admin actions [1] with
statements like :

modeladmin.message_user(request, "%s successfully marked as
published." % message_bit)

With the new 1.2 version, I was about to use the messages framework
and the messages.success() / messages.error() shortcuts to provide a
better experience. I now have in my code :

messages.success(request, "%s successfully marked as published." %
message_bit)

So running my own admin/base.html file, I replaced the messages
section by the example provided in the doc [2] :

{% if messages %}

{% for message in messages %}
{{ message }}
{% endfor %}

{% endif %}

What happens is that messages.tags is empty.If I understand well the
doc, I should have an "error" or "success" tags for my error/success
messages.

What did I miss ? Or is it a bug ? Or the admin do not use yet the new
message framework ?

[1] 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#actions-as-modeladmin-methods
[2] 
http://docs.djangoproject.com/en/1.2/ref/contrib/messages/#ref-contrib-messages

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



Re: Best way to generate a local file from a models + views ?

2009-10-19 Thread Nicolas Steinmetz

Михаил Лукин a écrit :
> For purpose of generating apache config files I would recommend to use 
> management commands [1], so that you could generate config like this:
> ./manage genconf --server apache2 > /etc/apache2/vhosts.d/myapp.conf
> where genconf is your custom management command.
> 
> [1] http://docs.djangoproject.com/en/dev/howto/custom-management-commands/

Thanks, I'll think about it next time !

Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Best way to generate a local file from a models + views ?

2009-10-19 Thread Nicolas Steinmetz

Daniel Roseman a écrit :

> There's nothing magical about creating a file in Django, it's just
> Python. Assuming you have rights to write to a file, that should work.

It's what I was assuming but looks I did not find the right way to do it :-(

> Is render_to_string producing anything? Can you try printing it to the
> console or the server log?

Sounds weird - now file are generated and are no longer empty. Seems 
week end had some nice effects o_0

Sorry for the noise and thanks for your help,
Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Best way to generate a local file from a models + views ?

2009-10-19 Thread Nicolas Steinmetz

Re,

Anybody for helping me in my quest ?

Nicolas

On 16 oct, 21:58, Nicolas Steinmetz <nsteinm...@gmail.com> wrote:
> Hello,
>
> I'm building a django app to manage the reverse proxies of my firm. I'm
> at the step where I want to generate configuration files for apache and
> then send it from the server that host the django app to the reverse
> proxies.
>
> I built a view base on a generic view (object_detail) with some extra
> code. With a mimetype set to plain/text it generates the right
> configuration file as a view.
>
> I read the doc regarding outputin csv/pdf file but they are proposed for
> download and not generated on the server itself.
>
> I tried to play with render_to_string() (based on [1]) within a view but
> with no success so far. File is created but remains empty. You can see
> the code here [2] and the working view is here [3]
>
> If someone already did something similar to what I need, I'll be glad to
> see some running code :)
>
> Cheers,
> Nicolas
>
> [1]http://www.djangosnippets.org/snippets/689/
> [2]http://friendpaste.com/9emHQNyTWuLt10S8jlqhY
> [3]http://friendpaste.com/4Z2bikQnCVXQ1EKh1Puq9B
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Best way to generate a local file from a models + views ?

2009-10-16 Thread Nicolas Steinmetz

Hello,

I'm building a django app to manage the reverse proxies of my firm. I'm 
at the step where I want to generate configuration files for apache and 
then send it from the server that host the django app to the reverse 
proxies.

I built a view base on a generic view (object_detail) with some extra 
code. With a mimetype set to plain/text it generates the right 
configuration file as a view.

I read the doc regarding outputin csv/pdf file but they are proposed for 
download and not generated on the server itself.

I tried to play with render_to_string() (based on [1]) within a view but 
with no success so far. File is created but remains empty. You can see 
the code here [2] and the working view is here [3]

If someone already did something similar to what I need, I'll be glad to 
see some running code :)

Cheers,
Nicolas

[1] http://www.djangosnippets.org/snippets/689/
[2] http://friendpaste.com/9emHQNyTWuLt10S8jlqhY
[3] http://friendpaste.com/4Z2bikQnCVXQ1EKh1Puq9B


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: limit_choices_to & get_sql()

2009-09-23 Thread Nicolas Steinmetz

On 22 sep, 23:31, Daniel Roseman  wrote:
> Seems like you're looking at the ForeignKey documentation. The
> reference to get_sql() is confusing and very out of date on that page
> - Q objects don't have such a method, although they may have done back
> before the merge of queryset-refactor before version 1.0 was released.
>
> Anyway, the syntax is simple:
>     limit_choices_to = {'dnstype': 2}

That's it, thanks.

Indeed, I misunderstood the doc here :
http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey

Have a nice day,
Nicolas
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



limit_choices_to & get_sql()

2009-09-22 Thread Nicolas Steinmetz

Hello,

I would like to present only a subset of a given models. But so far,
in the admin, I have no value whereas there should be some.

I tried several syntax but did not find the right one.

Here are my implicated (and simplified) models :

class Dns(models.Model):
"""
DNS description
"""
TYPEDNS_CHOICES = (
('1', 'Reference'),
('2', 'Normal'),
)
name = models.CharField(blank=True, max_length=100)
dnstype = models.CharField(max_length=100,
choices=TYPEDNS_CHOICES)

class Url(models.Model):
"""
Url description
"""
name = models.CharField(blank=True, max_length=100)
[...]
cnamevalue = models.ForeignKey(Dns, limit_choices_to = {'dns':
'get_sql(Dns.dnstype="2")'}, blank=True)

Could someone explain me what is the right syntax ?

I could use formfield_for_foreignkey for admin contrib but I would
prefer using limit_choices_to that I see as a native solution.

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_foreignkey

Thanks,
Nicolas

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django & Couchdb ??

2009-06-11 Thread Nicolas Steinmetz

Hello,

Interesed by couchdb, I would be interested to use both django & couchdb.

I see that there is at least 6 implementations :
- couchdb-django : http://code.google.com/p/couchdb-django/ - not 
updated since last august
- django-couchdb : http://code.google.com/p/django-couchdb/ - not 
updated since last september
- django-relax : http://github.com/zvoase/django-relax/tree/master - not 
updated since last december
- django-couchdb : 
http://github.com/crimeminister/django-couchdb/tree/master : empty
- django-relex : http://bitbucket.org/benoitc/django-relax/ : empty
- django-couch : http://bitbucket.org/ianschenck/django-couch/wiki/Home

Any stable and maintained solution to suggest me or should I forget 
using both of them at the same time ?

Regards,
Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Question about django.views.generic.simple.redirect_to

2009-05-29 Thread Nicolas Steinmetz

Russell Keith-Magee a écrit :
> You could probably genericize your redirect_to_url view a little bit
> more - you could make the class that is used for lookup configurable,
> for example - but you have essentially hit on the solution.
> 
> The issue is that 'shortcut', as captured by the regular expression,
> isn't a Python variable you can use in the .get() query. As a result,
> the only way you're going to be able to use shortcut in a query is to
> push the query into an actual function call - or write a generic view
> of your own that will perform that function call, based upon a known
> set of named arguments in the pattern.

Ok, thanks for the reply :)

I'll try this then :)

Thanks,
Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Question about django.views.generic.simple.redirect_to

2009-05-22 Thread Nicolas Steinmetz

Hi,

I was thinking about something like the following in urls.py :

 (r'(?P\w+)', 'django.views.generic.simple.redirect_to', 
{'url': Shorturl.objects.get(slug=shortcut).url }),

But I did not manage to make it work.

In the meanwhile I did this which works but I'm a little "disappointed" 
with this :

urls.py:


from django.conf.urls.defaults import *
from shorturl.views import redirect_to_url

urlpatterns = patterns('',
 (r'(?P\w+)',  'shorturl.views.redirect_to_url'),
)

views.py:
-

from django.http import HttpResponsePermanentRedirect
from atome.shorturl.models import Shorturl

def redirect_to_url(request, shortcut):
 return 
HttpResponsePermanentRedirect(Shorturl.objects.get(slug=shortcut).url)

Any idea ?

Regards,
Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unicode/str not callable

2009-02-19 Thread Nicolas Steinmetz

Nicolas Steinmetz a écrit :
> 
> Thanks for the answer. I'll implement the 2nd method, which makes far 
> more sens than my first "harsh and straight away" approach ;-)

Solution was finally :

 try:
 tips ={'google': google(request.POST['search'], number),
 'googlefr': googlefr(request.POST['search'], number),
 'dmoz': dmoz(request.POST['search'], number),
 'ask': ask(request.POST['search'], number),
 'yahoo': yahoo(request.POST['search'], number),
 'msn': msn(request.POST['search'], number),
 'excite': excite(request.POST['search'], number)}.get(engine)
 except KeyError:
 tips=google(request.POST['search'], number)


Thanks,
Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unicode/str not callable

2009-02-18 Thread Nicolas Steinmetz

Malcolm Tredinnick a écrit :

> Method #2: create a dictionary mapping "engine" values to the right
> callable.
> 
> try:
> {'google': google,
>  'yahoo': yahoo,
>  # ...
> }[engine](...)
> except KeyError:
> # Engine name is not valid. Handle appropriately here.
> 
> The drawback is the percieved redundancy between the string name and the
> function name. Still, I would prefer this solution. It automatically
> only allows "permitted" value through -- and if, say, you wanted to
> temporariliy disable the yahoo functionality, you would just comment out
> or remove that line from the dictionary. It also means you don't *have*
> to call your functions by the same name as the search engine, which
> would be useful if you ever included an engine whose name was not a
> valid Python identifier, for example.
> 
> By the way, this second pattern is more-or-less idiomatic Python for a
> C-style switch-statement. Usually preferable to a series of if...elif...
> statements, particularly for a large number of choices.

Thanks for the answer. I'll implement the 2nd method, which makes far 
more sens than my first "harsh and straight away" approach ;-)

Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



unicode/str not callable

2009-02-18 Thread Nicolas Steinmetz

Hello,

I have in mind in a tiny app to allow user to set a search box with the 
provider they wish.

I base this on web_search and then did the following :

# Create your models here.
class SearchBox(models.Model):
 CROP_ANCHOR_STR = ('dmoz', 'ask', 'google', 'googlefr', 'excite', 
'msn', 'yahoo')
 CROP_ANCHOR_CHOICES = zip(range(len(CROP_ANCHOR_STR)), CROP_ANCHOR_STR)
 engine = models.SmallIntegerField(choices=CROP_ANCHOR_CHOICES)

 class Meta:
 verbose_name, verbose_name_plural = "Search Engine", "Search 
Engines"

and in my views, I did :


# Create your views here.
def results(request):
 """
 Get search engine set up for the site
 Get results for the query
 """
 engine_list=SearchBox.objects.all()
 for eng in engine_list:
 engine=eng.get_engine_display()
 if request.POST:
 return render_to_response('results.html', {'result': 
engine(request.POST['search'], 10), 'search_query': request.POST['search']})
 else:
return render_to_response('results.html')

The issue is that engine in engine(request.POST['search'], 10) does not 
become google(request.POST['search'], 10) in the case where the user 
chosed "google" as engine.

Is there a solution or did I have to test all values with a if or case 
loops ?

Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Snippets app ?

2009-01-29 Thread Nicolas Steinmetz

Hi djangonauts,

For my site, I planned to include a snippets app and was thinking about 
cab [1] which powers djangosnippets or some other snippets app.

For Cab, it looks it's not updated since April 2007 so I think it's not 
compatible with Django 1.0.x or do not take benefit from 1.0.x features 
and improvements.

The code of snipt.net is no longer available on Google Code too. I found 
some pastebin app (like Spaste) but I wish more a snippets repository 
than a pastebin.

Do someone know some snippets app available somewhere ?

Regards,
Nicolas

[1] http://code.google.com/p/cab/


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error with PGSQL and not with SQLite with count() ?

2009-01-13 Thread Nicolas Steinmetz

alex.gay...@gmail.com a écrit :

> You're problem is you are testing identity with `is` when you want to
> test equality, which you should do with ==, this is likely causing the
> condition expect to pass to fail, and therefore your function returns
> None, which plainly isn't an HttpResponse object.

That's it, exactly. I did not think about checking "is" as it did not 
fail with SQLite.

Thanks a lot,
Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Error with PGSQL and not with SQLite with count() ?

2009-01-13 Thread Nicolas Steinmetz

Hello,

The following view works well with SQLite but since I switched to 
PostgreSQL 8.3, I have the following error :

ValueError at /start/
The view start.views.index didn't return an HttpResponse object.

Views is :

def index(request):
 """
 Try to see if there is a default theme to display. For the matching
 case, get all category for the given theme and for each category, 
display
 related bookmarks
 """
 default_theme=Theme.objects.filter(is_default=True)
 if default_theme.count() is 1:
 theme=Theme.objects.get(is_default=True)
 return HttpResponseRedirect('%s' % theme.slug)

Model is :

class Theme(models.Model):
 """
 A theme is a general point of view - within theme there would be 
category
 and within category, there will be bookmarks
 """
 name = models.CharField(max_length=50)
 slug = models.SlugField()
 order = models.IntegerField()
 is_default = models.BooleanField(default=False)

 class Meta:
 ordering = ['order']
 verbose_name, verbose_name_plural = "Theme", "Themes"

 def __unicode__(self):
 return self.name

I do not understand wht it fails or why it is dependant on the SGBD. 
Through the shell, the theme.slug is correct but I noticed that count() 
answers me 1L for PGSQL and just 1 for SQLite - could it explain my issue ?

Regards,
Nicolas


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Issue with django-tagging 0.3 (svn) with models definition

2008-07-09 Thread Nicolas Steinmetz

Nicolas Steinmetz wrote:

> On Jul 9, 11:10 am, "Marek Stępniowski" <[EMAIL PROTECTED]>
> wrote:
> 
>> It seems you are running into one of django-tagging quirks.
>> See issue #95
>> [http://code.google.com/p/django-tagging/issues/detail?id=95].
> 
> Oh thanks I missed this issue. I'll test it this evening.

Thanks Marek for the right pointer, it works now :)

Regards,
Nicolas

-- 
Nicolas Steinmetz
http://www.steinmetz.fr/
http://www.unelectronlibre.info/


--~--~-~--~~~---~--~~
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: Issue with django-tagging 0.3 (svn) with models definition

2008-07-09 Thread Nicolas Steinmetz

On Jul 9, 11:10 am, "Marek Stępniowski" <[EMAIL PROTECTED]>
wrote:

> It seems you are running into one of django-tagging quirks.
> See issue #95 [http://code.google.com/p/django-tagging/issues/detail?id=95].

Oh thanks I missed this issue. I'll test it this evening.

Regards,
Nicolas

--~--~-~--~~~---~--~~
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: Issue with django-tagging 0.3 (svn) with models definition

2008-07-08 Thread Nicolas Steinmetz

Nicolas Steinmetz wrote:

> 
> Hello,
> 
> Despite I read a lot of time the overview.txt on the django tagging svn
> repository, I still can't stand how to use it at my model's level. I'm
> quite new to python and may miss some elements.
> 
> When diving into the register part, it says it requiers a field for tag
> which is supposed to be "tags". But what kind of type is this tag supposed
> to be ? a TagField() ?
> 
> I came down to this kind of things which looks not the optimum for me (at
> least at validate & runserver step, it stops shouting...):
> 
> from django.db import models
> import tagging
> from tagging.models import Tag
> from tagging.fields import TagField
> 
> # Create your models here.
> class Links(models.Model):
> title = models.CharField(max_length=80)
> description = models.TextField()
> url = models.URLField()
> tags = TagField()
> 
> class Admin:
> list_display = ('title', 'description', 'url', 'tags',)
> list_filter = ['title', 'tags']
> search_fields = ['title','tags',]
> 
> class Meta:
> verbose_name = "Lien"
> verbose_name_plural = "Liens"
> 
> tagging.register(Links)
> 
> But when I try to save a link, I got :
> 
> IntegrityError at /admin/links/links/add/
> tagging_taggeditem.object_id may not be NULL
> 
> What did I miss ?
> 
> Regards,
> Nicolas
> 

Nobody is in a similar case than mine ?
-- 
Nicolas Steinmetz
http://www.steinmetz.fr/
http://www.unelectronlibre.info/


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



Issue with django-tagging 0.3 (svn) with models definition

2008-07-05 Thread Nicolas Steinmetz

Hello,

Despite I read a lot of time the overview.txt on the django tagging svn
repository, I still can't stand how to use it at my model's level. I'm
quite new to python and may miss some elements.

When diving into the register part, it says it requiers a field for tag
which is supposed to be "tags". But what kind of type is this tag supposed
to be ? a TagField() ?

I came down to this kind of things which looks not the optimum for me (at
least at validate & runserver step, it stops shouting...):

from django.db import models
import tagging
from tagging.models import Tag
from tagging.fields import TagField

# Create your models here.
class Links(models.Model):
title = models.CharField(max_length=80)
description = models.TextField()
url = models.URLField()
tags = TagField()

class Admin:
list_display = ('title', 'description', 'url', 'tags',)
list_filter = ['title', 'tags']
search_fields = ['title','tags',]

class Meta:
verbose_name = "Lien"
verbose_name_plural = "Liens"

tagging.register(Links)

But when I try to save a link, I got :

IntegrityError at /admin/links/links/add/
tagging_taggeditem.object_id may not be NULL

What did I miss ?

Regards,
Nicolas

-- 
Nicolas Steinmetz
http://www.steinmetz.fr/
http://www.unelectronlibre.info/


--~--~-~--~~~---~--~~
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: Beej's Flickr API

2008-03-25 Thread Nicolas Steinmetz

Michael J a écrit :
> Has anyone attempted to implement Beej's Flickr API with Django?

Personnaly, I use Flick.py [1] which works like a charm :)

[1] 


--~--~-~--~~~---~--~~
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: djWarehouse - Django based e-commerce system

2008-02-18 Thread Nicolas Steinmetz

[EMAIL PROTECTED] a écrit :
> Hello,
> 
> I am pleased to announce the immediate availability of djWarehouse e-
> commerce system, developed on Django.

Could you provide a quick bench / swot against satchmo project as it 
looks you have the same objectives (being an e-commerce platform).

Regards,
Nicolas


--~--~-~--~~~---~--~~
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: SQL Join

2008-02-13 Thread Nicolas Steinmetz

Gus a écrit :

> any help would be much appreciated

Maybe this thread will help you (my issue was quite similar)


Nicolas


--~--~-~--~~~---~--~~
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: Issue on joining objects/table

2008-02-13 Thread Nicolas Steinmetz

Malcolm Tredinnick a écrit :

So the solution is :

In views.py :

 user_skill = user.userskill_set.all().select_related()
 results = [{'domain': o.name.domain, 'item': o} for o in user_skill]

(exactly as said by Malcolm)

And in the template :

>{% regroup results by domain as domain_list %}
>{% for d in domain_list %}
>{{ d.grouper }}
>   
>  {% for item in d.list %}
>  ...
>  {% endfor %}
>   
>
>{% endfor %}

The only change I made was :

 {% regroup results|dictsort:"domain.name" by domain as domain_list %}

otherwise, regroup was not always correct.

and a small notice, to access values of the list, it is by using 
item.item. : ex : item.item.name

> That looks, to my eye at least, a bit neater than the original solution,
> too. You *might* (completely untested) be able to get away with making
> your results list be:
> 
> results = list(user_skill)
> results.sort(key=lambda x: x.getattr('domain').name))
> 
> and then grouping by "domain.name", but I'm not 100% certain that will
> work.

I did not test this one - I keep it in mind anyway :)

Thanks a lot for your help Malcom !

Nicolas


--~--~-~--~~~---~--~~
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: Issue on joining objects/table

2008-02-12 Thread Nicolas Steinmetz

Malcolm Tredinnick a écrit :

> Ah, ok. So one solution is to twist your initial template a little bit.
> Normally, whenever you insert the outer "li" element (the headings), you
> really want to insert "New Heading" -- closing the
> previous inner section, displaying a heading and then starting a new
> inner section. The exception is the very first time around the loop when
> there's no previous section to close.

Ok, i see the point.

> So this should be close to what you're after:
> 
> 
> {% for item in user_skill %}
>{% ifchanged %}
>   {% ifnotequal forloop.counter 1 %}
>   
>   {% endifnotequal %}
>{{ item.name.domain }}
>   
>{% endifchanged %}
>   ...
> {% endfor %}
>   
>
> 
> 
> This will give slightly odd results if user_skill is empty, so you might
> want to test that first (or maybe you know otherwise that it's always
> going to contain content).

I test before if user_skill is empty or not.

At code level, it looks great but one bug. The first domain is repeated 
twice whereas for the rest it works like a charm. I will try to see if 
it"s a grouping issue or a template one.

Nicolas


--~--~-~--~~~---~--~~
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: Issue on joining objects/table

2008-02-12 Thread Nicolas Steinmetz

Malcolm Tredinnick a écrit :

> You don't mention which of the "ul" elements is coming out empty, but I
> guess this happens in the case where user_skill is empty. So wrap that
> section in an {% if user_skill %} template tag (wrap it around the 
> and close it after the closing ).

Oups I was not clear enough :

My code generates so far (a little bit simplified) :


 Framework
 
 Django


 Symfony
 
 
 Language
 
 Python


 PHP
 
 


Where as I would like to have :


 Framework
 
 Django
 Symfony
 
 
 Language
 
 Python
 PHP
 
 


I admit that with "ifchanged" and my initial query, I may be wrong for 
what I want to do. That's why I query some help :))

Nicolas


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



Issue on joining objects/table

2008-02-11 Thread Nicolas Steinmetz

Hello,

In my app, I have the following :
- "Userskill" allows a given user to link 1 to n skills thanks to a 
Foreign Key to "Skill" model
- In Skill model there is a foreign key to "Skilldomain".

I would like to display all the skills for a given user by skill domains.

I have such models (simplified) :

class Skilldomain(models.Model):
 name = models.CharField(_('Skill domain'), max_length=50)

class Skill(models.Model):
 name = models.CharField(_('Skill'), max_length=50)
 domain = models.ForeignKey(Skilldomain, verbose_name=_('Skill domain'))

class Userskill(models.Model):
 who = models.ForeignKey(User, verbose_name=_('Person'))
 name = models.ForeignKey(Skill, verbose_name=_('Skill'))

I tried a lot of things but should miss a point somewhere. My last 
attempt is something like based on :

user = User.objects.get(pk=1)
user_skill = user.userskill_set.all().select_related()
for k in user_skill:
 p = k.name
 print p.domain

{# -- Skills -- #}
{% if user_skill %}

{% trans "Skills" %}

{% for item in user_skill %}
{% ifchanged %}
{{ item.name.domain }}
{% endifchanged %}

{{ item.name }}


{% endfor %}


{% endif %}

This solution works except that I have a side effect with a  
that I do not wish.

I tried to do the same with "regroup" in template but could not manage 
to make it work in my case.


--~--~-~--~~~---~--~~
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: SVN7049 - bug with development server ?

2008-02-01 Thread Nicolas Steinmetz

Jarek Zgoda a écrit :

> I see this error frequently when using Firefox. Never saw this with
> Opera, IE or Safari.

I confirm it's with Firefox. I do not have this with konqueror.


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



SVN7049 - bug with development server ?

2008-01-31 Thread Nicolas Steinmetz

Hello,

On my Debian Lenny box, with Python 2.5.1, I have the following error 
the first time I generate a page. When I refresh the page, I have the 
normal output (ie listing css, html, images files)


Traceback (most recent call last):
   File 
"/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 
278, in run self.finish_response()
   File 
"/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 
317, in finish_response self.write(data)
   File 
"/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 
396, in write self.send_headers()
   File 
"/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 
460, in send_headers in self.send_preamble()
   File 
"/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 
378, in send_preamble 'Date: %s\r\n' % http_date()
   File "/usr/lib/python2.5/socket.py", line 262, in write self.flush()
   File "/usr/lib/python2.5/socket.py", line 249, in flush 
self._sock.sendall(buffer)
error: (32, 'Broken pipe')

Nicolas


--~--~-~--~~~---~--~~
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: i18n - gettext issue with simple quote

2007-11-30 Thread Nicolas Steinmetz

[EMAIL PROTECTED] a écrit :
> Hello,
> 
> In my po file, I need some french words with simple quote like :
> 
> #: models.py:497
> msgid "User's skills"
> msgstr "Compétences d\'un utilisateur"
> 
> But when I use compile-message.py , I got fatar errors and as a reason
> "Invalid control sequence".
> 
> I removed the "\" but same issue.

I retried with removing all \ and it just works. Do not know what I 
missed...

Sorry for the noise.


--~--~-~--~~~---~--~~
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: [i18n] Questions on how it works...

2007-11-13 Thread Nicolas Steinmetz

Nicolas Steinmetz a écrit :

> Any idea about this ?


my fault, I forgot the locale middleware and I set a "conf/locale" 
structure within my app whereas it should be just "locale".

This way, I do not need blocktrans any longer.

So it's solved...


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



[i18n] Questions on how it works...

2007-11-13 Thread Nicolas Steinmetz

Hello,

I read the i18n documentation but I'm not really at ease with it.

If I understood well :
* To translate models, I need to use gettext_lazy or ugettext_lazy
* In template :
** I need to set {% load i18n %} at the top of my template (should it be 
only in base.html or to any template part I call)
** "blocktrans" must be within a loop or if statement so that it works. 
There is no way to say that my template must be globally translated ? 
It's a little bit strange to set trans or blocktrans tag everywhere I 
need a translation... (I know that some element may not be translated 
but...)

So far, I start generated my po files but does not manage to get some 
values translated. I should have missed something but do not see what :-(

For ex, I tried with some values I get from CHOICES in my models :

{% blocktrans %}{{ profile.get_civility_display }}{% endblocktrans %}

I got :
KeyError at /cv/John-Doe/
u'profile.get_civility_display'

What sounds me strange is that I use gettext_lazy and no longer 
ugettext_lazy (maybe I generated po file when I used ugettext instead of 
_lazy).

Any idea about this ?
Nicolas


--~--~-~--~~~---~--~~
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: Comparing date

2007-10-30 Thread Nicolas Steinmetz

Doug B a écrit :
> Try just using the year attribute on the datetime instance.
> 
> {% ifequal training.start_date.year training.end_date.year %}
> ...

Thanks a lot. It works !
Nicolas


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



Comparing date

2007-10-30 Thread Nicolas Steinmetz

Hello,

Issue : I would like to compare date at year level only. Idea is to 
display the year only once if the two date are within the same year.

I have the following model :

class Training(models.Model):
 who = models.ForeignKey(User, verbose_name='Person')
 title = models.CharField('Name', maxlength=100)
 description = models.TextField('Description', blank=True)
 start_date = models.DateField('Start date',)
 end_date = models.DateField('End date', blank=True, null=True)

and the following template :

{% for training in user_training %}
 {# TODO : Fix date if start_date = end_date at year level #}
 {{ training.start_date|date:"Y" }} {% ifequal 
training.start_date training.end_date %} {% else %} {% if 
training.end_date %}- {{ training.end_date|date:"Y" }}{% endif %} {% 
endifequal %} : {{ training.title }} {% if training.description %}: {{ 
training.description }}{% endif %}
{% endfor %}

I tried with adding |date:"Y" in a ifequal condition but it looks it's 
not sufficient

Either it does not go into the else section. Same with a ifnotequal and 
reversing the logic.

Any idea?

Nicolas


--~--~-~--~~~---~--~~
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: Cab issue

2007-10-14 Thread Nicolas Steinmetz

[EMAIL PROTECTED] a écrit :
> Exception Value:  Template u'base.html' cannot be extended, because it
> doesn't exist


It's a "convention" in django that your main template is named 
"base.html". It should be place in the root directory of your template 
directory.

Let's imagine :
/templates/
/templates/base.html
/templates/cab/
/templates/yourapp/
...


--~--~-~--~~~---~--~~
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: disguising a django app as php?

2007-09-26 Thread Nicolas Steinmetz

omat a écrit :

> Any ideas / suggestions?

It sounds ridiculous for me and if you do not host the app, you'll have 
trouble with the hosting company for which the customer required a LAMP 
with a P like PHP whereas you need a LAMP with P like Python.

Being honest is imho the best way. So just prove that with django it 
will cost less and site will be built quicker with django than with a 
php framework. This make sens for me. Otherwise liing is not a solution 
for me.


--~--~-~--~~~---~--~~
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: Issue with regroup and sorting with foreign keys

2007-09-11 Thread Nicolas Steinmetz

Samuel Adam a écrit :
> I have had similar issues while sorting with foreignkeys, try
> specifying the sort like this :
> 
> {% regroup techskill.name.all|dictsort:"domain.id" by
> domain as grouped %}

Right ! You already told me about this a long long time ago. I just forgot.

Thanks samuel ! :)

Nicolas


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



Issue with regroup and sorting with foreign keys

2007-09-11 Thread Nicolas Steinmetz

Hello,

Below my model with which I have an issue :

"""
Technicat skills
"""

class DomainTechSkill(models.Model):
 name = models.CharField('Domaine de compétence technique', 
Maxlength=100, core=True)

class Techskill(models.Model):
 who = models.ForeignKey(User, verbose_name='Personne',)
 name = models.CharField('Compétences techniques', maxlength=100, 
core=True)
 domain = models.ForeignKey(DomainTechSkill, verbose_name='Domaine 
de compétences techniques',)

class Usertechskill(models.Model):
 who = models.ForeignKey(User, verbose_name='Personne',)
 name = models.ManyToManyField(Techskill, verbose_name='Compétence 
technique', filter_interface=models.HORIZONTAL, blank=True)

... my view (part of):
def cv_detail(request, firstname, lastname):
 user = User.objects.get(first_name=firstname, last_name=lastname)
 user_techskill = user.usertechskill_set.all()
 return render_to_response('cv/cv_detail.html', {'user_techskill': 
user_techskill, })

... and my template :

 {# -- technical skills -- #}
 {% if user_techskill %}
 Comptences techniques :
 {% for techskill in user_techskill %}
 {% regroup techskill.name.all|dictsort:"domain" by 
domain as grouped %}
 
  {% for group in grouped %}
  {{ group.grouper }} :
 {% for item in group.list %}
 {{ item.name }}{% if 
forloop.last %}.{% else %},{% endif %}
 {% endfor %}
 
  {% endfor %}
 
 {% endfor %}
 {% endif %}


Let's say I enter as technical skill / domain :
- HTML / Web
- CSS / Web
- Apache / Servee
- Portal / Information system
- Bind / Server
- CMS / Information System

I may have as a result and what I expect :

- Server : Apache, Bind
- Information system : CMS, Portal
- Web : HTML, CSS

but sometimes I also have :

- Server : Apache
- Information system : CMS, Portal
- Server : Bind
- Web : HTML, CSS

or any other combination of those values.

Before rewriting user_techskill in my view so that all the sorting and 
ordreing is in the view and no longer or less in the template, did I 
miss something or did I make something wrong ?

It's my last bug before I release my app so I would really appreciate 
any help solving this bug :-)

Regards,
Nicolas


--~--~-~--~~~---~--~~
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: django-rendertext released

2007-09-11 Thread Nicolas Steinmetz

Ole Laursen a écrit :

> There might be? I've never heard of that project and can't seem to
> find it on Google. Do you have a URL?

Yep, sorry :



Nicolas


--~--~-~--~~~---~--~~
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: django-rendertext released

2007-09-11 Thread Nicolas Steinmetz

Ole Laursen a écrit :

> We've just released django-rendertext 0.1, a Django app for using
> custom fonts on a web page for headings and the like. It works by
> dynamically creating images out of text snippets with a template tag,
> e.g. {{ "Hello world!"|rendertext:"gentium"}}. The images are cached
> in the file system and size, color and rotation is supported.

what is the difference with django-tipografy ? I admit I did not look at 
  the links you give yet, but at a first view, it seems there is an 
overlap between the two apps...

Nicolas


--~--~-~--~~~---~--~~
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: When 1.0 ?

2007-09-10 Thread Nicolas Steinmetz

est a écrit :
> Hi I am a new web developer in django. Could anyone tell me when will
> django go to 1.0? Will django support py3k? Is django worth learning
> compared with other web frameworks like turbogears, RoR?

based on what you can find when searching on the list :
- 1.0 : when ready :-)
- py3k : no
- it depends on you, not django I would say and it depends also on what 
you plan to do with your framework. For me, it's worth :-P

Nicolas


--~--~-~--~~~---~--~~
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: Django-based forum software?

2007-08-30 Thread Nicolas Steinmetz

Aaron Maxwell a écrit :
> Hi,
> 
> Does anyone know of a django forum app?  I.e., to build a site providing a 
> user forum.
> 
> This is kind of hard to search on - try googling for "django forum"...
> 





Regards,
Nicolas


--~--~-~--~~~---~--~~
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: Newbie Question: site working in dev, not in production...probable issue with httpd.conf

2007-07-02 Thread Nicolas Steinmetz

Wiley a écrit :
> Here's the ultra-newbie question of the day.
> 
> I have a lil' site running well under runserver, when I hook it up to
> apache2 and mod_python, something goes wrong.  For the EXACT same
> python/django code, the admin site and all URLS come up fine in the
> built-in server.  When I switch to the apache setup I get nothing but
> 404s, and I know its reading my urls file because it's saying it tried
> those urls.  Am I missing something obvious?
> 
> Here's my httpd.conf settings:
> 
> 
> SetHandler python-program
> PythonPath "[ '/usr/local/django_projects/beijing_eats/' ] +
> sys.path"
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE beijing_eats.settings

Try:

  PythonPath "[ '/usr/local/django_projects' ] + sys.path"

Nicolas


--~--~-~--~~~---~--~~
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: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-30 Thread Nicolas Steinmetz

For the record, I modified a little bit my object but the key was in 
precising a lot |dictsort like the following case :

{# -- Compétences techniques -- #}
{% if user_techskill %}
Comptences techniques :
{% for tskill in user_techskill %}
{% regroup tskill.name.all|dictsort:"domain.id" by domain as 
grouped %}

 {% for group in grouped %}
 {{ group.grouper }} :
{% for item in group.list %}
{{ item.name }},
{% endfor %}

 {% endfor %}

{% endfor %}
{% endif %}

Regards,
Nicolas


--~--~-~--~~~---~--~~
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: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-21 Thread Nicolas Steinmetz

Nicolas Steinmetz a écrit :
> Nicolas Steinmetz a écrit :
> [...]
> 
>> I tried this but the bug persists. Sometimes it works well (technical 
>> skills are well regrouped by technical domaines) but if I refresh, it's 
>> no longer the case.
>>
>> I even tried this on an easier object and it does not work more 
>> efficiently (user_skill in my view). If I do not add .order_by() in the 
>> view, and add the |dictsort:"" filter, I have the same bug. If I add the 
>> order_by() and the dictsort filter, bug remains. It only works well if I 
>> add the order_by() and remove the dictsort filter.
>>
>> However for the 1st object on which I had the bug, I cannot sort it in 
>> my views unless I decompose my model...
>>
>> Any other clue ?
> 
> So should I fill a ticket or do I make something wrong ?

small up before filling tickets :)

For a more readable view on my files :
<https://hg.unelectronlibre.info/mvmo/file/5af96e9e476b/cv/views.py>
<https://hg.unelectronlibre.info/mvmo/file/5af96e9e476b/cv/models.py> 
(line 38 > 138)
<https://hg.unelectronlibre.info/mvmo/file/5af96e9e476b/templates/cv/cv_detail.html>
 
(lines 108/116)


--~--~-~--~~~---~--~~
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: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-19 Thread Nicolas Steinmetz

Nicolas Steinmetz a écrit :
[...]

> I tried this but the bug persists. Sometimes it works well (technical 
> skills are well regrouped by technical domaines) but if I refresh, it's 
> no longer the case.
> 
> I even tried this on an easier object and it does not work more 
> efficiently (user_skill in my view). If I do not add .order_by() in the 
> view, and add the |dictsort:"" filter, I have the same bug. If I add the 
> order_by() and the dictsort filter, bug remains. It only works well if I 
> add the order_by() and remove the dictsort filter.
> 
> However for the 1st object on which I had the bug, I cannot sort it in 
> my views unless I decompose my model...
> 
> Any other clue ?

So should I fill a ticket or do I make something wrong ?

Regards,
Nicolas


--~--~-~--~~~---~--~~
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: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-18 Thread Nicolas Steinmetz

Florian Apolloner a écrit :
> I am not quite sure wheter my answer is correct, as you didn't post
> your view, 

My view is quite simple :

# Display the detail for a given CV
def cv_detail(request, firstname, lastname):
 user = User.objects.get(first_name=firstname, last_name=lastname)
 user_civilstate = user.civilstate_set.all()
 user_summary = user.summary_set.all()
 user_formation = user.formation_set.all()
 user_language = user.language_set.all()
 user_hobby = user.hobby_set.all()
 user_contact = user.contact_set.all()
 user_skill = user.skill_set.all().order_by('domain',)
 user_firm = user.entreprise_set.all().order_by('-start_date',)
 user_experience = user.experience_set.all().order_by('-start_date',)
 user_document = user.document_set.all()
 return render_to_response('cv/cv_detail.html', {'user_civilstate': 
user_civilstate, 'user_summary': user_summary, 'user_formation': 
user_formation, 'user_language': user_language, 'user_hobby': 
user_hobby, 'user_contact': user_contact, 'user_skill': user_skill, 
'user_firm': user_firm, 'user_experience': user_experience, 
'user_document': user_document})
# cv_detail = cache_page(cv_detail, 60 * 60 * 12)

> but I think this is your problem (copy from
> http://www.djangoproject.com/documentation/templates/#regroup):
> Note that {% regroup %} does not work when the list to be grouped is
> not sorted by the key you are grouping by! This means that if your
> list of people was not sorted by gender, you'd need to make sure it is
> sorted before using it, i.e.:
> {% regroup people|dictsort:"gender" by gender as grouped %}

I tried this but the bug persists. Sometimes it works well (technical 
skills are well regrouped by technical domaines) but if I refresh, it's 
no longer the case.

I even tried this on an easier object and it does not work more 
efficiently (user_skill in my view). If I do not add .order_by() in the 
view, and add the |dictsort:"" filter, I have the same bug. If I add the 
order_by() and the dictsort filter, bug remains. It only works well if I 
add the order_by() and remove the dictsort filter.

However for the 1st object on which I had the bug, I cannot sort it in 
my views unless I decompose my model...

Any other clue ?


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



Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-17 Thread Nicolas Steinmetz

Hello,

I have the following Model :

class Summary(models.Model):
 who = models.ForeignKey(User, unique=True, verbose_name='Personne')
 job_profile = models.CharField('Profil de poste', maxlength=100)
 summary = models.TextField('Résumé',)
 intervention_level = models.ManyToManyField(Interventionlevel, 
verbose_name='Niveau d\'intervention', filter_interface=models.HORIZONTAL)
 expert_domain = models.ManyToManyField(Expertdomain, 
verbose_name='Domaine d\'expertise', filter_interface=models.HORIZONTAL)
 functionnal_skill = models.ManyToManyField(Funcskill, 
verbose_name='Compétences fonctionnelles', 
filter_interface=models.HORIZONTAL)
 technical_skill = models.ManyToManyField(Techskill, 
verbose_name='Compétences techniques', filter_interface=models.HORIZONTAL)

and for ex I have :

class Techskill(models.Model):
 name = models.CharField('Compétences techniques', maxlength=100, 
core=True)
 domain = models.ForeignKey(DomainTechSkill, verbose_name='Domaine 
de compétences techniques',)

In my template, I use :

{% regroup item.technical_skill.all by domain as grouped %}

 {% for group in grouped %}
 {{ group.grouper }} :
{% for item in group.list %}
{{ item.name }},
{% endfor %}

 {% endfor %}


If I input in the following order (with a domain / name presentation) :
- Technology : HTML
- Technology : CSS
- Webserver : Apache
- Webserver : Lighttpd

I will have the right order :

 Technology : HTML, CSS,
 Webserver : Apache, Lighttpd


but if I had a new technology, like XML, I will have :


 Technology : HTML, CSS,
 Webserver : Apache, Lighttpd,
 Technology : XML,


How can I get the correct result which would be :


 Technology : HTML, CSS, XML,
 Webserver : Apache, Lighttpd,


Regards,
Nicolas


--~--~-~--~~~---~--~~
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: Bug with __str__(self) if we use "return %s %s" ???

2007-05-07 Thread Nicolas Steinmetz

Mike Axiak wrote:

> 
> Hi,
> 
> I copied the code exactly as you have it and tested, and -- as I
> expected -- it worked fine. Are you sure you set the first_name and
> last_name fields correctly?
> Perhaps you're looking at the wrong object?

Strange, it works well now. I did not know what I made wrong before :-/

Thanks anyway,
Nicolas




--~--~-~--~~~---~--~~
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: Bug with __str__(self) if we use "return %s %s" ???

2007-05-07 Thread Nicolas Steinmetz

Russell Keith-Magee wrote:

> On 5/4/07, Nicolas Steinmetz <[EMAIL PROTECTED]> wrote:
>>
>> > In Django admin (0.96), when I save data, I have :
>> >
>> > L'objet Photo "first_name last_name" a �t� modifi� avec succ�s
>> >

Oups :

The object Photo "first_name last_name" has been sucessfully 
modified

>> > Instead of :
>> >
>> > L'objet Photo "John Doe" a �t� modifi� avec succ�s, if I set John as
>> > first_name and Doe as last_name.

The object Photo "John Doe" has been sucessfully 
modified

> As a general guide when asking questions - If people don't understand
> the question, they're not likely to offer an answer. My French
> vocabulary is pretty much limited to ordering wine in restaurants, so
> I have no idea what your error messages mean, let alone what could be
> causing the problem.

Sorry :-)

Nicolas


--~--~-~--~~~---~--~~
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: Bug with __str__(self) if we use "return %s %s" ???

2007-05-04 Thread Nicolas Steinmetz

Any idea ?

Nicolas Steinmetz wrote:

> 
> Hello,
> 
> I have the following model :
> 
> class Trombi(models.Model):
> first_name = models.CharField("Pr�nom", maxlength=40)
> last_name = models.CharField("Nom", maxlength=40)
> photo = models.ImageField("Photo", height_field="80",
> width_field="80", upload_to="photos")
> url = models.SlugField(prepopulate_from=("first_name",
> "last_name"))
> 
> class Admin:
> list_display = ['first_name', 'last_name']
> list_filter = ['last_name']
> search_fields = ['last_name']
> 
> class Meta:
> verbose_name = "Photo"
> verbose_name_plural = "Photos"
> 
> def __str__(self):
> return "%s %s" % (self.first_name, self.last_name)
> 
> def get_absolute_url(self):
> return "/people/%s" % (self.url,)
> 
> In Django admin (0.96), when I save data, I have :
> 
> L'objet Photo "first_name last_name" a �t� modifi� avec succ�s
> 
> Instead of :
> 
> L'objet Photo "John Doe" a �t� modifi� avec succ�s, if I set John as
> first_name and Doe as last_name.
> 
> What's wrong ? Is it a conflict with User object ?
> 
> Regards,
> Nicolas
> 
> 
> 


--~--~-~--~~~---~--~~
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: IndexError at /admin/auth/user/1/- String index out of range & TypeError at /admin/auth/user/1/ - 'int' object is unsubscriptable

2007-05-04 Thread Nicolas Steinmetz

Any idea ?

[EMAIL PROTECTED] wrote:

> 
> Hello,
> 
> For one of my models, I did the following thing :
> 
> """
> Civil state
> """
> 
> class Civilstate(models.Model):
> CIVILITY_CHOICES = (
>  ('single', 'C�libataire'),
>  ('taken', 'Mari�'),
> )
> who = models.ForeignKey(User, unique=True,
> verbose_name='Personne', edit_inline=models.STACKED, num_in_admin=1,
> max_num_in_admin=1)
> photo = models.ImageField('Photo', height_field=80,
> width_field=80, upload_to="photos", blank=True)
> street = models.CharField('Adresse 1', maxlength=100, core=True)
> street_bis = models.CharField('Adresse 2', maxlength=100,
> core=True, blank=True)
> zipcode = models.IntegerField('Code postal', maxlength=5,
> core=True)
> city = models.CharField('Ville', maxlength=100, core=True)
> phone = models.CharField('T�l�hone', maxlength=20, core=True)
> mobile = models.CharField('Portable', maxlength=20, core=True,
> blank=True)
> civility = models.CharField('Statut matrimonial', maxlength=20,
> choices=CIVILITY_CHOICES, core=True)
> birthdate = models.DateField('Date de naissance', core=True)
> children = models.IntegerField('Nombre d\'enfants', core=True,
> blank=True)
> 
> def __str__(self):
> return self.city
> 
> class Admin:
> list_display = ('who',)
> list_filter = ['who',]
> search_fields = ['who',]
> 
> class Meta:
> verbose_name = "Etat civil"
> verbose_name_plural = "Etats civils"
> 
> 
> When I edit the form in Django admin (running vanillia 0.96 version)
> in a standalone mode, it works well. When I edit and save from "User"
> form and if it's empty, it fails with the following traceback which I
> do not understand :
> 
> Traceback (most recent call last):
> File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
> in get_response
>   77. response = callback(request, *callback_args, **callback_kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
> decorators.py" in _checklogin
>   55. return view_func(request, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   39. response = view_func(request, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
> main.py" in change_stage
>   329. new_object = manipulator.save(new_data)
> File "/usr/lib/python2.5/site-packages/django/db/models/
> manipulators.py" in save
>   165. if rel_new_data[related.opts.pk.name][0]:
> 
>   IndexError at /admin/auth/user/1/
>   string index out of range
> 
> If I fullfil the form in a standalone mode and then try to edit and
> save it from User form, I have the following traceback :
> 
> Traceback (most recent call last):
> File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
> in get_response
>   77. response = callback(request, *callback_args, **callback_kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
> decorators.py" in _checklogin
>   55. return view_func(request, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   39. response = view_func(request, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
> main.py" in change_stage
>   329. new_object = manipulator.save(new_data)
> File "/usr/lib/python2.5/site-packages/django/db/models/
> manipulators.py" in save
>   172. if f.core and not isinstance(f, FileField) and
> f.get_manipulator_new_data(rel_new_data, rel=True) in (None, ''):
> File "/usr/lib/python2.5/site-packages/django/db/models/fields/
> __init__.py" in get_manipulator_new_data
>   289. return new_data.get(self.name, [self.get_default()])[0]
> 
>   TypeError at /admin/auth/user/1/
>   'int' object is unsubscriptable
> 
> If I remove the edit_inline propertie, User form works well.
> 
> Any idea ?
> 
> Regards,
> Nicolas
> 
> 
> 


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



Bug with __str__(self) if we use "return %s %s" ???

2007-05-03 Thread Nicolas Steinmetz

Hello,

I have the following model :

class Trombi(models.Model):
first_name = models.CharField("Prénom", maxlength=40)
last_name = models.CharField("Nom", maxlength=40)
photo = models.ImageField("Photo", height_field="80",
width_field="80", upload_to="photos")
url = models.SlugField(prepopulate_from=("first_name", "last_name"))

class Admin:
list_display = ['first_name', 'last_name']
list_filter = ['last_name']
search_fields = ['last_name']

class Meta:
verbose_name = "Photo"
verbose_name_plural = "Photos"

def __str__(self):
return "%s %s" % (self.first_name, self.last_name)

def get_absolute_url(self):
return "/people/%s" % (self.url,)

In Django admin (0.96), when I save data, I have :

L'objet Photo "first_name last_name" a été modifié avec succès

Instead of :

L'objet Photo "John Doe" a été modifié avec succès, if I set John as
first_name and Doe as last_name.

What's wrong ? Is it a conflict with User object ?

Regards,
Nicolas


--~--~-~--~~~---~--~~
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: Generic View pass multiple objects

2007-04-30 Thread Nicolas Steinmetz

gsmith wrote:

> 
> Hello,
> I have a template file that when shown is going to be populated by
> data from two different tables.  I want to use the generic view
> 'list_detail.object_list'.  However, as far as I know I can only pass
> one queryset to the object_list view.  Is there a way that I can pass
> two QuerySet's?
> 
> For example this is how it works now
> 
> rso_news_info = {
> "queryset" : news.objects.all(),
> "template_object_name" : "news",
> }
> 
> I am wondering if I can use something like
> 
> rso_news_info = {
> "queryset" : news.objects.all(),
> "queryset" : leftnav.objects.all()
> "template_object_name" : "news",
> }
> 
> So that I would be able to have two block tags in my template
> news_list.html that display the data from both tables.
> 
> Any help would be appreciated.

I suggest you using extra_context parameter to add your objects within.

Ex :

urlpatterns = patterns('',
   (r'^$', 'django.views.generic.list_detail.object_list', dict(queryset=
Post.objects.all(),extra_context={'all_tags':
Tag.objects.all(), 'all_categories': Category.objects.all(),} )),
)

Nicolas


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



Integrating third parties script within django

2007-04-09 Thread Nicolas Steinmetz

Hello,

I read Flickr Integration page on wiki [1] and I see that the third parties
script FlickrClient was called through "from project.directory.file import
module"

I tried the same with another lib in my views.py file but it does not work :

ViewDoesNotExist at /
Could not import project.app.views. Error was: No module named lib.flickr

As flickr.py file is in /home/django/project/lib/

So how can I integrate such a third parties lib within Django ?

btw, I use 0.96 version of Django.

Regards,
Nicolas

[1] 


--~--~-~--~~~---~--~~
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: ABSOLUTE_URL_OVERRIDES issue

2007-03-03 Thread Nicolas Steinmetz

James Bennett wrote:

> I've just opened ticket #3646, which notes the problem here -- there's
> an inconsistency between the docs and how we actually look things up
> in ABSOLUTE_URL_OVERRIDES -- and a couple possible solutions.
> 
> Nicolas, for the time being you can work around this by specifying
> 'cab.language' in ABSOLUTE_URL_OVERRIDES instead of 'cab.Language'.

Thanks a lot, it works now like a charm :-)

Nicolas


--~--~-~--~~~---~--~~
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: ABSOLUTE_URL_OVERRIDES issue

2007-03-03 Thread Nicolas Steinmetz

Really nobody ? It would really help me if someone could take a look at
it...

Nicolas Steinmetz wrote:

> 
> Hello,
> 
> To use "Cab", I got a path issue and need to override get_absolute_url
> defined by James (I would like to avoid to change the models by itself to
> keep synchronized with its version).
> 
> James set :
> 
> def get_absolute_url(self):
> return "/languages/%s/" % self.slug
> 
> Issue is that for the language of the snippets, it points to
> http://localhost:8000/languages/python/ instead of
> http://localhost:8000/snippets/languages/python/
> 
> So James suggests me to use ABSOLUTE_URL_OVERRIDES to solve my issue. So I
> read
>
<http://www.djangoproject.com/documentation/settings/#absolute-url-overrides>
> but it lacks some explaination for my python level ;-)
> 
> I added the following piece of "code" in settings.py (is it the right
> place ?) but it does not work (it looks it's not take into account with
> django svn 4643).
> 
> ABSOLUTE_URL_OVERRIDES = {
> 'cab.Language' : lambda o: "/snippets/languages/%s/" % o.slug,
> }
> 
> What did I miss ?
> 
> Cheers,
> Nicolas
> 
> 
> 


--~--~-~--~~~---~--~~
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: ABSOLUTE_URL_OVERRIDES issue

2007-03-01 Thread Nicolas Steinmetz

Nicolas Steinmetz wrote:

> 
> Hello,
> 
> To use "Cab", I got a path issue and need to override get_absolute_url
> defined by James (I would like to avoid to change the models by itself to
> keep synchronized with its version).
> 
> James set :
> 
> def get_absolute_url(self):
> return "/languages/%s/" % self.slug
> 
> Issue is that for the language of the snippets, it points to
> http://localhost:8000/languages/python/ instead of
> http://localhost:8000/snippets/languages/python/
> 
> So James suggests me to use ABSOLUTE_URL_OVERRIDES to solve my issue. So I
> read
>
<http://www.djangoproject.com/documentation/settings/#absolute-url-overrides>
> but it lacks some explaination for my python level ;-)
> 
> I added the following piece of "code" in settings.py (is it the right
> place ?) but it does not work (it looks it's not take into account with
> django svn 4643).
> 
> ABSOLUTE_URL_OVERRIDES = {
> 'cab.Language' : lambda o: "/snippets/languages/%s/" % o.slug,
> }
> 
> What did I miss ?
> 
> Cheers,
> Nicolas

No idea ?


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



ABSOLUTE_URL_OVERRIDES issue

2007-02-28 Thread Nicolas Steinmetz

Hello,

To use "Cab", I got a path issue and need to override get_absolute_url
defined by James (I would like to avoid to change the models by itself to
keep synchronized with its version).

James set :

def get_absolute_url(self):
return "/languages/%s/" % self.slug

Issue is that for the language of the snippets, it points to
http://localhost:8000/languages/python/ instead of
http://localhost:8000/snippets/languages/python/

So James suggests me to use ABSOLUTE_URL_OVERRIDES to solve my issue. So I
read

but it lacks some explaination for my python level ;-)

I added the following piece of "code" in settings.py (is it the right
place ?) but it does not work (it looks it's not take into account with
django svn 4643).

ABSOLUTE_URL_OVERRIDES = {
'cab.Language' : lambda o: "/snippets/languages/%s/" % o.slug,
}

What did I miss ?

Cheers,
Nicolas


--~--~-~--~~~---~--~~
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: Django and Eclipse Autocomplete NOT WORKING

2007-02-19 Thread Nicolas Steinmetz

Igor Guerrero wrote:

> Apparently is a random error, I use the svn version, and with one project
> it works and with another don't, maybe is a PyDEV bug, but I don't know.

Hmm strange and what a pity ! :(

I hope it will be solved with next stable version :-)


--~--~-~--~~~---~--~~
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: Django and Eclipse Autocomplete NOT WORKING

2007-02-15 Thread Nicolas Steinmetz

Igor Guerrero wrote:

> You must add the app dir and django dir to the PYTHON_PATH env variable in
> the preferrence menu and rescan the PATH.

It worked well with 0.95 version (just need to add django dir to the PYTHON
PATH of Eclipse) but with svn version it looks it does not work any longer
for me. Any idea about this ?

Nicolas


--~--~-~--~~~---~--~~
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: Generic views and filtering

2007-01-20 Thread Nicolas Steinmetz

natebeaty wrote:

> 
> You can do this without a wrapper -- your url entry was close:
> 
>
(r'^tag/(?P[-\w]+)/$','django.views.generic.list_detail.object_detail',
> dict(queryset=Tag.objects.all(), template_object_name='tag',
> slug_field='url')),
> 
> and you'll get a list in /templates/tags/tag_detail.html called
> post_set:
> 
> posts matching tag: "{{ tag.name }}"
> 
> {% for object in tag.post_set.all %}
> {{ object.title }}
> {% endfor %}
> 

Oh, I just saw your answer. I already did a wrapper but I would test your
solution within a similar case I have to handle.

Thanks for all your answers,
Nicolas


--~--~-~--~~~---~--~~
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: Generic views and filtering

2007-01-15 Thread Nicolas Steinmetz


David Zhou wrote:



On Jan 12, 2007, at 6:25 PM, Nicolas Steinmetz wrote:


Do I have to do as James [1] suggests, ie to filter it in views.py
with some generic views methodes ?


That's the way I do it.  It's a very simple wrapper, and also allows
me to add a host of other things into the context.


Ok I'll take a look at it during the week if I get some free time :-/

Thanks for your answer !

Nicolas


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



Generic views and filtering

2007-01-12 Thread Nicolas Steinmetz

Hello,

I have a few question with generic views as I can't manage to have all posts
related to a tag or category

My model is :

class Post(models.Model):
author = models.ForeignKey(User)
title = models.CharField(maxlength=50)
summary = models.TextField(blank=True)
message = models.TextField()
category = models.ManyToManyField(Category)
tag = models.ManyToManyField(Tag, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
pub_date = models.DateTimeField('Date de publication',
auto_now_add=True)
pub_status = models.BooleanField('Publie ?', default=True)
url = models.SlugField(prepopulate_from=("title",))

class Tag(models.Model):
name = models.CharField(maxlength=50)
description = models.TextField(blank=True)
url = models.SlugField(prepopulate_from=("name",))

I try to play around with something similar to this in urls.py :

(r'^tag/(?P[-\w]+)/$', 'object_list', dict(queryset=
Post.objects.filter(tag='slug_field'), slug_field= 'url', )),

but did not manage to get anything except errors.

Idea is that all url with /tag/foo gives all posts that have the "foo" tag.

What would be the correct solution ? Do I have to do as James [1] suggests,
ie to filter it in views.py with some generic views methodes ?

So far I run .95 but can move to svn if it is worth :-)

Regards,
Nicolas

[1]



--~--~-~--~~~---~--~~
 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: Django and mod_python issues

2006-12-05 Thread Nicolas Steinmetz

Tipan a écrit :

> PythonPath "['d:/program files/xampp/htdocs/myproject'] + sys.path"

Try : PythonPath "['d:/program files/xampp/htdocs/'] + sys.path"

Nicolas


--~--~-~--~~~---~--~~
 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: manage.py can't see project

2006-12-01 Thread Nicolas Steinmetz

[EMAIL PROTECTED] a écrit :
> Please. Anyone... I just want to be able to use manage.py AND the
> project!

- are you sure that django is well installed on your server ?

- In your apache conf, do you have something like :


 SetHandler mod_python
 PythonHandler django.core.handlers.modpython
 SetEnv DJANGO_SETTINGS_MODULE myproject.settings
 PythonDebug On
 PythonPath "['/path/to/django'] + sys.path"


Take care that your django project is into /path/to/django/myproject in 
previous exemple ; adapt to it.

- do you have mod_python and apache2 ?

- do python manage.py * works better than python2.4 manage.py ?

- are you sure that one file was not corrupted during your migration ?

HIH,
nicolas


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



Small comments on tutorial (improvements inside)

2006-11-27 Thread Nicolas Steinmetz

Hi,

I was questionning about generic views a few days ago and I remembered it
was covered on tutorial4 but as I did not have tutorial files longer on my
PC, I was unable to retrieve them by memory.

So to see how generic views could be handled, I had to start from tutorial
1.

Therefore, I think it could be worth to add the files that have been
edited/created/updated at each step so that users can check what they write
to what they should have or could take files from a step to do a particular
step (for ex, to get files from part 3 to be able to handle just part 4).

All the files are available here if you want to take them :
- 
- 
- 
- 

Regards,
Nicolas


--~--~-~--~~~---~--~~
 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: [patch] Generating slug for words with accents

2006-11-16 Thread Nicolas Steinmetz

Maciej Bliziński a écrit :

> I'm including a patch with "from" and "to" constants extended with all
> the characters I found on Wikipedia that seemed to be of any use. This
> should cover all the Slavic countries except those which use cyrylic
> alphabet.

Was this page commit to svn version of django, as in 0.95 I was facing 
this issue with french accents.

Nicolas


--~--~-~--~~~---~--~~
 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: runserver and static files

2006-11-14 Thread Nicolas Steinmetz

Jean-Luc a écrit :

> I used media in place of site_media for directory name
> It seems media shouldn't be used ?

As media is set/defined for media admin in settings.py, I guess there is 
a conflict between the two values. With a different name (like 
site_media) it works.

> Thanks Nicolas

You're welcome :)


--~--~-~--~~~---~--~~
 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: runserver and static files

2006-11-13 Thread Nicolas Steinmetz

Jean-Luc wrote:

> igor Guerrero a écrit :
> 
>> Django dont serve media files, that is the job of the production server
>> but if yo are using the development server: you can try this:
>>
>> http://www.djangoproject.com/documentation/static_files/

Based on above doc, I had same trouble as you Jean Luc but managed to
succeed, here is the key :

All my django projects are in /home/django so I have /home/django/myproject.
If you create a directory site_media within this one you should add in
urls.py :

(r'^site_media/(?P.*)$', 'django.views.static.serve',
{'document_root': '/home/django/myproject/site_media', 'show_indexes':
True}),

Then, in your template, you'll have :



... if your css file is /home/django/myproject/site_media/css/style.css

HTH,
Nicolas


--~--~-~--~~~---~--~~
 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: Displaying ManyToMany relation in template

2006-11-06 Thread Nicolas Steinmetz

Nicolas Steinmetz wrote:

> In my views.py, do I need to set/declare anything about this ?
> 
> If I just add the previous piece of code, I have a template error with
> this line highlighted - I do not have it with me :-/ :
> {% for category in  post.category.all %}

ok my fault, I already had some variable called category so it was the mess.

After some code cleaning, it's ok - sorry for the noise.

Nicolas


--~--~-~--~~~---~--~~
 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: Displaying ManyToMany relation in template

2006-11-06 Thread Nicolas Steinmetz

Nikolaus Schlemm a écrit :
> hi,
> 
> try something like the following:
> 
>> {% if latest_posts %}
>> {% for post in latest_posts %}
>> 
>> {{ post.title }}
>> 
>> publié le {{
>> post.pub_date|date:"l d F Y à H:i" }}, dans la catégorie
> 
> {% for category in  post.category.all %}
>   {{ category.title }}
> {% endfor %}

In my views.py, do I need to set/declare anything about this ?

If I just add the previous piece of code, I have a template error with 
this line highlighted - I do not have it with me :-/ :
{% for category in  post.category.all %}

Nicolas


--~--~-~--~~~---~--~~
 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: Displaying ManyToMany relation in template

2006-11-02 Thread Nicolas Steinmetz

Nikolaus Schlemm a écrit :
> {% for category in  post.category.all %}
>   {{ category.title }}
> {% endfor %}
> 

[...]

> -> http://www.djangoproject.com/documentation/models/many_to_many/

Indeed, I was looking for template code and did not look at the output 
of the shell ;-)

I'll test all of this tonight :)

Thanks a lot,
Nicolas


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



Displaying ManyToMany relation in template

2006-10-31 Thread Nicolas Steinmetz

Hello,

I'm testing django with a blog and I have the following issue :

I have the following model :

class Post(models.Model):
author = models.ForeignKey(User)
title = models.CharField(maxlength=50)
summary = models.TextField(blank=True)
message = models.TextField()
category = models.ManyToManyField(Category)
tag = models.ManyToManyField(Tag, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
pub_date = models.DateTimeField('Date de publication',
auto_now_add=True)
pub_status = models.BooleanField('Publie ?', default=True)

and the following template :

{% if latest_posts %}
{% for post in latest_posts %}

{{ post.title }}

publié le {{ post.pub_date|date:"l 
d F Y à H:i" }},
dans la catégorie {{ post.category }}
{{ post.summary }}
{{ post.tag }}
{% endfor %}
{% else %}
Aucun article ne correspond aux critères.
{% endif %}

I would like that post.category and post.tag display all tags or categories
linked to a postfor the related post.

I tried to use "cycle" and some "for" loops but it does not work (or I do
not handle it correctly).

Could someone explained how can I handle such an easy (?) thing ?

Thanks in advance,
Nicolas


--~--~-~--~~~---~--~~
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: [tool] Autodoc (a script to grap and generate django documentation at html format)

2006-10-14 Thread Nicolas Steinmetz

Jyrki Pulliainen wrote:

> Own trivial projects are the best way to learn things. Have fun diving
> in to that world =)

Done in a cleaner way (with use of pysvn and docutils lib).

Nicolas 



--~--~-~--~~~---~--~~
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: [tool] Autodoc (a script to grap and generate django documentation at html format)

2006-10-13 Thread Nicolas Steinmetz

Jyrki Pulliainen wrote:

> Script seems to work. However: Python-docutils package (at least on my
> Ubuntu Dapper) ships with buildhtml.py-script, which can be found in
> /usr/share/python-docutils/ directory. That recurses through
> directories converting all .txt files to .html. Recursive conversion
> is default behaviour and it can be changed with a switch. That way, a
> 2 line command line script would do the same thing that your thing.

That's what I was afraid of ;-)
 
> Though, making that one, you've propably learned something. If you
> want to process your script further, I'd suggest exploring the
> docutils package for generating the html with python instead of
> calling command line script. Would make the solution neater. Also, the
> svn has a client libraries for python too.

I know it's not the perfect script and that it could be optimised in many
ways. As I discover the python world, I tried to make a first simple
script. I was guessing that docutils could be used directly, I now have to
dive into this (and also into svn lib...).

Nicolas


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



[tool] Autodoc (a script to grap and generate django documentation at html format)

2006-10-13 Thread Nicolas Steinmetz

Hi,

New to django/python, and as I work often in the train, I was interested in
reading the djando doc offline.

So I wrote my first python script that :
* grap last version of the doc on the svn
* generate html version of all files (via rst2html).

autodoc is available here :



It may help some of you, that's why I report it here ;-)

I'm open to all your remarks/comments/suggestions

Nicolas


--~--~-~--~~~---~--~~
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: 'bool' object has no attribute 'get' ??

2006-10-13 Thread Nicolas Steinmetz

Russell Keith-Magee a écrit :

> Sorry for the long delay in responding to this message.

no problem, it happens ;)

> Django models can have multiple foreign keys; however, there are some
> known issues with manipulators on models with self-referential foreign
> keys that give the error message you are describing.
> 
> A good starting point is http://code.djangoproject.com/ticket/2536 -
> this ticket has references to a few other tickets with similar
> problems. Some of these tickets may give you some hints for
> workarounds.

Thanks for your support, I'll take a look at it during the week end :-)

Nicolas


--~--~-~--~~~---~--~~
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: 'bool' object has no attribute 'get' ??

2006-10-12 Thread Nicolas Steinmetz

Anyone has an idea about this as I would like to set this key so that I can
have threaded comments.

Otherwise what would you suggest me to implement threaded comments ?

Nicolas

Nicolas Steinmetz wrote:

> 
> Hello,
> 
> I have the following code but I do not understand why I have the error
> below... could someone help me ?
> 
> class Comment(models.Model):
> author = models.CharField(maxlength=50)
> email = models.EmailField()
> title = models.CharField(maxlength=50)
> comment = models.TextField()
> post = models.ForeignKey(Post)
> parent = models.ForeignKey('self', blank=True, null=True,
> related_name='child')
> submitted_at = models.DateTimeField(auto_now_add=True)
> pub_date = models.DateTimeField()
> pub_status = models.BooleanField()
> 
> def __str__(self):
> return self.comment
> 
> class Admin:
> list_display = ('author', 'title', 'pub_status')
> list_filter = ['pub_date']
> date_hierarchy = 'pub_date'
> search_fields = ['author', 'title', 'comment']
> 
> AttributeError at /admin/blog/comment/add/
> 'bool' object has no attribute 'get'
> Request Method: GET
> Request URL:http://localhost:8000/admin/blog/comment/add/
> Exception Type: AttributeError
> Exception Value:'bool' object has no attribute 'get'
> Exception
> Location:  
> /usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/related.py
> in get_manipulator_fields, line 116
> 
> 
> 
> 
> 


--~--~-~--~~~---~--~~
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 Relation vs ManyToMany (was Re: Organisational question)

2006-10-08 Thread Nicolas Steinmetz

Hi,

John Sutherland wrote:

> class BlogPost(models.Model):
>  categories = models.ManyToManyField(Category)
> 
> It may be worth having a look at the generic relationships [1] stuff
> and the Tag application used as an example. While the GR stuff in the
> Django admin is truly horrible, you can easily write a couple of
> views and maybe a custom manipulator to tidy things up.
> 
> [1]  generic_relations/>

What the pros & cons for each method ?

As the generic relation lacks of some explaination :
- do we necessary import "content type" contrib ?
- do we necessary need to add in first object :
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = models.GenericForeignKey()
- What would be the difference between :

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 Animal(models.Model):
common_name = models.CharField(maxlength=150)
latin_name = models.CharField(maxlength=150)
tags = models.GenericRelation(TaggedItem)

and :

class TaggedItem(models.Model):
"""A tag on an item."""
tag = models.SlugField()

class Animal(models.Model):
common_name = models.CharField(maxlength=150)
latin_name = models.CharField(maxlength=150)
tags = models.ManyToManyField(TaggedItem)

??

Thanks in advance,
Nicolas


--~--~-~--~~~---~--~~
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: 'bool' object has no attribute 'get' ??

2006-10-06 Thread Nicolas Steinmetz

Nicolas Steinmetz wrote:

> class Comment(models.Model):
> author = models.CharField(maxlength=50)
> email = models.EmailField()
> title = models.CharField(maxlength=50)
> comment = models.TextField()
> post = models.ForeignKey(Post)
> parent = models.ForeignKey('self', blank=True, null=True,
> related_name='child')

It looks django do not like multiple ForeignKey... I'll bypass it in a
different way ;)


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



'bool' object has no attribute 'get' ??

2006-10-06 Thread Nicolas Steinmetz

Hello,

I have the following code but I do not understand why I have the error
below... could someone help me ?

class Comment(models.Model):
author = models.CharField(maxlength=50)
email = models.EmailField()
title = models.CharField(maxlength=50)
comment = models.TextField()
post = models.ForeignKey(Post)
parent = models.ForeignKey('self', blank=True, null=True,
related_name='child')
submitted_at = models.DateTimeField(auto_now_add=True)
pub_date = models.DateTimeField()
pub_status = models.BooleanField()

def __str__(self):
return self.comment

class Admin:
list_display = ('author', 'title', 'pub_status')
list_filter = ['pub_date']
date_hierarchy = 'pub_date'
search_fields = ['author', 'title', 'comment']

AttributeError at /admin/blog/comment/add/
'bool' object has no attribute 'get'
Request Method: GET
Request URL:http://localhost:8000/admin/blog/comment/add/
Exception Type: AttributeError
Exception Value:'bool' object has no attribute 'get'
Exception
Location:   
/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/related.py
in get_manipulator_fields, line 116




--~--~-~--~~~---~--~~
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: Organisational question

2006-10-01 Thread Nicolas Steinmetz

John Sutherland wrote:
 
> On 1 Oct 2006, at 17:02, Nicolas Steinmetz wrote:
>> to have 3 app (a blog app, a tutorial app and a category app) ? In
>> the second case, the questions are :
> 
> I would suggest this is the way to go, if you added another app, say
> a photo gallery or something, you can add photos to categories.

I'm happy to read such an answer as I was starting to code when the question
arise and was very afraid that it was not possible...
 
>> 1. Is it possible to set "bridge" between apps in django ?
> 
> Yep, you import the models...
> 
> from myproject.apps.categories.models import Category
> 
> then you can do something along the lines of:
> 
> class BlogPost(models.Model):
>  categories = models.ManyToManyField(Category)
> 
> It may be worth having a look at the generic relationships [1] stuff
> and the Tag application used as an example. While the GR stuff in the
> Django admin is truly horrible, you can easily write a couple of
> views and maybe a custom manipulator to tidy things up.
> 
> Hope that helps, John.

It helps a lot !!

Thantks to you and Pedro Lima for your answers and reactivity ! :-)

Have a nice end of week end,
Nicolas


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



Organisational question

2006-10-01 Thread Nicolas Steinmetz

Hello,

I have a project for which I need :
- a blog like app
- a tutorial app (in which I'll publish tutorials...)

I would like to be able to share categories between blog & tutorial app.
Thus, if i have a theme "django" for ex, if I look at this theme, I would
be able to see posts from blog and tutorials from tutorial app.

In django words, what's the best way to implement it ?

a global application in which I have blog and tutorial and of course common
categories or to have 3 app (a blog app, a tutorial app and a category
app) ? In the second case, the questions are :

1. Is it possible to set "bridge" between apps in django ?
2. If yes, how do we make it ?

TIA,
Nicolas


--~--~-~--~~~---~--~~
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: Help about tutorial1 (about Poll object)

2006-08-25 Thread Nicolas Steinmetz

Waylan Limberg a écrit :

> Did you close your shell and restart it so that the changes can be imported?

No I did not.

As my (python) shell was open, I only did :

from mysite.polls.models import Poll, Choice

> I just checked the tutorial and you aren't expressly told that you
> have to do so, although it is implied. I suppose this is because a
> basic understanding of python is expected.

Unless you have just modified it, it is indeed :

"Let's jump back into the Python interactive shell by running python 
manage.py shell again:"

Anyway, thanks for your support, I'll see all of this tomorrow ;-)

Have a nice week end,
Nicolas


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



Help about tutorial1 (about Poll object)

2006-08-25 Thread Nicolas Steinmetz

Hello,

I'm new in Django (so hello world :) ) but I have one question about
tutorial1.

Cf : http://www.djangoproject.com/documentation/tutorial1/

In polls/models.py, we have already two classes :

from django.db import models

# Create your models here.
class Poll(models.Model):
 question = models.CharField(maxlength=200)
 pub_date = models.DateTimeField('date published')

class Choice(models.Model):
 poll = models.ForeignKey(Poll)
 choice = models.CharField(maxlength=200)
 votes = models.IntegerField()

Do we have to add __str__() methodes after pub_date and votes lines or
to remove them ?

If I do :

from django.db import models
import datetime

# Create your models here.
class Poll(models.Model):
 question = models.CharField(maxlength=200)
 pub_date = models.DateTimeField('date published')

 def __str__(self):
 return self.question

 def was_published_today(self):
 return self.pub_date.date() == datetime.date.today()

class Choice(models.Model):
 poll = models.ForeignKey(Poll)
 choice = models.CharField(maxlength=200)
 votes = models.IntegerField()

 def __str__(self):
 return self.choice

it seems it does not work... and I do not have :

# Make sure our __str__() addition worked.
 >>> Poll.objects.all()
[]

instead of it I have :

# objects.all() displays all the polls in the database.
 >>> Poll.objects.all()
[]

Thanks for your support :)
Nicolas


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