Using COMMENTS_APP setting

2009-06-03 Thread Florian Lindner

Hello,

following http://aartemenko.com/texts/optional-email-in-django- 
comments/ I try to configure comments in a way that the email address  
is not required.

I changed my settings.py

INSTALLED_APPS = (
[...]
 'xgm.Blog.comments',
 )

COMMENTS_APP = 'xgm.Blog.comments'

xgm/Blog/comments.py (is it ok to use a py-file as app?):

from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.comments.forms import CommentForm

class BlogCommentForm(CommentForm):
 email = forms.EmailField("Test!!", required=False)

def get_form():
 return BlogCommentForm

but this simply changes nothing (at least nothing I see). The email  
field is still required and the label (changed for testing purpose) is  
still the same.

I render the comment form in a template with:

{% render_comment_form for object %}

What is wrong about my way?

Thanks,

Florian

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



contrib.comments: blank email

2009-06-01 Thread Florian Lindner

Hello,

so far I understand the contrib.comments.models:

  user_email  = models.EmailField(_("user's email address"), blank=True)

The email field of a comment is not needed. Though my preview.html  
template (hat I've copied from the vanilla template and made only  
design modifications) complains that the email field is compulsory.  
Anything still wrong with my setup or do I misunderstand something?

Thanks,

Florian

--~--~-~--~~~---~--~~
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: Changing comments preview form

2009-01-29 Thread Florian Lindner


Am 29.01.2009 um 01:59 schrieb Malcolm Tredinnick:

>
> On Wed, 2009-01-28 at 19:24 +0100, Florian Lindner wrote:
>>
>> Am 28.01.2009 um 05:19 schrieb Malcolm Tredinnick:
>>
>>>
>>> On Tue, 2009-01-27 at 20:11 +0100, Florian Lindner wrote:
>>>> Hello,
>>>>
>>>> I'm playing around with the contrib.comments framework. I want to
>>>> change the preview form. For that I've copied preview.html to xgm/
>>>> Blog/
>>>> templates/comments (xgm is my project, Blog is app). My template
>>>> loaders are:
>>>>
>>>> TEMPLATE_LOADERS = (
>>>>'django.template.loaders.app_directories.load_template_source',
>>>>'django.template.loaders.filesystem.load_template_source',
>>>> )
>>>>
>>>> But modification I make to the preview.html in my app dir does not
>>>> seem to be noticed.
>>>
>>>
>>> For comments, if you're only wanting to change the preview form  
>>> for a
>>> particular model or particular application, note that the template
>>> loaded for preview is not comments/preview.html, always. That is the
>>> name that is loaded is all else fails. However, the application  
>>> first
>>> looks for
>>>
>>>   comments/__preview.html
>>>   comments/_preview.html
>>>
>>> where  is the name of the application and  is the name  
>>> of
>>> the model to which the comment is attached. If either of those
>>> templates
>>> are found, they are used for preference. So for an app-specific
>>> customisation for an app called "foo", say, you could create
>>>
>>>   comments/foo_preview.html
>>>
>>> in the foo/templates/ directory and it will be loaded for the  
>>> preview.
>>
>> Hi!
>>
>> Thanks for your answer. I decided to take the latter way. Thus I've
>> copied preview.html to Blog_Entry_preview.html in the templates/
>> comments/ directory and it worked perfectly. I tried the same copying
>> with the posted.html to Blog_Entry_posted.html but this does not  
>> work.
>> My Blog_Entry_posted.html simply seems to be ignored.
>>
>> Any idea what I could have made wrong? I've double checked  
>> everything...
>
> So, for the future: It took about 30 seconds to grep through the
> comments source (in django.contrib.comments) to find where posted.html
> is used and see that it's doesn't allow that customisation (which is
> also how I found that preview.html is the third of three things
> checked).
>
> Remember, Django is in Python. The source is your friend.

Ok, you're right. I've searched through Google but didn't got the idea  
to grep the code. My apologies.
Is there any reason why this lookup is not implemented for all  
comments templates? If not I'll try to create a patch and commit into  
the ticket system.

Regards,

Florian.


--~--~-~--~~~---~--~~
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: Changing comments preview form

2009-01-28 Thread Florian Lindner


Am 28.01.2009 um 05:19 schrieb Malcolm Tredinnick:

>
> On Tue, 2009-01-27 at 20:11 +0100, Florian Lindner wrote:
>> Hello,
>>
>> I'm playing around with the contrib.comments framework. I want to
>> change the preview form. For that I've copied preview.html to xgm/ 
>> Blog/
>> templates/comments (xgm is my project, Blog is app). My template
>> loaders are:
>>
>> TEMPLATE_LOADERS = (
>> 'django.template.loaders.app_directories.load_template_source',
>> 'django.template.loaders.filesystem.load_template_source',
>> )
>>
>> But modification I make to the preview.html in my app dir does not
>> seem to be noticed.
>
>
> For comments, if you're only wanting to change the preview form for a
> particular model or particular application, note that the template
> loaded for preview is not comments/preview.html, always. That is the
> name that is loaded is all else fails. However, the application first
> looks for
>
>comments/__preview.html
>comments/_preview.html
>
> where  is the name of the application and  is the name of
> the model to which the comment is attached. If either of those  
> templates
> are found, they are used for preference. So for an app-specific
> customisation for an app called "foo", say, you could create
>
>comments/foo_preview.html
>
> in the foo/templates/ directory and it will be loaded for the preview.

Hi!

Thanks for your answer. I decided to take the latter way. Thus I've  
copied preview.html to Blog_Entry_preview.html in the templates/ 
comments/ directory and it worked perfectly. I tried the same copying  
with the posted.html to Blog_Entry_posted.html but this does not work.  
My Blog_Entry_posted.html simply seems to be ignored.

Any idea what I could have made wrong? I've double checked everything...

Florian

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



Changing comments preview form

2009-01-27 Thread Florian Lindner

Hello,

I'm playing around with the contrib.comments framework. I want to  
change the preview form. For that I've copied preview.html to xgm/Blog/ 
templates/comments (xgm is my project, Blog is app). My template  
loaders are:

TEMPLATE_LOADERS = (
 'django.template.loaders.app_directories.load_template_source',
 'django.template.loaders.filesystem.load_template_source',
)

But modification I make to the preview.html in my app dir does not  
seem to be noticed.

What's wrong?

Thanks,

Florian

--~--~-~--~~~---~--~~
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: Invalid block tag: "get_comment_count"

2009-01-21 Thread Florian Lindner


Am 20.01.2009 um 21:40 schrieb Florian Lindner:

