Clearly I do not understand something in templating

2011-10-15 Thread Piotr Hosowicz
Hello, This is in views.py : def campaign(request, campaign_id): ctx = {'phones': PersonPhones.objects.all(), "camppeople": CampPeople.objects.all() } return render_to_response("campaign.html", ctx, context_instance=RequestContext(request)) This is the template : {% for piplok in

Re: Clearly I do not understand something in templating

2011-10-15 Thread Karen Tracey
On Sat, Oct 15, 2011 at 8:51 AM, Piotr Hosowicz wrote: > Hello, > > This is in views.py : > > def campaign(request, campaign_id): >ctx = {'phones': PersonPhones.objects.all(), "camppeople": > CampPeople.objects.all() } >return render_to_response("campaign.html", ctx,

Re: Clearly I do not understand something in templating

2011-10-15 Thread Piotr Hosowicz
> Based on your previous mail, CampPeople instances have a docall field. > piplok is a CampPeople instance, since you have passed in a queryset of > CampPeople in the 'camppeople' variable and are iterating through it in the > for loop. So I expect this should be: > > {% if piplo.docall %} Yeah,

Don't understand still

2011-10-15 Thread Piotr Hosowicz
Hello, I still do not understand how things are connected in Django. In models.py I have: class CampaignManager(models.Manager): pass class CampPeople(models.Model): person = models.ForeignKey(Person) camp = models.ForeignKey(Campaign) docall = models.BooleanField(True)

Re: Don't understand still

2011-10-15 Thread Carlos Daniel Ruvalcaba Valenzuela
Perhaps the problem lies on the view code, are you passing the query data to the template? Is que query returning any data? Try posting the relevant code from your views. Regards, Carlos Ruvalcaba El 15/10/2011 14:12, "Piotr Hosowicz" escribió: > Hello, > > I still do not

Re: Don't understand still

2011-10-15 Thread Babatunde Akinyanmi
Hi Piotr, Models contain code for the ORM and what will be used to create tables for your database. View is where you can process logic and data from your models or database before output to the client. Models are not directly linked to templates and templates get their context from the view.

Re: Don't understand still

2011-10-15 Thread Carlos Daniel Ruvalcaba Valenzuela
Also don't forget to load your data in the database, otherwise the results of the query will be empty, you can use the django-admin to help you get started and fill some data in (as outlined on the tutorials from django docs). -- You received this message because you are subscribed to the Google

Re: Don't understand still

2011-10-15 Thread Babatunde Akinyanmi
Hi Piotr, The problem is with your custom managers. You defined PersonPhones manager (and all your other managers) to do nothing and hooked it to objects effectively confusing everything. Ideaally you should have: objects = models.Manager() But in your case its: objects = PersonPhonesManager()

Re: Don't understand still

2011-10-15 Thread Piotr Hosowicz
> Models contain code for the ORM and what will be used to create tables > for your database. View is where you can process logic and data from > your models or database  before output to the client. Models are not > directly linked to templates and templates get their context from the > view.

Re: Don't understand still

2011-10-15 Thread Piotr Hosowicz
Carlos, of course I have data in the DB. Babatunde, the managers is the thing that my friend, local Django guru, didn't answer me. I believe you are right, I just copied the manager with empty body from previous pieces of code that worked. I'll try it, thanks a lot. Regards, Piotr Hosowicz --

Re: Don't understand still

2011-10-15 Thread Piotr Hosowicz
On 15 Paź, 17:40, Piotr Hosowicz wrote: > Carlos, of course I have data in the DB. Babatunde, the managers is > the thing that my friend, local Django guru, didn't answer me. I > believe you are right, I just copied the manager with empty body from > previous pieces of code

Re: Don't understand still

2011-10-15 Thread Babatunde Akinyanmi
Yes your context is correct but the problem is with what the context does contain. Managers return querysets but yours does not do anything or return anything. It will be very clear to you if you go to the django in built shell and do PersonPhones.objects.all(). You'll find out that it contains

Re: Don't understand still

2011-10-15 Thread Thomas Orozco
Just don't assign anything to objects and leave that line out of your code ; use the default manager. Le 15 oct. 2011 17:54, "Piotr Hosowicz" a écrit : > On 15 Paź, 17:40, Piotr Hosowicz wrote: > > Carlos, of course I have data in the DB. Babatunde, the

Re: Don't understand still

2011-10-15 Thread Babatunde Akinyanmi
Piotr, You need to remove the custom manager from your code since you are not making use of it. You also need to read the custom manager documentation so you can understand managers and how they work On 10/15/11, Thomas Orozco wrote: > Just don't assign anything to

Re: Don't understand still

2011-10-15 Thread Daniel Roseman
On Saturday, 15 October 2011 15:12:17 UTC+1, Piotr Hosowicz wrote: > > Hello, > > I still do not understand how things are connected in Django. In > models.py I have: > > class CampaignManager(models.Manager): > pass > > class CampPeople(models.Model): > person =

Re: Don't understand still

2011-10-15 Thread Piotr Hosowicz
> Unfortunately, you have received a lot of very bad advice in this thread, > for which I can only apologise on behalf of Django-users ... > > The references to your custom Managers are misleading. Although it's true > that you don't need them, because they're not changing anything, you aren't >

Re: Don't understand still

2011-10-15 Thread Babatunde Akinyanmi
I guess I should apologize myself. To alter how managers return objects the get_query_set method should be overloaded. On 10/15/11, Daniel Roseman wrote: > On Saturday, 15 October 2011 15:12:17 UTC+1, Piotr Hosowicz wrote: >> >> Hello, >> >> I still do not understand

Re: Django models design question

2011-10-15 Thread omerd
Thank you for the response. As stuart wrote, i should give more details about the website. Currently let's suppose I have 2 interesting tables (I'm not sure that the relationship between these 2 tables is well designed): 1. Details, that contains all the possible information that should be

Pango causing mod_msgi to crash - Segmentation fault (11)

2011-10-15 Thread pbzRPA
Hi I was wondering if anyone had a similar problem when trying to use pango in django running under mod_wsgi on apache. I am running |20:11:06|# cat /etc/debian_version 6.0.3 When I run a runserver on the same server it works fine but the moment I "import pango" in any of my modules the

Pango causing mod_wsgi to crash - Segmentation fault (11)

2011-10-15 Thread pbzRPA
Hi I was wondering if anyone had a similar problem when trying to use pango in django running under mod_wsgi on apache. I am running |20:11:06|# cat /etc/debian_version 6.0.3 When I run a runserver on the same server it works fine but the moment I "import pango" in any of my modules the

Re: django 1.3: how to use get_abolute_url in class based generic views

2011-10-15 Thread Reinout van Rees
On 13-10-11 23:57, Andriyko wrote: class Article(models.Model): .. # with django 1.2 was @models.permalink def get_absolute_url(self): return ('article_detail', (), { 'year': self.pub_date.strftime("%Y"), 'month':

How to handle the URL

2011-10-15 Thread Tsung-Hsien
I want to build a gallery which connects to different photo sets. I have been completed the gallery main page, however, I meet two problems: 1) Use title name of cover image as the URL of photo page, but if the name include blank, then The URL is not complete. For example: the cover image named

Using .filter() on a constant expression

2011-10-15 Thread Tim Chase
I have some gnarly AND/OR logic combining Q() objects but deep within the logic, I need to do a comparison of two constants. In an ideal world, the logic would look something like def age(self, age): ... & Q(12=as_of.month) & ... but that's invalid python. I *can* break out this