Re: Comments inside a loop

2010-05-12 Thread Yanik
Wow, I feel totally stupid... works like a charm now :)

On May 12, 2:14 pm, Karen Tracey  wrote:
> On Wed, May 12, 2010 at 1:52 PM, Yanik  wrote:
> > Hello,
>
> > I'm trying to do something that seemed simple, but can't get to work:
> > displaying comments using Django (1.2 RC)'s Comment framework inside a
> > loop.
>
> > {% for entry in entries %}
> >        {% get_comment_list for entry as comments %}
> >        {% render_comment_form for entry %}
> > {% endfor %}
>
> > but I get an error:
>
> > Invalid block tag: 'get_comment_list', expected 'empty' or 'endfor'
>
> This is the template system's way of saying you forgot to:
>
> {% load comments %}
>
> before trying to use one of the comment tags.
>
> get_comment_list is an invalid block tag because it has not been loaded yet.
>
> (By the way you are not doing anything with the list of comments after you
> retrieve it?)
>
> Karen
> --http://tracey.org/kmt/
>
> --
> 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.



Comments inside a loop

2010-05-12 Thread Yanik
Hello,

I'm trying to do something that seemed simple, but can't get to work:
displaying comments using Django (1.2 RC)'s Comment framework inside a
loop.


{% for entry in entries %}
{% get_comment_list for entry as comments %}
{% render_comment_form for entry %}
{% endfor %}

but I get an error:

Invalid block tag: 'get_comment_list', expected 'empty' or 'endfor'


What should I do?

-- 
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: Return FK model

2009-09-03 Thread Yanik

Well, I can't add very well add fields to the Auth.User. But even if I
could, user.friends would get me instances of "Friend" model, not
"User" model.

On Sep 3, 11:13 am, Ben Davis  wrote:
> It looks you're setting a many-to-many reflexive (circular) relationship
> between users.   It seems it would be better to add a ManyToManyField on the
> User model, eg:
>
> class User(models.Model):
>     ...
>     friends = ManyToManyField(User)
>
> Then you could just use "user.friends"
>
> On Thu, Sep 3, 2009 at 9:50 AM, Yanik  wrote:
>
> > Let's say I have a model "Friends" that looks something like:
>
> > class Friend(models.Model):
> >        user = models.ForeignKey(User)
> >        friend = models.ForeignKey(User, related_name="friend")
>
> > I want a list of "User" instances of a user's friends. Is my only
> > option to:
>
> > 1) Get list of "Friends"
> > 2) Then get list of "Users" where id in friends.value_llist('id')
>
> > Or is there a way to do a query on the "Friend" model and as to return
> > "User" instances of friends?
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Return FK model

2009-09-03 Thread Yanik

Let's say I have a model "Friends" that looks something like:

class Friend(models.Model):
user = models.ForeignKey(User)
friend = models.ForeignKey(User, related_name="friend")

I want a list of "User" instances of a user's friends. Is my only
option to:

1) Get list of "Friends"
2) Then get list of "Users" where id in friends.value_llist('id')

Or is there a way to do a query on the "Friend" model and as to return
"User" instances of friends?

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



Getting logged in user in signal

2009-09-02 Thread Yanik

I want to write a signal that tracks activities on certain models, but
I'd also like to keep track of who did what. Is there any way, from
the signal action, to get the value of request.user?

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



Strange bug when Debug = False

2009-02-17 Thread Yanik

I've been having this problem for a few weeks and I can't, for the
life of me, figure it out.

I have 2 types of environments: my local dev server, running Ubuntu,
and the live server, running Fedora 9. The problem only occurs on on
the Fedora server and only when Debug = False. The tricky par is, only
this line crash, but not all the time. And hitting refresh 2-3 times
will eventually go through.


return super(ActiveManager, self).get_query_set().filter
(is_active=True)

will give me the error "TypeError: super() argument 1 must be type,
not None"


It seemed like a caching problem, and since I had no cache defined I
tried both using memcached and setting 'dummy:///' as cache with no
difference.

The problem occurs on both Python 2.5x and 2.6x. And the problem
occurs on Django 1.0.2 as well as the latest trunk.

Can anyone point me in the right direction? I'm a bit desperate...


--~--~-~--~~~---~--~~
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: Custom ACL

2008-12-14 Thread Yanik

Thanks, but this is to manipulate Posix ACL (user ACL on the actual
OS).