>
>
> Am 19.01.2009 um 22:58 schrieb Briel:
>
>>
>> You should try playing around with the tags, trying to load comments
>> different places trying some of the other comment tags to see what
>> happens ect.
>> Also are you using the block tags? what block tags do you have where
>> have you placed them in relation to your code?
>
> Hi!
> I've stripped down my code to merely these two lines:
>
> {% load comments % }
> {% get_comment_count for object as comment_count %}

Well, I got it now. It was one whitespace too much: {% load comments  
%} vs. {% load comments % }.



--~--~-~--~~~---~--~~
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: Invalid block tag: "get_comment_count"

2009-01-20 Thread Florian Lindner


Am 19.01.2009 um 22:58 schrieb Briel:

>
> You should try playing around with the tags, trying to load comments
> different places trying some of the other comment tags to see what
> happens ect.
> Also are you using the block tags? what block tags do you have where
> have you placed them in relation to your code?

Hi!
I've stripped down my code to merely these two lines:

{% load comments % }
{% get_comment_count for object as comment_count %}

Nothing more. but the error is still there.

--~--~-~--~~~---~--~~
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: Invalid block tag: "get_comment_count"

2009-01-19 Thread Florian Lindner


Am 19.01.2009 um 22:04 schrieb Briel:

> It's hard to say what's going wrong with the code you provided, but I
> can say a few things. Since you don't get an error from {% load
> comments %}, there should be no problems with the installation.
> However, you might not actually run the command in the template, it
> could be that you are writing it over with an extend tag. The error
> hints that get_comment_count is an invalid tag, so you should test if
> comments is loaded probably in your template.
> Try loading comments directly above your tag and see what happens and
> take it from there.

Hi!

The complete code is:

{% load comments % }


{% get_comment_count for object as comment_count %}

So I don't there is much that could have introduced an error. I extent  
an base template but it doesn't make any use of something called  
comment actually it does not use any non-trivial Django markup.

How can I test the comments is loaded properly?

Thanks,

Florian



>
>
> -Briel
>
> On 19 Jan., 21:01, Florian Lindner  wrote:
>> Hello,
>>
>> I'm trying to use the comment framework from Django 1.0.2.
>>
>> I've followed all the steps 
>> inhttp://docs.djangoproject.com/en/dev/ref/contrib/comments/
>>   (added it to installed apps, added to urls.py and loaded in the
>> template: {% load comments % }) but I get:
>>
>> TemplateSyntaxError at /blog/1/
>> Invalid block tag: 'get_comment_count'
>>
>> from:
>>
>> {% get_comment_count for object as comment_count %}
>>
>> object has just been created so probably no comment yet attached.
>>
>> What could have went wrong there?
>>
>> Thanks!
>>
>> Florian
> >


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



Invalid block tag: "get_comment_count"

2009-01-19 Thread Florian Lindner

Hello,

I'm trying to use the comment framework from Django 1.0.2.

I've followed all the steps in 
http://docs.djangoproject.com/en/dev/ref/contrib/comments/ 
  (added it to installed apps, added to urls.py and loaded in the  
template: {% load comments % }) but I get:

TemplateSyntaxError at /blog/1/
Invalid block tag: 'get_comment_count'

from:

{% get_comment_count for object as comment_count %}

object has just been created so probably no comment yet attached.

What could have went wrong there?

Thanks!

Florian

--~--~-~--~~~---~--~~
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: Invalid block tag: 'get_comment_count'

2008-12-28 Thread Florian Lindner


Am 28.12.2008 um 00:42 schrieb Russell Keith-Magee:

