Re: reverse ForeignKey

2010-09-26 Thread ionut cristian cucu
2010/9/25 Daniel Roseman <dan...@roseman.org.uk>:
>
>
> On Sep 25, 9:51 am, ionut cristian cucu <cucife...@gmail.com> wrote:
>> I've tried to do something like that:
>> class Pacienti_manager(models.Manager):
>>   def get_visible(self):
>>     return(super(Pacienti_manager,
>> self).get_query_set().filter(pacient_id__exact=pacient_id)
>> but still no go, I tried
>> def queryset(self, request):
>>   qs= super(Pacient, self).queryset(request)
>>   return qs.filter(exit_pacient_id=pacient_id)
>> in Pacient class, but again all objects in Pacient who have an Exit do
>> show up in the view.
>> Any ideas what I'm doing wrong?
>
>
> That method needs to go in your ModelAdmin class,  not your model.
> --
> DR.
I tried that also, but I noticed I can't write the right part of the
expresion, I get global name pacien_id not defined. How do I write
that?

-- 
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: [Announcement] Vim for Python and Django

2010-09-26 Thread ionut cristian cucu
Very helpful, thanks alot!

2010/9/26 Piotr Zalewa :
>  Hi Antoni,
>
> Thanks for that!
>
> zalun
>
> On 09/26/10 10:36, Antoni Aloy wrote:
>> Hello all!
>>
>> In this list we have a recurrent thread: "What'ts the best IDE for
>> Django and Python development?" trespams-vim is my try to answer this
>> question for people who likes to have a very powerful editor and needs
>> to have an editor which is able to run in the desktop as well as in a
>> remote session. I have updated the previous version with delimMate and
>> easytags, so actually you'll find:
>>
>> * Syntax highlight
>> * Python autocompletion
>> * Smart tabbing
>> * Templates for Python, Django, js, html, ... (just try to edit a
>> python file and press sbu + tab as an example)
>> * Add/remove comments on multiple lines
>> * Tabs
>> * Surround
>> * marks
>>
>> etc. etc. :
>>
>> This is a list of my favorite shortcuts
>>
>> http://code.google.com/p/trespams-vim/wiki/readme
>>
>> So, you'll find a collection of plugins and .vimrc settings that I
>> have found very useful in my day-by-day work in Python and Django.
>>
>> http://code.google.com/p/trespams-vim/
>>
>> Happy coding!
>>
>
>
> --
> blog  http://piotr.zalewa.info
> jobs  http://webdev.zalewa.info
> twit  http://twitter.com/zalun
> face  http://facebook.com/zaloon
>
> --
> 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.
>
>

-- 
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: reverse ForeignKey

2010-09-25 Thread ionut cristian cucu
I've tried to do something like that:
class Pacienti_manager(models.Manager):
  def get_visible(self):
return(super(Pacienti_manager,
self).get_query_set().filter(pacient_id__exact=pacient_id)
but still no go, I tried
def queryset(self, request):
  qs= super(Pacient, self).queryset(request)
  return qs.filter(exit_pacient_id=pacient_id)
in Pacient class, but again all objects in Pacient who have an Exit do
show up in the view.
Any ideas what I'm doing wrong?

2010/9/23 Vali Lungu <vali.lu...@gmail.com>:
> Hi,
>
> You may be interested in this:
> http://stackoverflow.com/questions/2618893/how-to-filter-queryset-in-changelist-view-in-django-admin,
> looks like a similar (solved) problem.
> In short, it's about overriding the queryset() method of ModelAdmin.
>
> On Thu, Sep 23, 2010 at 11:33 AM, ionut cristian cucu <cucife...@gmail.com>
> wrote:
>>
>> Hi list,
>> I just came to django, and to web programming for that matter, so my
>> question is from a n0b:
>> I have to models:
>> class Pacient(models.Model):
>>     name=models.CharField('name', max_length=123)
>> 
>> class Exit(models.Model):
>>      pacient=models.ForeignKey(Pacient)
>> 
>>
>> How to I get the admin interface to show only the pacients for whom I
>> have no exit objects.
>> Rephrase: if I have an Exit object for a Pacient, I don't want that
>> Pacient object to show up
>> Thanks!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-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.
>>
>
> --
> 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.
>

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



reverse ForeignKey

2010-09-23 Thread ionut cristian cucu
Hi list,
I just came to django, and to web programming for that matter, so my
question is from a n0b:
I have to models:
class Pacient(models.Model):
 name=models.CharField('name', max_length=123)

class Exit(models.Model):
  pacient=models.ForeignKey(Pacient)


How to I get the admin interface to show only the pacients for whom I
have no exit objects.
Rephrase: if I have an Exit object for a Pacient, I don't want that
Pacient object to show up
Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: dashboard question

2010-08-14 Thread ionut cristian cucu
Sorry wrong list

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



dashboard question

2010-08-13 Thread ionut cristian cucu
Hello list,
I customized my first dashboard like so: http://paste.pocoo.org/show/250028/,
but when I added Group, the site gets rendered weird:
http://img705.imageshack.us/img705/8148/djangositeadmin12817724.png.
Could you please help me find what have I done wrong?
Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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.



new to django

2010-07-25 Thread ionut cristian cucu
Hi list!
I just started on django and so far my project went very well: I've
created an admin site that will allow the user some data into a
postgres db. Cool me, my first site. Now I want to do the following:
make in admin interface a custom widget that will have a charfield or
integerfield but also a checkbox, that if checked will make the field
readonly and insert the 0 value. Unfortunatelly multiwidget is not
well documented and I'm kinda new at this. I got to display a widget
from this recepie:
http://github.com/justinlilly/django_multiwidget_demo/, but that
returns 2 values, in my db I only need one, also I'm not sure how to
make the field readonly using this one. Also I've found this snippet:
http://djangosnippets.org/snippets/1058/, but using this one I only
get the custom widget that doesn't show no checkbox. This is my code:
http://dpaste.com/221817/. Could you perhaps help me with this? Can
this be done only in python? Thank you very much!

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