On Dec 14, 2:06 pm, "Ramdas S"  wrote:
> http://pylibacl.sourceforge.net/
>
> check this
>
> Might help
>
>
>
> On Sun, Dec 14, 2008 at 7:56 PM, Yanik  wrote:
>
> > Hello,
>
> > I need to build a custom ACL for the app I'm working on, Django's
> > isn't specific enough (I need to give permissions based on IDs,
> > statuses, etc.).
>
> > I'd also like to attach it to the user, so that I could lookup in a
> > way something like User.acl.has_permission(post_id, "can_edit). How
> > can I attach my ACL to the User model "dynamically", without actually
> > touching Django's base code?
>
> > Thank you.
>
> --
> Ramdas S
> +91 9342 583 065
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Custom ACL

2008-12-14 Thread Yanik

Hello,

I need to build a custom ACL for the app I'm working on, Django's
isn't specific enough (I need to give permissions based on IDs,
statuses, etc.).

I'd also like to attach it to the user, so that I could lookup in a
way something like User.acl.has_permission(post_id, "can_edit). How
can I attach my ACL to the User model "dynamically", without actually
touching Django's base code?

Thank you.

--~--~-~--~~~---~--~~
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: problem with inlineformset_factory

2008-11-27 Thread Yanik

I'm using MySQL and running 1.0.2 and the bug is still there.

This ticket:
http://code.djangoproject.com/ticket/9039

is closed, but the code still hasn't been fixed and the mentioned
patch doesn't seem to work.

Has anyone gotten this to work?

On Nov 24, 8:23 pm, boardman <[EMAIL PROTECTED]> wrote:
> As noted in a duplicate post over on django-devs this problem is not
> evident when using the sqlite backend.  The problem seems to be
> limited to the postgres backend and is cuurently still failing for me
> on trunk at revision 9526.
>
> Roger.
>
> On Nov 8, 3:51 pm, Petry <[EMAIL PROTECTED]> wrote:
>
> > Hi Karen!
>
> > I use the version of SVN, I am currently with version 1.1 pre-
> > alpha-9335 SVN
>
> > and the error still remains!
>
> > On 8 nov, 12:02, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > > On Sat, Nov 8, 2008 at 8:56 AM, Petry <[EMAIL PROTECTED]> wrote:
>
> > > > somebody can help me?
>
> > > I didn't recommend changing your code, I recommending trying with current
> > > SVN level of the 1.0.X branch or trunk, in order to ensure you have a fix
> > > that might be relevant (I still have not had time to look in detail at 
> > > your
> > > particular models/forms/etc so I'm not completely sure that is what you 
> > > are
> > > hitting, but it sounds likely based on Daniel Roseman's comments).  You do
> > > not mention if you have tried your code on current SVN, not 1.0 Django?
>
> > > Karen
>
> > > > On 7 nov, 13:24, Petry <[EMAIL PROTECTED]> wrote:
> > > > > I changed my template model to use OneToOneField and remove the
> > > > > Blank=True, but the same error appears...
>
> > > > > On 7 nov, 12:30, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > > > > > On Fri, Nov 7, 2008 at 9:10 AM, Daniel Roseman <
>
> > > > > > [EMAIL PROTECTED]> wrote:
>
> > > > > > > On Nov 4, 6:02 pm,Petry<[EMAIL PROTECTED]> wrote:
> > > > > > > > Hi all,
>
> > > > > > > > I'm having a weird problem when usinginlineformset_factory, he 
> > > > > > > > can
> > > > > > > > only register up to 2 records, after that causes a validation 
> > > > > > > > error
>
> > > > > > > > "(Hidden field id) User phone with thisNonealreadyexists."
>
> > > > > > > > Here is my forms [1], models [2] and views [3]
>
> > > > > > > > [1]http://dpaste.com/88598/
> > > > > > > > [2]http://dpaste.com/88599/
> > > > > > > > [3]http://dpaste.com/88600/
>
> > > > > > > > --
>
> > > > > > > > Marcos DanielPetryhttp://mdpetry.net
>
> > > > > > > The problem isn't anything to do with inline forms, it's this in 
> > > > > > > your
> > > > > > > model:
> > > > > > >    user = models.ForeignKey(User
> > > > > > >                            ,blank=True
> > > > > > >                            ,unique=True)
> > > > > > > What you are saying here is that you can only have each value for
> > > > user
> > > > > > > once in the whole table - and that includes the value 'None', ie 
> > > > > > > only
> > > > > > > one ShipSalesUser can have an empty user field.
>
> > > > > > I have not looked at the original problem in any detail, but the
> > > > failure to
> > > > > > allow multiple NULL values when unique=True is set for the field 
> > > > > > was a
> > > > > > Django bug that has been fixed, see:
>
> > > > > >http://code.djangoproject.com/ticket/9039
>
> > > > > > So, if this is the cause of the problem, using the 1.0.X branch or
> > > > current
> > > > > > trunk code instead of 1.0 should fix it.
>
> > > > > > Karen
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---