>
> On Sun, Dec 28, 2008 at 12:27 AM, Florian Lindner  
>  wrote:
>>
>> Hello,
>>
>> I'm trying to use the comment framework from Django 1.0.2.
>>
>> I've followed all the steps in 
>> http://docs.djangoproject.com/en/dev/ref/contrib/comments/
>>
>> (added it to installed apps, added to urls.py and loaded in the
>> template) but I get:
>>
>> TemplateSyntaxError at /blog/1/
>> Invalid block tag: 'get_comment_count'
>>
>> from:
>>
>> {% get_comment_count for object as comment_count %}
>
> django.contrib.comments is an extension application, so the template
> capabilities provided by this application aren't included in the
> default template tag set. In order to use {% get_comment_count %} in
> your template, you need to direct the template engine to load the
> comment template tags. This means putting {% load comments %} at the
> start of the template that is using {% get_comment_count %.
>
> This is covered right at the start of the page you referenced:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/comments/#comment-template-tags

Hello,

I have {% load comments % } right at the top of my template. That is  
what I meant with " and loaded in the template".

Any other ideas?

Thanks,

Florian

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



Invalid block tag: 'get_comment_count'

2008-12-27 Thread Florian Lindner

Hello,

I'm trying to use the comment framework from Django 1.0.2.

I've followed all the steps in 
http://docs.djangoproject.com/en/dev/ref/contrib/comments/ 
  (added it to installed apps, added to urls.py and loaded in the  
template) but I get:

TemplateSyntaxError at /blog/1/
Invalid block tag: 'get_comment_count'

from:

{% get_comment_count for object as comment_count %}

object has just been created so probably no comment yet attached.

What could have went wrong there?

Thanks,

Florian

--~--~-~--~~~---~--~~
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: Invalid block tag: render_comment_form (repost)

2008-12-05 Thread Florian Lindner


Am 04.12.2008 um 21:58 schrieb [EMAIL PROTECTED]:

>
> On 04.12-20:22, Florian Lindner wrote:
> [ ... ]
>> I use the comments framework from the newest Django SVN checkout.
>
> sorry to not be of more help (i've never used the comments framework)
> but i can only suggest that you select a release version and not the
> 'newest' (i'm assuming that means trunk).

Last time I used Django (pre 1.0) it was recommended to always use  
trunk since the last released version was too outdated. Has this  
changed?

Regards,

Florian


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



Invalid block tag: render_comment_form (repost)

2008-12-04 Thread Florian Lindner

Hello,
since noone replied and I still found no answer I dare to repost.


I use the comments framework from the newest Django SVN checkout.

I have in my template:

{% load comments % }
[...]
{% render_comment_form for object %}

resulting in a Invalid block tag: 'render_comment_form'

I have found the same error in one other posting but no solution. What  
is wrong?

Thanks,

Florian

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



Invalid block tag: render_comment_form

2008-11-30 Thread Florian Lindner

Hello,

I use the comments framework from the newest Django SVN checkout.

I have in my template:

{% load comments % }
[...]
{% render_comment_form for object %}

resulting in a Invalid block tag: 'render_comment_form'

I have found the same error in one other posting but no solution. What  
is wrong?

Thanks,

Florian

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



OT: Tool to test trackbacks

2008-08-20 Thread Florian Lindner

Hello,

I've added a Trackback function to my blog (written in Django).
Does anyone knows a tool (internet site) which allows to send a test  
trackback to my blog to test it (incl. auto discovery)?

Thanks,

Florian

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



Get an absolute URL including host

2008-07-06 Thread Florian Lindner

Hello,

how can I get an absolute URL including a hostname (e.g. 
http://www.example.org/dir/doc.html) 
  in a template. I have an object which get_absolute_url I can use but  
what is the best way of getting the hostname in the template?

Thanks,

Florian

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



Join two different querysets

2008-06-24 Thread Florian Lindner

Hello,

I have the following situation:

A Blog has Comments and Trackbacks. Trackbacks should be shown like  
comments but they get a div class="Trackback" instead of  
class="Comment" in HTML.

My idea was to join all Trackbacks and Comments and use a an  
additional attribute to tell them apart in HTML:

 def commentList(self):
 """ Returns a joined list of comments and trackbacks, ordered  
descending by date. """
 comments = self.comment_set.all()
 trackbacks = self.trackback_set.all()
 joined = (comments + trackbacks).sort(cmp = lambda x,y:  
cmp(x.creationDate, y.creationDate), reverse = true)
 for j in joined:
 if isinstance(j, Comment):
 j.type = "Comment"
 elif isinstance(j, Trackback):
 j.type = "Trackback"
 return j

Ok, that does not work, because you can't concat to QuerySets like  
that. I think that this solution would not be optimal anyway.

How would you do this task?

Thanks,

Florian

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



Weird behavior with SMTP connections

2008-05-13 Thread Florian Lindner

Hello,

I'm experiencing some odd behavior with SMTP connections and the  
functions to send mail.

The relevant settings in my settings.py:

ADMINS = (
      ('Florian Lindner', '[EMAIL PROTECTED]'),
)
EMAIL_HOST = "xgm.de"
EMAIL_HOST_USER = "[EMAIL PROTECTED]"
EMAIL_HOST_PASSWORD = "xxx"

I use the mail_admin function to send mail:

mail_admins("Neues Kommentar", message)

Using it this way produces an SMTPAuthenticationError at /blog/ 
previewComment/(535, '5.7.0 authentication failed').

Since the mail server xgm.de is under my control I scanned the logs  
and found no sign that my localhost even tried to connect. Using  
tcpdump revealed that Django tried to connect to mail.dnsteam.de:SMTP  
with is the second MX of xgm.de.

- I would expect that EMAIL_HOST is being used as smarthost. This way  
Django should not even care about MX or something like that. I just  
logs in using EMAIL_HOST_USER / _PASSWORD and sends the mail.

- Even if It cared about MX it would have used the wrong one, because  
mail.dnsteam is the one with the less priority.

Am I getting something completely wrong or is this a bug?

Florian

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



Delete stacked entry in admin interface

2008-05-07 Thread Florian Lindner

Hello,

I have an Comment class that is part of an Entry class:

class Comment(Model):
 blogEntry = ForeignKey(Entry, edit_inline=STACKED, num_in_admin=1)
 author = CharField("Name", max_length=100, core=True)
 authorMail = EmailField("E-Mail", blank=True)
 creationDate = DateTimeField(auto_now_add=True)
 content = TextField("Kommentar", core=True)

I've added an comment through my own commentation feature. Now I want  
to delete this comment in the Django admin interface. Surprisingly I  
found no way to delete this.

How can I delete it?

Thanks,

Florian 

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



Problem with contrib.syndication

2008-03-02 Thread Florian Lindner

Hello,
I try to create an RSS feed for my blog.

I have in my application urls.py:

from feeds import *
feeds = { 'latest' : LatestEntries, }

urlpatterns = patterns("",
[...],
(r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed',  
{'feed_dict':'feeds'})
)

in feeds.py:

from django.contrib.syndication.feeds import Feed
from models import Entry

class LatestEntries(Feed):
 title = "X-Ray Golf Mike"
 link = "/"
 description = "Some description"

 def items(self):
 return Entry.objects.order_by("-creationDate")[:10]


my Entry model has a proper string representation (def __unicode__ is  
present).

Now I try to access my latest feed, resulting in an error.

http://localhost:8000/blog/feeds/latest/:

File "/Users/florian/dev/django/django/core/handlers/base.py" in  
get_response 82. response = callback(request, *callback_args,  
**callback_kwargs) File "/Users/florian/dev/django/django/contrib/ 
syndication/views.py" in feed 14. f = feed_dict[slug] Exception Type:  
TypeError at /blog/feeds/latest/ Exception Value: string indices must  
be integers


Anyone got an idea what is wrong with my code? I use the latest SVN  
checkout.

Thanks,

Florian

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



Problem with custom filter

2008-02-22 Thread Florian Lindner

Hello,
I want to write a custom filter.

I have a file called markdown.py inside my application directory with:

register = Library()

@register.filter
def markdown(value, arg):
 print type(value)
 return value


settings.py contains:

INSTALLED_APPS = (
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'xgm.Blog.markdown',  # <---
 'xgm.AbbrDB',
 'xgm.Blog',
)

now I want to load the filter lib in my template:

{% load markdown %}

which produces an error:

'markdown' is not a valid tag library: Could not load template library  
from django.templatetags.markdown, No module named markdown

What is wrong here?

Thanks,

Florian

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



Filter ModelField content

2008-02-17 Thread Florian Lindner

Hello,
I need to modify the date of one model field (TextField) each time  
before it is displayed. The modifications depend on one other field in  
the same Model.
I think the best way to do this is to subclass TextField and override  
the method to get contents. My questions:

1) How is this method called?
2) How can I access the Model from the Field?
3) Is this the way to go?

Thanks,

Florian

--~--~-~--~~~---~--~~
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: Links to images in Blog posts

2008-02-13 Thread Florian Lindner


Am 13.02.2008 um 15:00 schrieb Michael Newman:

>
> Hi Florian;
>
> You might want to look into a separate object for your images and add
> them as either a manytomanyfield in you story object or have them
> edited inline as foreign key objects. Look at the relationships here:
> http://www.djangoproject.com/documentation/model-api/#relationships .
> You would use manytomany if you would like to reuse images in multiple
> stories and foreign key if you want the authors to upload their images
> on the same page as the story or the images should always be tied to
> one and only one story.

Ok, I'll use a ForeignKey. The probability that one image is used in  
more than one article is too low to make the addition effort sensible.

> I recently had a similar issue with how to give the author the ability
> to place the images in an exact place of a story. Here you have a few
> options. You can have a set place for images like a slideshow, you
> could somehow change an admin field to show the absolute url of the
> image in the display, or you could create a custom form field for you
> story object that uses ajax or just javascript to dynamically place
> text that would be replaced by a manager or while the data is cleaned
> on the admin side to put the image into the story. You could probably
> have a middle class also help with that last option, which would be
> the most flexible and simple, but also the most difficult.

Well, I could just create an custom field e.g. MarkdownField that does  
the transformation markdown <> XHTML and also preprocesses the  
markdown code and replaces relative image URLs with absolute ones. One  
problem that comes to my mind is that in order to replace the URLs the  
markdown field needs access to the objects it is in to determine if  
there are any images. Do you know if this is possible?

> Another way that doesn't involve putting the image in the database is
> by using a textedit kit like YUI's or TinyMCE, which uploads images to
> a directory and puts the code in. Of course you won't get the django
> management features with those images.
>
> Hope that helps get you on your way, This was one of the hardest parts
> for me switching from blog applications like wordpress to Django, but
> once you develop a system it will last forever and be considerably
> more flexible.

Do you have any idea if it is possible to modify upload_to in a way  
that it uses the ID of the the object?

Thanks,

Florian

>
>
> On Feb 13, 4:31 am, Florian Lindner <[EMAIL PROTECTED]> wrote:
>> Hello,
>> this is a repost of an mail I sent some days ago. Since no one  
>> replied
>> and I don't think that noone has an opinion about that I dare to post
>> again.
>>
>> I have some problems about my blog which I would like to hear your
>> opinion about.
>>
>> A user should have the possibility to upload image files in an post
>> (which is represented by a Model). Images can be displayed either
>> seperately from the text or can be embedded in the text.
>> If embedded in the text [1] the user does not know the real URL when
>> uploading an image (because he does not necessarily know the value of
>> MEDIA_ROOT) he can't give the real URL. Therefore I somehow need to
>> preprocess the text and replace the relative URL (which could be just
>> the name of the image) with the complete URL.
>> Is this thought correct so far? Or is there a smarter way to achieve
>> it? How would you do it?
>>
>> The place where images are stored is determined by the value of
>> MEDIA_ROOT and upload_to of the FileField. If I want to upload the
>> pictures to "MEDIA_ROOT/blog/p_id" where p_id is the ID of the blog
>> entry containing the FileField. How would I do that?
>>
>> If I user wants to upload n pictures (n > 1): How can I provide him
>> with multiple FileFields. Just creating a dozens of FileField in my
>> model just in case does not seem the way to go for me. Is there a
>> Django solution for a variable number of fields of the same type?
>> Well, I could make just the FileField a seperat model and use a 1:n
>> relationship. Any other ways?
>>
>> Thanks for all your ideas and comments,
>>
>> Florian
>>
>> [1] like that:
>> ![Alt text here](Image URL here "Image title here")
> >


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



Links to images in Blog posts

2008-02-13 Thread Florian Lindner

Hello,
this is a repost of an mail I sent some days ago. Since no one replied  
and I don't think that noone has an opinion about that I dare to post  
again.

I have some problems about my blog which I would like to hear your  
opinion about.

A user should have the possibility to upload image files in an post  
(which is represented by a Model). Images can be displayed either  
seperately from the text or can be embedded in the text.
If embedded in the text [1] the user does not know the real URL when  
uploading an image (because he does not necessarily know the value of  
MEDIA_ROOT) he can't give the real URL. Therefore I somehow need to  
preprocess the text and replace the relative URL (which could be just  
the name of the image) with the complete URL.
Is this thought correct so far? Or is there a smarter way to achieve  
it? How would you do it?

The place where images are stored is determined by the value of  
MEDIA_ROOT and upload_to of the FileField. If I want to upload the  
pictures to "MEDIA_ROOT/blog/p_id" where p_id is the ID of the blog  
entry containing the FileField. How would I do that?

If I user wants to upload n pictures (n > 1): How can I provide him  
with multiple FileFields. Just creating a dozens of FileField in my  
model just in case does not seem the way to go for me. Is there a  
Django solution for a variable number of fields of the same type?  
Well, I could make just the FileField a seperat model and use a 1:n  
relationship. Any other ways?

Thanks for all your ideas and comments,

Florian


[1] like that:
![Alt text here](Image URL here "Image title here")

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



Images in Blog posts

2008-02-11 Thread Florian Lindner

Hello,
I have some problems about my blog which I would like to hear your  
opinion about.

A user should have the possibility to upload image files in an post  
(which is represented by a Model). Images can be displayed either  
seperately from the text or can be embedded in the text.
If embedded in the text [1] the user does not know the real URL when  
uploading an image (because he does not necessarily know the value of  
MEDIA_ROOT) he can't give the real URL. Therefore I somehow need to  
preprocess the text and replace the relative URL (which could be just  
the name of the image) with the complete URL.
Is this thought correct so far? Or is there a smarter way to achieve  
it? How would you do it?

The place where images are stored is determined by the value of  
MEDIA_ROOT and upload_to of the FileField. If I want to upload the  
pictures to "MEDIA_ROOT/blog/p_id" where p_id is the ID of the blog  
entry containing the FileField. How would I do that?

If I user wants to upload n pictures (n > 1): How can I provide him  
with multiple FileFields. Just creating a dozens of FileField in my  
model just in case does not seem the way to go for me. Is there a  
Django solution for a variable number of fields of the same type?  
Well, I could make just the FileField a seperat model and use a 1:n  
relationship. Any other ways?

Thanks for all your ideas and comments,

Florian


[1] like that:
![Alt text here](Image URL here "Image title here")

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



Which markup language to choose?

2008-02-06 Thread Florian Lindner

Hello,
I'm writing my own blogging application for Django (yes, I want to  
reinvent the wheel, for learning and fun) ;-)
According to documentation django.contrib.markup provides an interface  
to markdown, textile and restructered text. Now I wonder which one to  
choose for a) blog entries b) comments

