Re: 'str' object has no attribute '_meta' while using comment system

2008-11-26 Thread Chatchai Neanudorn
what happen if form = "" ?

better to use meaning full object, you will need to use form in advance

2008/11/27 izzy <[EMAIL PROTECTED]>

>
> Yes I've done that.
>
> def packagingreport_details(request, object_id):
>report = get_object_or_404(PackagingReport, pk=object_id)
>user = request.user
>messages = ''
>errors = ''
>if report.author == user:
>form = report
>else:
>form = ''
>errors = 'You are not allowed to view this report.'
>return render_to_response('shiftmanager/
> packagingreport_details.html', {'form': form, 'messages': messages,
> 'errors': errors})
>
>
> The context form is a PackagingReport Object
>
> On Nov 27, 9:51 am, "Chatchai Neanudorn" <[EMAIL PROTECTED]> wrote:
> > {% get_comment_count for *form *as comment_count %}
> >
> > make sure you put the right object (in your code is form, what is it? do
> you
> > have template context names form?) for comment templatetag and it is
> > available
> >
> > chatchai
> >
> > 2008/11/27 izzy <[EMAIL PROTECTED]>
> >
> >
> >
> > > Hi all.
> >
> > > I've been having a problem regarding my app using comment system in
> > > Django1.0.2.
> >
> > > I've used comment so that anyone can comment on the report. When I
> > > view the report with the comment using the user that writes a comment
> > > it will raise no error but when I tried to login as different user I
> > > can't it raises an error:
> >
> > > Template error
> >
> > > In template d:\smp\templates\shiftmanager
> > > \productionreport_details.html, error at line 272
> >
> > > Caught an exception while rendering: 'str' object has no attribute
> > > '_meta'
> >
> > > 270 
> > > 271 {% load comments %}
> > > 272 {% get_comment_count for form as comment_count %}
> > > 273 This Report has {{ comment_count }} comments
> > > 274 
> > > 275 {% get_comment_list for form as comment_list %}
> > > 276 {% for comment in comment_list %}
> >
> > > please help
> >
>

--~--~-~--~~~---~--~~
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: 'str' object has no attribute '_meta' while using comment system

2008-11-26 Thread Chatchai Neanudorn
{% get_comment_count for *form *as comment_count %}

make sure you put the right object (in your code is form, what is it? do you
have template context names form?) for comment templatetag and it is
available

chatchai

2008/11/27 izzy <[EMAIL PROTECTED]>

>
> Hi all.
>
> I've been having a problem regarding my app using comment system in
> Django1.0.2.
>
> I've used comment so that anyone can comment on the report. When I
> view the report with the comment using the user that writes a comment
> it will raise no error but when I tried to login as different user I
> can't it raises an error:
>
> Template error
>
> In template d:\smp\templates\shiftmanager
> \productionreport_details.html, error at line 272
>
> Caught an exception while rendering: 'str' object has no attribute
> '_meta'
>
> 270 
> 271 {% load comments %}
> 272 {% get_comment_count for form as comment_count %}
> 273 This Report has {{ comment_count }} comments
> 274 
> 275 {% get_comment_list for form as comment_list %}
> 276 {% for comment in comment_list %}
>
>
> please help
> >
>

--~--~-~--~~~---~--~~
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: Moving django site from linux to windows

2008-11-19 Thread Chatchai Neanudorn
Hi,

Try this,
http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer

Hope this help

Chatchai

2008/11/19 seperelli <[EMAIL PROTECTED]>

>
> Dear,
> I have a site that is working with django,mysql,phyton on a linux
> system.
> This site should be put on a windows system where iis is allready
> running.
> I installed phyton and i think i installed django as well. I made a
> new virtual directory and copied the source files from the site.
> Ad i never worked with phyton or django, i have some problems,
> helloworld.py:
> Hello, World! Internal Server Error
> An error occurred processing this request.
>
> Request handler failed
>
> Traceback (most recent call last):
>  File "D:\Python25\lib\site-packages\Http\Isapi.py", line 48, in
> Request
>imp.load_source(Name, Env.SCRIPT_TRANSLATED).Request
> AttributeError: 'module' object has no attribute 'Request'
>
>
> Anyone that can help? or knows where i can find some extra info?
>
> Greetings,
>
> Sebastian
>
> >
>

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



Re: How to get comment_count in view?

2008-11-02 Thread Chatchai Neanudorn
from django.contrib.comments.models import Comment
from post.models import Post

#get comments for model
Comment.objects.for_model(Post).count()

#get comment for instance
Comment.objects.for_model(Post.objects.get(id=1)).count()

2008/11/2 David.D <[EMAIL PROTECTED]>

>
> I can get comment_count in templates:
>
> {% get_comment_count for object as comment_count %}
>
>
> But how to get it in my view?
> >
>