For a) it's important for me to have the possibility to embed raw  
HTML. AFAIK markdown provides hat possiblity, is it also possible with  
textile and reST?

For b) it's important the output is more or less pretty also if the  
writer is not aware of using a markup language. Or should I just stick  
with {{ comment.content | escape | urlizetrunc:40 | linebreaks }}?

What are your experiences?

Thanks,

Florian


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



Hosting with mod_proxy

2008-01-13 Thread Florian Lindner

Hello,
what is your opinion about the following deployment configuration? The  
site is very low traffic.

Let the django development server bound to localhost serve the pages  
and use mod_proxy from Apache as a front end.

For me it has the advantages that it fits much better into my setup  
than mod_python. Additionally I don't use MPM prefork which according  
to the docs is recommended for mod_python.

Will this be working or are there any major problems? I now it's not  
the optimal solution..,

Thanks,

Florian

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



hide fields using newforms

2007-12-30 Thread Florian Lindner

Hello,
using newforms how can I set fields to be hidden (the hidden="hidden"  
attribute)?

Thanks,

Florian

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



using queryset and extra_context

2007-12-29 Thread Florian Lindner

Hello,
I have this urls.py:

info_dict = { "queryset": Entry.objects.all().order_by("- 
creationDate"), }

urlpatterns = patterns("",
(r'^(?P\d+)/$',  
'django.views.generic.list_detail.object_detail',
{ info_dict, 'extra_context':{'CommentForm':CommentForm} }
)

My problem is that I want to pass the info_dict to the generic view  
and the CommentForm as extra_context.

How can I do this? I think I somehow mix up the dictionaries


Thanks,

Florian

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



contrib.comments: Change freecomment form

2007-12-24 Thread Florian Lindner

Hello,
I'm using the contrib.comment framework to use free comments for my  
blog. Now I want to change the form used for comment input. I have  
placed a file Blog-App/templates/comments/freeform.html which is a  
copy of django/contrib/commennts/templates/comments/freeform.html.
My template loader config looks like:

TEMPLATE_LOADERS = (
 'django.template.loaders.app_directories.load_template_source',
 'django.template.loaders.filesystem.load_template_source',
)

To my understanding now the freeform.html from my templates directory  
should be used (like it is done with some other comments templates  
I've placed there). But yet the other freeform.html is being used.

What am I doing wrong?

Thanks,

Florian

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



Re: get_absolute_url not working as expected

2007-12-17 Thread Florian Lindner


Am 17.12.2007 um 23:03 schrieb Jan Rademaker:

>
>
> On Dec 17, 6:36 pm, Florian Lindner <[EMAIL PROTECTED]> wrote:
>>
>> my code in the model:
>>
>>def get_absolute_url(self):
>>return self.id
>>
>> Anyone else got an idea? I would send anyone any code he requests...
>>
> Are you sure your code is indented right, e.g. did you mix spaces and
> tabs? Did you try to raise an exception in the method? A simple
> `assert False` before `return self.id` should do.

Yes, it was really a tab/whitespace problem. I've switched to Mac OS  
about a month ago and I'm not yet familiar with the editor I choose.

Thanks a lot!

Florian

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



Re: get_absolute_url not working as expected

2007-12-17 Thread Florian Lindner

Am 16.12.2007 um 18:09 schrieb yml:

>
> Hello,
> This exact situation happens to me sometimes ago and the root cause is
> that either you have an error in your urls.py or you are using the
> decorator "user_passes_test".

Never heard of this decorator therefore I suppose I don't use it. ;-)

>
> In order to solve the first one you should comments all the lines in
> urls.py and uncomment line after line. This is the the method I have
> used so far. If someone have a better one I would be happy to read it.

I've tried that. Stripped down the urls.py to the minimum but nothing  
changed.
This is my complete urls.py:

from django.conf.urls.defaults import *
from models import *

info_dict = { "queryset": BlogEntry.objects.all().order_by("- 
creationDate"), }

urlpatterns = patterns("",
 (r'^$', 'django.views.generic.list_detail.object_list',  
dict(info_dict, allow_empty=True, paginate_by=3)),
 (r'^page(?P[0-9]+)/$',  
'django.views.generic.list_detail.object_list', dict(info_dict,  
allow_empty=True, paginate_by=3)),
 (r'^newComment/$',  
'django.views.generic.create_update.create_object',  
dict(model=BlogComment)),
 (r'^(?P\d+)/$',  
'django.views.generic.list_detail.object_detail', dict(info_dict))
)

the part of the template that is called by list_detail.object_list:

 {{ entry.title }}

is evaluated to:

 vierter eintrag

my code in the model:

def get_absolute_url(self):
return self.id

Anyone else got an idea? I would send anyone any code he requests...

Thanks!

Florian


>
> Regarding the second issue comment the line with the decorator, more
> details on that pb can be found there:
>  * http://code.djangoproject.com/ticket/5925
>
> I hope that help
>
> On 15 déc, 12:30, Florian Lindner <[EMAIL PROTECTED]> wrote:
>> Am 15.12.2007 um 05:03 schrieb Alex Koshelev:
>>
>>
>>
>>> 1) May be string is needed
>>
>> As I said, even when I return a constant string (return "foo") it
>> changing nothing.
>>
>>
>>
>>> 2) Absolute url not uri. So domain name is not needed.
>>
>>> On 15 дек, 01:29, Florian Lindner <[EMAIL PROTECTED]> wrote:
>>>> Hello,
>>>> I have two question regarding get_absolute_url:
>>
>>>> 1) I have the template code:
>>
>>>> {% for entry in object_list %}
>>>>  {{ entry.title }}>>> h3>
>>>> {% endfor %}
>>
>>>> It's called from a .generic.list_detail.object_list. My
>>>> get_absolute_url is implemented in my model:
>>
>>>> class BlogEntry(Model):
>>>>   def get_absolute_url(self):
>>>>   return self.id
>>
>>>> but the link in the template is alwayshttp://localhost:8000/blog/
>>>> where blog is my application name and which is also the URL used to
>>>> get to the template above. I can even return anything (like a
>>>> constant
>>>> string) but it's not being taken into account, the link is also the
>>>> same. What is wrong there?
>>
>>>> 2) As the name says get_absolute_url should always return a  
>>>> absolute
>>>> URL (which I understand is a complete URL). Is there a standard way
>>>> to
>>>> produce such a URL? For example I need to my server (here is
>>>> localhost:
>>>> 8000) and the path to application (blog/).
>>
>>>> Thanks,
>>
>>>> Florian
> >


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



Re: get_absolute_url not working as expected

2007-12-15 Thread Florian Lindner


Am 15.12.2007 um 05:03 schrieb Alex Koshelev:

>
> 1) May be string is needed

As I said, even when I return a constant string (return "foo") it  
changing nothing.

>
> 2) Absolute url not uri. So domain name is not needed.
>
> On 15 дек, 01:29, Florian Lindner <[EMAIL PROTECTED]> wrote:
>> Hello,
>> I have two question regarding get_absolute_url:
>>
>> 1) I have the template code:
>>
>> {% for entry in object_list %}
>>  {{ entry.title }}> h3>
>> {% endfor %}
>>
>> It's called from a .generic.list_detail.object_list. My
>> get_absolute_url is implemented in my model:
>>
>> class BlogEntry(Model):
>>def get_absolute_url(self):
>>return self.id
>>
>> but the link in the template is alwayshttp://localhost:8000/blog/
>> where blog is my application name and which is also the URL used to
>> get to the template above. I can even return anything (like a  
>> constant
>> string) but it's not being taken into account, the link is also the
>> same. What is wrong there?
>>
>> 2) As the name says get_absolute_url should always return a absolute
>> URL (which I understand is a complete URL). Is there a standard way  
>> to
>> produce such a URL? For example I need to my server (here is  
>> localhost:
>> 8000) and the path to application (blog/).
>>
>> Thanks,
>>
>> Florian
> >


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



get_absolute_url not working as expected

2007-12-14 Thread Florian Lindner

Hello,
I have two question regarding get_absolute_url:

1) I have the template code:

{% for entry in object_list %}
 {{ entry.title }}
{% endfor %}

It's called from a .generic.list_detail.object_list. My  
get_absolute_url is implemented in my model:

class BlogEntry(Model):
def get_absolute_url(self):
return self.id

but the link in the template is always http://localhost:8000/blog/  
where blog is my application name and which is also the URL used to  
get to the template above. I can even return anything (like a constant  
string) but it's not being taken into account, the link is also the  
same. What is wrong there?

2) As the name says get_absolute_url should always return a absolute  
URL (which I understand is a complete URL). Is there a standard way to  
produce such a URL? For example I need to my server (here is localhost: 
8000) and the path to application (blog/).

Thanks,

Florian

--~--~-~--~~~---~--~~
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 set ForeignKey with generic create view?

2007-12-12 Thread Florian Lindner


Am 10.12.2007 um 20:01 schrieb Florian Lindner:

>
> Hello,
> I have this model:
>
> class BlogComment(Model):
>blogEntry = ForeignKey(BlogEntry, edit_inline=STACKED,
> num_in_admin=1)
>author = CharField(max_length=100, core=True)
>authorMail = EmailField(blank=True)
>content = TextField(core=True)
>
> Now I want to use the generic.create_update.create_object to create an
> BlogComment. My question is how to define which BlogEntry object it
> uses as ForeignKey?