--~--~-~--~~~---~--~~
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: Template inherite and direct_to_template

2008-08-26 Thread Chatchai Neanudorn
Yes, it looks like *extra_context *is not* *available for rendering.

Don't know how to fix, finally use templatetag to do this task.

Thanks, Chachai

2008/8/27 Malcolm Tredinnick <[EMAIL PROTECTED]>

>
>
> On Tue, 2008-08-26 at 07:10 -0700, chatchai wrote:
> > Hi ,
> >
> > It's not easy to explain so please look at codes below,
> >
> > #url.py
> > base_context = {
> > 'books' : Book.objects.all(),
> > }
> >
> > urlpatterns = patterns('',
> > (r'^$', direct_to_template, {'extra_context': base_context,
> > 'template': 'base.html' }),
> > (r'^books/', include('book.urls')),
> > )
> > -
> >
> > #base.html
> > 
> > ...
> > {% block content %}
> > ...
> > {% endblock %}
> >
> > Books
> > {% for book in books%}
> >   {{ book.title }}
> > {% endfor %}
> > 
> > -
> >
> > #book_detail.html
> > {% extends "base.html" %}
> > {% block content %}
> > {{ object.title }}
> > {% endblock %}
> >
> > -
> > I want book_detail inherite book list from base.html and let them
> > render block content by themself. Code above should work but not.
>
> It's not clear what the problem is, since you just say "it doesn't work"
> without giving details of what actually happens. However, I can see at
> least two problems:
>
> If you're expecting book_detail.html to be rendered, then the problem is
> that it isn't mentioned in the URL configuration. You are telling Django
> to render book.html, not book_detail.html.
>
> If the problem is that the results aren't changing when you update the
> book lists, this is because the queryset is only going to be evaluated
> once. Read the introductory section of the generic views documentation
> to see how to change that.
>
> Regards,
> Malcolm
>
>
>
> >
>

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



Re: Django + tiny_mce

2008-07-08 Thread Chatchai Neanudorn
Ok, Got you. Where is retrun code for
/tiny_mce/tiny_mce.js<http://192.168.1.4:8000/tiny_mce/tiny_mce.js>itself,
Did you mean all js under /tiny_mce cannot be loadded by django?
What is environment you are working on?

2008/7/9 Chatchai Neanudorn <[EMAIL PROTECTED]>:

> http://192.168.1.4:8000/tiny_mce/tiny_mce.js vs [08/Jul/2008 19:37:23]
> "GET /tiny_mce/langs/en.js HTTP/1.1" 404 1771
>
> What is "lang" at the right side?
>
> Chatchai
>
> 2008/7/9 LRP <[EMAIL PROTECTED]>:
>
>
>> Hi,
>>
>> Thanks to all for responses, but puzzle persists...
>>
>> Mathias, I added the slash. Still can't see the tiny_mce edit bar.
>> But it does provide a clue: Output of runserver now looks like:
>>
>> [08/Jul/2008 19:37:17] "GET /admin/ HTTP/1.1" 200 4851
>> [08/Jul/2008 19:37:20] "GET /admin/flatpages/flatpage/ HTTP/1.1" 200
>> 2817
>> [08/Jul/2008 19:37:23] "GET /admin/flatpages/flatpage/2/ HTTP/1.1" 200
>> 5187
>> [08/Jul/2008 19:37:23] "GET /admin/jsi18n/ HTTP/1.1" 200 803
>> [08/Jul/2008 19:37:23] "GET /tiny_mce/langs/en.js HTTP/1.1" 404 1771
>> [08/Jul/2008 19:37:24] "GET /tiny_mce/themes/simple/editor_template.js
>> HTTP/1.1" 404 1834
>>
>> If I enter http://192.168.1.4:8000/tiny_mce/tiny_mce.js, I still see:
>> var tinymce={majorVersion:'3',minorVersion:'0.8'...
>>
>> Mario,
>>
>> I'm serving through the development server , runserver, not Apache.
>> Also, the model is buried in django.contrib.flatpages somewhere. I
>> would think that James Bennett would have mentioned something about
>> adding to the model if it were required. I'll keep you idea in mind,
>> however.
>>
>> Thanks again to all,
>>
>> Lloyd
>>
>>
>>
>> >>
>>
>

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

2008-07-08 Thread Chatchai Neanudorn
http://192.168.1.4:8000/tiny_mce/tiny_mce.js vs [08/Jul/2008 19:37:23] "GET
/tiny_mce/langs/en.js HTTP/1.1" 404 1771

What is "lang" at the right side?

Chatchai

2008/7/9 LRP <[EMAIL PROTECTED]>:

>
> Hi,
>
> Thanks to all for responses, but puzzle persists...
>
> Mathias, I added the slash. Still can't see the tiny_mce edit bar.
> But it does provide a clue: Output of runserver now looks like:
>
> [08/Jul/2008 19:37:17] "GET /admin/ HTTP/1.1" 200 4851
> [08/Jul/2008 19:37:20] "GET /admin/flatpages/flatpage/ HTTP/1.1" 200
> 2817
> [08/Jul/2008 19:37:23] "GET /admin/flatpages/flatpage/2/ HTTP/1.1" 200
> 5187
> [08/Jul/2008 19:37:23] "GET /admin/jsi18n/ HTTP/1.1" 200 803
> [08/Jul/2008 19:37:23] "GET /tiny_mce/langs/en.js HTTP/1.1" 404 1771
> [08/Jul/2008 19:37:24] "GET /tiny_mce/themes/simple/editor_template.js
> HTTP/1.1" 404 1834
>
> If I enter http://192.168.1.4:8000/tiny_mce/tiny_mce.js, I still see:
> var tinymce={majorVersion:'3',minorVersion:'0.8'...
>
> Mario,
>
> I'm serving through the development server , runserver, not Apache.
> Also, the model is buried in django.contrib.flatpages somewhere. I
> would think that James Bennett would have mentioned something about
> adding to the model if it were required. I'll keep you idea in mind,
> however.
>
> Thanks again to all,
>
> Lloyd
>
>
>
> >
>

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

2008-07-06 Thread Chatchai Neanudorn
Oh, Fixed me, 404 (File not found!)

I was in situation like you, before. Some instruction or recipe assume you
have basic understanding of django.

There are a lot of django recipe assume that you put js or css under the
same place of admin media.
In this case, you don't need to configure media url by your self. But for
running dev server only.

For example, put js under /django/contrib/admin/media/js/some.js. Then
/media/js/some.js will availale for you.

For now, I'm working with java script and first thing I have to do is making
it available first and do things I want.

Anyway, when you run your web using apache, you will need to use alias to
provide admin media.

For my solution, I use something like this,

*ADMIN_MEDIA_PREFIX = '
http://eestud.kku.ac.th/~u4316562/media/openfrog/media/'*

For this setting, I don't need to setup my admin media and save bandwidth
for my share host account.

For another media, I use,
*
DIR = os.path.dirname(__file__)*
*MEDIA_ROOT = os.path.join(DIR, 'static')
MEDIA_URL = 'http://feedfrog.net/static/'

httpd.conf

Alias /static /home/meledictas/webapps/django/meledictas/static*

I use this for all of my django site.

Have a nice day.

Chatchai.

2008/7/7 LRP <[EMAIL PROTECTED]>:

>
> Many thanks for the help, Chatchai.
>
> > Can you start web server and
> typehttp://localhost/usr/share/tinymce/www/tiny_mce.js
> > and see if it return something rather than 400.
>
> I get 404.
>
> Here's url config:
>
> urlpatterns = patterns('',
># Example:
># (r'^cms/', include('cms.foo.urls')),
>
># Uncomment this for admin:
>(r'^admin/', include('django.contrib.admin.urls')),
>(r'', include('django.contrib.flatpages.urls')),
> )
>
> In addition to Bennett and djangoprogject docs, the approach you
> suggest is yet a third solution to the problem of applying tiny_mce to
> django admin... I'll give it a try tomorrow when my mind is a more
> rested.
>
> But meanwhile, I'm curious...
>
> I've followed the instructions in both Bennett' and the djangoproject
> docs scrupulously; double-checking my work in both cases. And in both
> cases I've failed. It's likely, I'm sure, that my failure is due to a
> misreading, misunderstanding, or mistyping on my part. I'm wondering,
> however, has anyone else achieved success based on either Bennett's or
> djangoproject doc's instructions?
>
> If so, then I'll have to carefully review what I've done.
>
> If not, then there's a chance that either or both of the sources are
> either wrong, or are missing something, and should be corrected.
>
> I do recall that I got it working quite easily once in Karrigell.
>
> Thanks again,
>
> Lloyd
>
>
>
>
> >
>

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

2008-07-06 Thread Chatchai Neanudorn
First thing when you work with Java script is, make sure it is available. In
this case, where is your urls config.

>From these,




Can you start web server and type
http://localhost/usr/share/tinymce/www/tiny_mce.js
and see if it return something rather than 400.

For me, I usually do things like this

Let say I have static folder under project path name "static", under static
I have css, js image.

In settings,
DIR = os.path.dirname(__file__)
MEDIA_ROOT = os.path.join(DIR, 'static')

In urls

urlpatterns += patterns('',

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

I enable show_indexs just in case I want make sure I can see all file via
browser.

After you have it work, you can even grab java script from outside website
or on your media site to improve performance. For example,