Well, really noboby how can give me a hint on this?

Florian

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



How to set ForeignKey with generic create view?

2007-12-10 Thread Florian Lindner

Hello,
I have this model:

class BlogComment(Model):
blogEntry = ForeignKey(BlogEntry, edit_inline=STACKED,  
num_in_admin=1)
author = CharField(max_length=100, core=True)
authorMail = EmailField(blank=True)
content = TextField(core=True)

Now I want to use the generic.create_update.create_object to create an  
BlogComment. My question is how to define which BlogEntry object it  
uses as ForeignKey?

Thanks,

Florian

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



How to tell generic create view about ForeignKey

2007-12-06 Thread Florian Lindner

Hello,
I Have this model:

class BlogComment(Model):
 blogEntry = ForeignKey(BlogEntry, edit_inline=STACKED,  
num_in_admin=1)
 author = CharField(max_length=100, core=True)
 authorMail = EmailField(blank=True)
 content = TextField(core=True)

Now I want to use the generic.create_update.create_object to create an  
BlogComment. My question is how to define which BlogEntry object it  
uses as ForeignKey?

Thanks,

Florian

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



create_object generic view exampe

2007-12-05 Thread Florian Lindner

Hello,
I'm looking for an example on how to use the  
django.views.generic.create_update.create_object generic view (with  
newforms).

Can anyone point me to a good ressource?

Thanks,

Florian

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



German dates (with date filter)

2007-11-09 Thread Florian Lindner

Hello,
I use this line in my template:

geschrieben am {{ entry.creationDate|date:"D, j.n.y, H:i" }}

(geschrieben am == writen at)

It produces output like "Wed, 26.9.07, 16:49"

is there any way I can make this output German which means in this case to 
print Mi instead of Wed?

My local is de_DE.UTF-8 and in my settings.py I have LANGUAGE_CODE = 'de-de'.

Of course it would be best if the template was taking the browser language 
into account.

Thanks,

Florian

--~--~-~--~~~---~--~~
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: name 'django' is not defined

2007-11-07 Thread Florian Lindner

Am Mittwoch, 7. November 2007 schrieb Marty Alchin:
> On 11/7/07, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > But why does the root urls.py works that also contains the line
> >
> > from django.conf.urls.defaults import *
> >
> > or the manage.py script or another installed app in the same project
> > directory?
>
> If you post the whole contents of the 'xgm.Blog.urls' module, it might
> be more clear what's going on. Use http://dpaste.com/ if it's too
> large for email.

It's not much: 



from django.conf.urls.defaults import *
from models import *

info_dict = { "queryset": BlogEntry.objects.all().order_by("-creationDate"), }

urlpatterns = patterns("",
(r'^$', 'django.views.generic.list_detail.object_list', dict(info_dict, 
allow_empty=True, paginate_by=3)),

(r'^page(?P[0-9]+)/$', 'django.views.generic.list_detail.object_list', 
dict(info_dict, allow_empty=True, paginate_by=3)),
(r"^newComment/$", django.views.generic.create_update.create_object, 
dict(model=BlogComment))
)

Regards,

Florian

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



name 'django' is not defined

2007-11-07 Thread Florian Lindner

Hello,
I'm using Django trunk.

After some weeks of paused development I started my app again today. But as 
soon as I access the URL defined at the root urls.py:

(r"^blog/", include("xgm.Blog.urls")),

I get an error:

Error while importing URLconf 'xgm.Blog.urls': name 'django' is not defined

The first line of xgm.Blog.urls is:

from django.conf.urls.defaults import *

The app is started with the manage.py script.

Anyone got an idea whats is wrong here?

Thanks,

Florian

--~--~-~--~~~---~--~~
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: name 'django' is not defined

2007-11-07 Thread Florian Lindner

Am Mittwoch, 7. November 2007 schrieb Thomas Guettler:
> Am Mittwoch, 7. November 2007 15:41 schrieb Florian Lindner:
> > Hello,
> > I'm using Django trunk.
> >
> > After some weeks of paused development I started my app again today. But
> > as soon as I access the URL defined at the root urls.py:
> >
> > (r"^blog/", include("xgm.Blog.urls")),
> >
> > I get an error:
> >
> > Error while importing URLconf 'xgm.Blog.urls': name 'django' is not
> > defined
> >
> > The first line of xgm.Blog.urls is:
> >
> > from django.conf.urls.defaults import *
> >
> > The app is started with the manage.py script.
> >
> > Anyone got an idea whats is wrong here?
>
> The Python interpreter can't find the module 'django'.
>
> At runtime the path is stored in sys.path.
>
> You can debug this:
> import sys
> assert False, sys.path
>
> You have several options:
>  1. modify the environment variable PYTHONPATH
>  2. modify sys.path:
>sys.path.append('/yourpath')
>  3. Move the django directory (the one that contains e.g. 'newforms')
> to a place on your sys.path.

Yes, that was clear to me.

But why does the root urls.py works that also contains the line

from django.conf.urls.defaults import *

or the manage.py script or another installed app in the same project 
directory?

Regards,

Florian

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



Start development: which branch?

2007-11-07 Thread Florian Lindner

Hello,
I'm just about to start a project with Django (which will also be for learning 
Django).

Should I use trunk for development? Or is there any branch better for 
development? (with regard to the introduction of newforms)

Thanks,

Florian

--~--~-~--~~~---~--~~
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: Example for update_object

2007-10-29 Thread Florian Lindner

Am Donnerstag, 25. Oktober 2007 schrieb Nathaniel Whiteinge:
> On Oct 24, 5:21 am, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > I'm looking for an example on how to use the
> > django.views.generic.create_update.update_object generic view.
>
> The create and update generic views haven't been updated for newforms
> yet. There's a Django Snippet [1]_ that might be helpful in the
> meantime.
>
> .. [1] http://www.djangosnippets.org/snippets/99/

What's is your opinion about how long it takes until these forms are 
implemented with newforms in SVN?

Thanks,

Florian


--~--~-~--~~~---~--~~
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: Example for update_object

2007-10-24 Thread Florian Lindner

Am Mittwoch, 24. Oktober 2007 schrieb tomris:
> http://www.cnd-industry.com/

Is is just spam or meant serious in a way I don't understand?

Regards,

Florian


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



Example for update_object

2007-10-24 Thread Florian Lindner

Hello,
I'm looking for an example on how to use the 
django.views.generic.create_update.update_object generic view.

Some of the concrete question I have:

Is object.get_absolute_url() a function I need to implement in my model?

The documentation of the view links to the manipulator and formfield 
documentation. There is mentioned that learning the stuff isn't worth anymore 
cause it's being replaced. Is this true also for this generic view? Where can 
I find an example on how to use the view with the newforms (I think it's this 
it's being replaced with). I'm using the svn version of Django.

Thanks,

Florian


http://www.djangoproject.com/documentation/generic_views/#django-views-generic-create-update-create-object

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



Example for update_object

2007-10-14 Thread Florian Lindner

Hello,
I'm looking for an example on how to use the 
django.views.generic.create_update.update_object generic view.

Some of the concrete question I have:

Is object.get_absolute_url() a function I need to implement in my model?

The documentation of the view links to the manipulator and formfield 
documentation. There is mentioned that learning the stuff isn't worth anymore 
cause it's being replaced. Is this true also for this generic view? Where can 
I find an example on how to use the view with the newforms (I think it's this 
it's being replaced with). I'm using the svn version of Django.

Thanks,

Florian


http://www.djangoproject.com/documentation/generic_views/#django-views-generic-create-update-create-object

--~--~-~--~~~---~--~~
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: Design a model for a Blog

2007-09-24 Thread Florian Lindner

Am Sonntag, 23. September 2007 schrieb Alex Koshelev:
> Slug is very good when you want to create "fine" urls. You can convert
> (using prepopulate_from param) your title field of entry to slug and
> use it for entry's permalink.
> But of course you can use entry's id(integer value) for url mapping

If I understand correctly I prepopulate my slug field with the value from the 
title field (I understand you that it is the other way around).

Anyway... does the slug field guarantees that the URL is unique?

Regards,

Florian

> On 23 сент, 17:12, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > Hello,
> > I am about to develop a blogging application for my site (it's also a
> > learning Django app, so please don't point me to existing projects ;-)
> >
> > Since I do want to omit to change my entire app due to mistakes I had
> > made while designing the model I would like to discuss my concept here
> > before starting to develop.
> >
> > Right now the app should support only one Blog so there is only one
> > model: BlogEntry:
> >
> > class BlogEntry(models.Model):
> > title = models.CharField(max_length=100)
> > content = models.TextField()
> > creationDate = models.DateTimeField(auto_now_add=True)
> >
> > eventually I will add an FileField or ImageField for attachments.
> > What about the Slug Field. I've read the docs but I'm not sure if it
> > makes any sense here? How is it used normally?
> >
> > Another point is how to build an URL to identify a BlogEntry instance. I
> > could use the automatically added id field, like: xgm.de/blog/132286302.
> > Are the ids usually usable directly as part of the URLs or are there any
> > potential non-usable characters? I know this depends on the DB backend.
> > Development will be done on sqlite, production use on MySQL.
> > This is what I prefer ATM.
> >
> > Of couse I will also use a date based generic view to provide a archive
> > view on the blog.
> >
> > Another possibility would be to take the content field into account when
> > constructing the URL: xgm.de/blog/My_first_entry. To make it unique I
> > could prepend or append an unique random id or a part of the date.



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



Design a model for a Blog

2007-09-23 Thread Florian Lindner

Hello,
I am about to develop a blogging application for my site (it's also a learning 
Django app, so please don't point me to existing projects ;-)

Since I do want to omit to change my entire app due to mistakes I had made 
while designing the model I would like to discuss my concept here before 
starting to develop.

Right now the app should support only one Blog so there is only one model: 
BlogEntry:

class BlogEntry(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
creationDate = models.DateTimeField(auto_now_add=True)

eventually I will add an FileField or ImageField for attachments.
What about the Slug Field. I've read the docs but I'm not sure if it makes any 
sense here? How is it used normally?

Another point is how to build an URL to identify a BlogEntry instance. I could 
use the automatically added id field, like: xgm.de/blog/132286302. Are the 
ids usually usable directly as part of the URLs or are there any potential 
non-usable characters? I know this depends on the DB backend. Development 
will be done on sqlite, production use on MySQL.
This is what I prefer ATM.

Of couse I will also use a date based generic view to provide a archive view 
on the blog.

Another possibility would be to take the content field into account when 
constructing the URL: xgm.de/blog/My_first_entry. To make it unique I could 
prepend or append an unique random id or a part of the date.

Thanks for any ideas and comments!

Florian

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



form variables in templates

2007-09-22 Thread Florian Lindner

Hello,
can I access form variables (like request.POST["foo"]) in a template? Without 
writing them in the argument dictionary before.

Thanks,

Florian

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



General site organization

2007-09-20 Thread Florian Lindner

Hello,
I have the site xgm.de with a blog, an abbreviation database and some static 
pages.
How would a organize such a site with Django?

Create an app for the blog, an app for the DB and an app for the rest of the 
site

or

Create an app for the blog, an app for the DB and the static pages as 
templates of the project?

or 

something else

What is the common way to do it?

Thanks,

Florian 

--~--~-~--~~~---~--~~
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: Creating link to root

2007-09-17 Thread Florian Lindner

Am Sonntag, 16. September 2007 schrieb Christian Joergensen:
> Florian Lindner wrote:
> > Hello,
> > a common problem I have is that I have references in my main template
> > like CSS or an background image:
> >
> > 
> >
> > This template is used within different paths. Therefore I need to have
> > the styles.css availabe in every path the template could be used.
>
> Couldn't you just do href="/styles.css" ?

It works with Konqueror but not with Firefox.

Regards,

Florian

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



Creating link to root

2007-09-16 Thread Florian Lindner

Hello,
a common problem I have is that I have references in my main template like CSS 
or an background image:



This template is used within different paths. Therefore I need to have the 
styles.css availabe in every path the template could be used.
An alternative would be give the entire URL href="http://xgm.de/styles.css. 
But then I need to change that line everytime when I deploy my app from 
localhost to a domain.
Another working solution is to model the regexp in a way that styles.css is 
always available: r"^.*styles\.css$"
It works but makes caching for browsers impossible and clutters the paths.
Is there a tag like {% domain %} that gives me the domain and I can construct 
a path like http://xgm.de/styles.css dynamically (and it changes to 
http://localhost:8000/styles.css when I am on localhost)?
Or how is this problem commonly solved with Django?

Thanks,

Florian

--~--~-~--~~~---~--~~
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: Problem with generic views (404)

2007-09-16 Thread Florian Lindner

Am Sonntag, 16. September 2007 schrieb Collin Grady:
> Do you actually have any Abbreviation objects?
>
> If you don't tell the view to allow empty results, it'll 404 if it has
> nothing to show :)

Yes, this was the problem, thanks! However I ran into the next problem just 5 
minutes later.

I have an template that is used for this generic view:

{% if Abbreviation_list %}

{% for abbr in Abbreviation_list %}
{{ abbr.abbreviation }}
{% endfor %}

{% else %}
No abbreviations are available.
{% endif %}

That just gives: "No abbrevations...". If I remove the if clause there is just 
  in the HTML source code.

But there are objects:

[EMAIL PROTECTED] ~/xgm $ ./manage.py shell
Python 2.4.4 (#1, May 13 2007, 13:02:35)
[GCC 4.1.1 (Gentoo 4.1.1-r3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from xgm.AbbrDB.models import *
>>> Abbreviation.objects.all()
[, ]

Everything is unchanged compared to my previous post.

Thanks,

Florian


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



Problem with generic views (404)

2007-09-15 Thread Florian Lindner

Hello,
I have an problem using generic views.

My settings.py has set:

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
)

TEMPLATE_DIRS = ("/home/florian/xgm/templates/",
)

I have an app AbbrDB which has an url.py:

info_dict = { "queryset": Abbreviation.objects.all(), }

urlpatterns = patterns("xgm.AbbrDB.views",
(r"^$", "search"),
)

urlpatterns += patterns("",
(r'^list/$', 'django.views.generic.list_detail.object_list', info_dict),
)

This url.py is included from the projects url.py like that: 

(r"^abbr/", include("xgm.AbbrDB.urls"))

The search view works perfect but the generic view does not.

I have an template called Abbreviation_list.html in ~/xgm/AbbrDB/templates/. 
It contains only "TEST!" at the moment.

The URL http://localhost:8000/abbr/list/ only gives an 404 error:

Request Method: GET
Request URL: http://localhost:8000/abbr/list/

It does NOT complains about not found an suitable regexp like that:

Using the URLconf defined in xgm.urls, Django tried these URL patterns, in 
this order:

As far as I understand the generic view object_list should look for a template 
called Abbreviation_list.html. Since app_directories.load_template_source 
template loader is loaded it looks for this template in AppDir/templates/

But what's wrong?

Thanks,

Florian

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



Using decoupled urls.py and generic views

2007-09-14 Thread Florian Lindner

Hello,
part 3 of the tutorial introduced how to decouple URL configuration into the 
app dir.
At part 4 [1] generic views are introduced and the decoupled URL 
configuration:

from django.conf.urls.defaults import *

urlpatterns = patterns('mysite.polls.views',
(r'^$', 'index'),
(r'^(?P\d+)/$', 'detail'),
(r'^(?P\d+)/results/$', 'results'),
(r'^(?P\d+)/vote/$', 'vote'),
)

apparently is being changed back to a coupled using generic views.:

from django.conf.urls.defaults import *
from mysite.polls.models import Poll

info_dict = {
'queryset': Poll.objects.all(),
}

urlpatterns = patterns('',

(r'^$', 'django.views.generic.list_detail.object_list', info_dict),

(r'^(?P\d+)/$', 'django.views.generic.list_detail.object_detail', 
info_dict), 
url(r'^(?P\d+)/results/$', 
'django.views.generic.list_detail.object_detail', 
dict(info_dict, template_name='polls/results.html'), 'poll_results'),

(r'^(?P\d+)/vote/$', 'mysite.polls.views.vote'),

)

How can I use decoupled URL configuration AND generic views, like that:


from django.conf.urls.defaults import *
from models import Abbreviation

info_dict = { "queryset": Abbreviation.objects.all(), }

urlpatterns = patterns("xgm.AbbrDB.views",
(r"^$", "search"),
(r'^list/$', 'django.views.generic.list_detail.object_list', info_dict),
)

Thanks,

Florian


[1] http://www.djangoproject.com/documentation/tutorial04/

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



Decoupling templates

2007-09-12 Thread Florian Lindner

Hello,
I've just started with Django and have worked through the excellent tutorial. 
At chapter 2 [1] of the tutorial it says to set:

TEMPLATE_DIRS = (
"/home/my_username/mytemplates",
)

Which makes me putting all templates of all apps in my project into this 
directory (resp. subdirectories of this dir)
How can I decouple my templates to an app specific directoy? The way that my 
apps are self contained also regarding their templates?

Or did I get something fundamentaly wrong?

Thanks,

Florian

[1] http://www.djangoproject.com/documentation/tutorial02/

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