How to use SESSION_COOKIE_DOMAIN on two subdomains

2011-09-17 Thread Wim Feijen
Hello,

I'd like to share the same session across two subdomains, namely:
crm.trumpetcms.nl
wtsadvocaten.trumpetcms.nl

Do I have to set the SESSION_COOKIE_DOMAIN in both settings.py files?
Or just in one?

Is this line correct?
SESSION_COOKIE_DOMAIN = '.trumpetcms.nl'

I am hosting the projects using an apache/nginx combination and
virtual hosts.

In Google Chrome, Incognito mode, what happens is, when I log into the
server at:
http://wtsadvocaten.trumpetcms.nl/admin/

I'm still begin asked to login at:
http://crm.trumpetcms.nl/

I am using Django 1.3.0.

Any help will be very much appreciated, 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-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: Learn DJango first, then learn Pinax; or just learn Pinax straight-off?

2011-09-17 Thread Alec Taylor
Also, quick tutorial question; are there a good set of video tutorials
(i.e. on YouTube or metacafe) for DJango?

/me finds the most resources he has at his disposal the quicker he
learns

On Sep 18, 3:43 pm, Alec Taylor  wrote:
> Thanks Russ, I'll use that method.
>
> :]
>
> 2011/9/18 Aesha Umelmumenen :
>
>
>
>
>
> > On Sun, Sep 18, 2011 at 2:24 AM, Russell Keith-Magee
> >  wrote:
>
> >> On Sat, Sep 17, 2011 at 3:17 PM, Alec Taylor 
> >> wrote:
> >> > Good afternoon,
>
> >> > I plan on using Pinax for a project I'm doing (releasing project under
> >> > New BSD or similar).
>
> >> > My Learning Plan is as follows:
> >> > 1.https://docs.djangoproject.com/en/dev//intro/tutorial01/
> >> >https://docs.djangoproject.com/en/dev//intro/tutorial02/
> >> >https://docs.djangoproject.com/en/dev//intro/tutorial03/
> >> > 2.http://pinaxproject.com/docs/dev/contributing/#getting-started
>
> >> > My current Python skills are limited to PythonCGI only.
>
> >> > Would you recommend I follow the aforementioned Learning Plan, or
> >> > would you recommend a different method?
>
> >> This sounds like a reasonable approach -- although I would:
> >>  * Make sure you do Django's Tutorial 4 after Tutorial 3.
> >>  * Use something other than the "how to contribute" guide to Pinax as
> >> your introduction to Pinax.
>
> >> The thing to keep in mind through all of this is that Python, Django
> >> and Pinax are all just layers built on top of each other. Python is a
> >> language. Django is a library that uses that language. Pinax is a set
> >> of specific Django apps and configuration guidelines that help in
> >> using Django. Jumping straight in and learning Pinax from the start is
> >> probably possible, but you'll miss a whole lot of valuable groundwork
> >> along the way.
>
> >> Best of luck with your project!
>
> >> Yours,
> >> Russ Magee %-)
>
> >> --
> >> 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.
>
> > --
> > Ããßã ÚÇÆÔÉ
> > ÑÖí Çááå Úäí
> > æÚä ÕÝæÇä ÇÈä ÇáãÚØá
> > ÑÇÓáæäí Úáí ÈÑíÏ ãÌãæÚÉ ÑÖÇÚ ÇáßÈíÑ
> > æáÅÑÓÇá ãÞÇáÇÊ Ãæ ÕæÑ Ãæ ÝíÏíæ Çáí åÐå ÇáãÌãæÚÉ¡ Þã ÈÅÑÓÇá ÈÑíÏ ÅáßÊÑæäí
> > Åáì
> > reda3_alkab...@googlegroups.com

-- 
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: Learn DJango first, then learn Pinax; or just learn Pinax straight-off?

2011-09-17 Thread Alec Taylor
Thanks Russ, I'll use that method.

:]

2011/9/18 Aesha Umelmumenen :
>
>
> On Sun, Sep 18, 2011 at 2:24 AM, Russell Keith-Magee
>  wrote:
>>
>> On Sat, Sep 17, 2011 at 3:17 PM, Alec Taylor 
>> wrote:
>> > Good afternoon,
>> >
>> > I plan on using Pinax for a project I'm doing (releasing project under
>> > New BSD or similar).
>> >
>> > My Learning Plan is as follows:
>> > 1. https://docs.djangoproject.com/en/dev//intro/tutorial01/
>> > https://docs.djangoproject.com/en/dev//intro/tutorial02/
>> > https://docs.djangoproject.com/en/dev//intro/tutorial03/
>> > 2. http://pinaxproject.com/docs/dev/contributing/#getting-started
>> >
>> > My current Python skills are limited to PythonCGI only.
>> >
>> > Would you recommend I follow the aforementioned Learning Plan, or
>> > would you recommend a different method?
>>
>> This sounds like a reasonable approach -- although I would:
>>  * Make sure you do Django's Tutorial 4 after Tutorial 3.
>>  * Use something other than the "how to contribute" guide to Pinax as
>> your introduction to Pinax.
>>
>> The thing to keep in mind through all of this is that Python, Django
>> and Pinax are all just layers built on top of each other. Python is a
>> language. Django is a library that uses that language. Pinax is a set
>> of specific Django apps and configuration guidelines that help in
>> using Django. Jumping straight in and learning Pinax from the start is
>> probably possible, but you'll miss a whole lot of valuable groundwork
>> along the way.
>>
>> Best of luck with your project!
>>
>> Yours,
>> Russ Magee %-)
>>
>> --
>> 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.
>>
>
>
>
> --
> أمكم عائشة
> رضي الله عني
> وعن صفوان ابن المعطل
> راسلوني علي بريد مجموعة رضاع الكبير
> ولإرسال مقالات أو صور أو فيديو الي هذه المجموعة، قم بإرسال بريد إلكتروني
> إلى
> reda3_alkab...@googlegroups.com
>
>
>

-- 
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: admin extension not being loaded

2011-09-17 Thread kcstrom
It looks like index.html cannot be overridden per app, only per site.  From 
the above link:

"

Not every template in contrib/admin/templates/admin may be overridden per 
app or per model. The following can:

   - app_index.html
   - change_form.html
   - change_list.html
   - delete_confirmation.html
   - object_history.html

"

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/qvVsOP6j5JsJ.
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: Admin coding guidelines order?

2011-09-17 Thread Micky Hulse
On Sat, Sep 17, 2011 at 4:10 PM, Micky Hulse  wrote:
> But are what about the admin.py file?

How's this for organization(?):



I guess I am curious how other folks would go about organizing things. :)

Thanks!
Micky

-- 
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: Learn DJango first, then learn Pinax; or just learn Pinax straight-off?

2011-09-17 Thread Russell Keith-Magee
On Sat, Sep 17, 2011 at 3:17 PM, Alec Taylor  wrote:
> Good afternoon,
>
> I plan on using Pinax for a project I'm doing (releasing project under
> New BSD or similar).
>
> My Learning Plan is as follows:
> 1. https://docs.djangoproject.com/en/dev//intro/tutorial01/
> https://docs.djangoproject.com/en/dev//intro/tutorial02/
> https://docs.djangoproject.com/en/dev//intro/tutorial03/
> 2. http://pinaxproject.com/docs/dev/contributing/#getting-started
>
> My current Python skills are limited to PythonCGI only.
>
> Would you recommend I follow the aforementioned Learning Plan, or
> would you recommend a different method?

This sounds like a reasonable approach -- although I would:
 * Make sure you do Django's Tutorial 4 after Tutorial 3.
 * Use something other than the "how to contribute" guide to Pinax as
your introduction to Pinax.

The thing to keep in mind through all of this is that Python, Django
and Pinax are all just layers built on top of each other. Python is a
language. Django is a library that uses that language. Pinax is a set
of specific Django apps and configuration guidelines that help in
using Django. Jumping straight in and learning Pinax from the start is
probably possible, but you'll miss a whole lot of valuable groundwork
along the way.

Best of luck with your project!

Yours,
Russ Magee %-)

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



Admin coding guidelines order?

2011-09-17 Thread Micky Hulse
Hello,

I follow the rules on this page for my models (and other files/code):



But are what about the admin.py file?

Sometimes my admin classes can get pretty cluttery (form,
display_on_top, prepopulated_fields, filter_horizontal, fieldsets,
methods, other).

Do any of ya'll have any tips on keeping the admin classes organized
and readable?

Thanks!
Micky

-- 
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: is photologue still maintained?

2011-09-17 Thread Justin
Hey,

I'm the original dev of both Photologue and ImageKit. ImageKit is
being actively maintained but I'm not using Photologue in any projects
anymore so it's hard to find time to keep it up. The next version was
planned to be a complete break, as in not backwards compatible, and
based on ImageKit. You can check that out here:

https://bitbucket.org/jdriscoll/django-photolog

I would love for someone who uses PL to take over the project but so
far I haven't found anyone suitable.

-- Justin

On Sep 16, 2:00 am, graeme  wrote:
> It may or may not help you, but ImageKit seems actively maintained:
>
> https://github.com/jdriscoll/django-imagekit
>
> http://groups.google.com/group/django-photologue/browse_thread/thread...
>
> As far as I understand it, a new version of Photologue was planned,
> which would be based on Imagekit. I have no idea whether that happened
> or not.
>
> As far as I can see the original developer seems to be inactive on
> both projects.
>
> On Sep 16, 2:02 am, bedros <2bed...@gmail.com> wrote:
>
>
>
>
>
>
>
> > any idea who's maintaining photologue and if still has a support
> > community? and which fork repo supports the latest django release,
> > there are bunch of forks on  googlecode, github, bitbucket?
>
> > Thanks,
>
> > Bedros

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



admin extension not being loaded

2011-09-17 Thread kcstrom
I know I have to be missing something simple  - I've followed the 
instructions at this 
docand have tried 
extending several different files from the admin site.  I've 
placed an index.html in the /admin// 
directory and tried to override the side bar like:

{% extends "admin/index.html" %}

{% block sidebar %}
This is a test in index.
{% endblock %}

 is the absolute path I've given via TEMPLATE_DIRS in 
settings.py.

If I move my index.html to /admin/ and remove the 
first line I see the h1 (and only that) that I have in my version of the 
file indicating that it is overriding the admin/index.html there.   is the same exact thing that I gave to 'manage.py startapp'.

Any idea what I'm doing wrong?  I am super-frustrated at this point because 
it seems like it should be so easy but it's not working at all.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Fg5N1ovkjloJ.
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.



Learn DJango first, then learn Pinax; or just learn Pinax straight-off?

2011-09-17 Thread Alec Taylor
Good afternoon,

I plan on using Pinax for a project I'm doing (releasing project under
New BSD or similar).

My Learning Plan is as follows:
1. https://docs.djangoproject.com/en/dev//intro/tutorial01/
https://docs.djangoproject.com/en/dev//intro/tutorial02/
https://docs.djangoproject.com/en/dev//intro/tutorial03/
2. http://pinaxproject.com/docs/dev/contributing/#getting-started

My current Python skills are limited to PythonCGI only.

Would you recommend I follow the aforementioned Learning Plan, or
would you recommend a different method?

Thanks for all suggestions,

Alec Taylor

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



When set SESSION_ENGINE to memcached, Django website halts

2011-09-17 Thread Yifu Diao
I have set up memcached in Django using Pylibmc binding:

CACHES = {
'default': {
'BACKEND':
'django.core.cache.backends.memcached.PyLibMCCache',
'LOCATION': ['10.241.1.1:11211',
'10.241.1.2:11211',]
}
}
I tested on server with django shell, and the memcached pool workse
for getting and setting values in memcached. But when I try to set

SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"   OR
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
my website can still be accessed, but halts when user pressed login
button. So I guess this must be the problem with session backend. My
website works fine by using database as session backend. I cannot find
any related error in apache or website error log, and /var/log/
memcached.log is empty.

Reference: https://docs.djangoproject.com/en/1.1/topics/http/sessions/

-- 
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: Removing SECRET_KEY from settings.py

2011-09-17 Thread DrBloodmoney
On Fri, Sep 16, 2011 at 8:54 PM, Tim Chase
 wrote:
> Just returning to some Django work after a time away, I (re)started an old
> project in 1.3 and hit an early issue.  I'd like to keep my settings.py
> under revision-control that is somewhat publicly accessible, but don't want
> my SECRET_KEY exposed.  The solution I've opted for is the following excerpt
> of my settings.py on which I'm hoping for feedback:
>
>  SECRET_FILE = "secret.txt"
>  if os.path.exists(SECRET_FILE):
>    SECRET_KEY = file(SECRET_FILE).read()
>  else:
>    from random import choice
>    SECRET_KEY = ''.join([
>      choice(
>      'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
>      ) for i in range(50)])
>    f = file(SECRET_FILE, 'w')
>    f.write(SECRET_KEY)
>    f.close()
>
> (key generation ripped directly from
> core/management/commands/startproject.py )
>
> As best I can tell, this should allow me to place secret.txt on machines I
> control, while allowing others to freely download the code and deploy on
> their end with minimal trouble.
>
> Any input would be greatly appreciated,
>
> -tkc


settings.py/
|- __init__.py
|- base.py
|- development.py
|- production.py
|- secret.py # <== not in version control

then in __init__.py:

from base import *
from secret import *

if DEBUG:
from development import *
else:
from production import *

-- 
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: intercept calls to reverse(..) in tests

2011-09-17 Thread DrBloodmoney
On Sat, Sep 17, 2011 at 7:47 AM, Reikje  wrote:
> Okay I am having some troubles getting this to work. In my application
> I am using WebTest and django-webtest to do template testing. In order
> to monkeypatch the django.core.urlresolvers.reverse function, I have
> created a new Test base that looks like this:
>
> class FacebookWebTest(WebTest):
>
>    def __init__(self, methodName='runTest'):
>        super(FacebookWebTest, self).__init__(methodName)
>        import django.core.urlresolvers
>        django.core.urlresolvers.reverse = self.reverse
>
>    def reverse(*args, **kwargs):
>        return "foo"
>
>
> Then hier is a test:
>
> from django.core.urlresolvers import reverse
>
> class HomepageViewTestCase(FacebookWebTest):
>
>    def testPopulateFieldsInitially(self):
>        url = reverse('webapp_home')
>        form = self.app.get(url).form
>        ...
>
> Within the HomepageViewTestCase it is still calling the original
> reverse method in django.core.urlresolvers even though it is calling
> the FacebookWebTest constructor before. Any suggestions :)

I usually monkey patch like so:

# myviews.py

from django.core.urlresolvers import reverse

def view(request):
 blah blah
 x = reverse('whaterrr')
 return HttpResponse('monkey-patch')

# tests.py

import myviews

def patch_reverse(name):
 return whatever_you_want

class MyViewTests(TestCase):

def setUp(self):
self.old_reverse = getattr(myviews, 'reverse')
myviews.reverse = patch_reverse

def tearDown(self):
myviews.reverse = self.old_reverse

Gets the job done

-- 
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: access fields value in template

2011-09-17 Thread dm03514
You can access just the values by the values property,
{% for value in object.values %}
{{ value }}
{% endfor %}



On Sep 17, 4:33 am, Phang Mulianto  wrote:
> hi ..
>
> i have a pagination objects :
>
> in my view i got query and paginate it using this :
>
>       objects = paginator.page(page)
>
> then the objects goes into the view template.
> i can populate the field value using this template :
>
> {% for object in objects.object_list %}
> 
> {{ object.title }}
> {{ object.content }}
> {{ object.slug }} 
> {{ object.is_publish }} 
> {{ object.created_at }} 
> {{ object.updated_at }} 
>         {% endfor %}
>
> This solution give the field values of know field name, like title, content,
> slug, etc...
>
> what i want to aim is to access the field value which is unknow, like say it
> is different model .
> i want to use this template in any model i give the to the object_list
> variable.
>
> how to achieve this.
> i try this one :
> {% for x in object.items %}
> {{ x }}
> {% endfor %}
>
> The html result are in table like this :
> ('is_publish', True)('title', u'first day with django')('created_at',
> datetime.datetime(2011, 7, 10, 18, 6, 18))('updated_at',
> datetime.datetime(2011, 8, 23, 0, 26, 42))('content', u'Great
> start...progressing now...')('pk', 1L)('slug', u'first-day-django')
>
> but it show the field name and the field value. how i access the value of
> the field.
>
> i want to create a record list, but not a view template for each model, but
> 1 template for every model.
>
> i hear the django table, but i want to do it my own way..
>
> anyone have suggestion.
>
> Thanks.
> Mulianto

-- 
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: intercept calls to reverse(..) in tests

2011-09-17 Thread Reikje
Okay I am having some troubles getting this to work. In my application
I am using WebTest and django-webtest to do template testing. In order
to monkeypatch the django.core.urlresolvers.reverse function, I have
created a new Test base that looks like this:

class FacebookWebTest(WebTest):

def __init__(self, methodName='runTest'):
super(FacebookWebTest, self).__init__(methodName)
import django.core.urlresolvers
django.core.urlresolvers.reverse = self.reverse

def reverse(*args, **kwargs):
return "foo"


Then hier is a test:

from django.core.urlresolvers import reverse

class HomepageViewTestCase(FacebookWebTest):

def testPopulateFieldsInitially(self):
url = reverse('webapp_home')
form = self.app.get(url).form
...

Within the HomepageViewTestCase it is still calling the original
reverse method in django.core.urlresolvers even though it is calling
the FacebookWebTest constructor before. Any suggestions :)


On Sep 7, 10:23 am, Daniel Roseman  wrote:
> On Wednesday, 7 September 2011 07:49:00 UTC+1, Reikje wrote:
>
> > Hi, I have a bunch of WebTest's which are using the reverse method
> > from django.core.urlresolvers to resolve a URL which the test should
> > call. Example:
>
> > url = reverse('webapp_home')
> > form = self.app.get(url).form
>
> > Now I need to add a query parameter to every url. This is to mimic a
> > Facebook request which will always have the signed_request query
> > parameter. So in theory I could just do this:
>
> > url = reverse('webapp_home') + "?
> > signed_request=vlXgu64BQGFSQrY0ZcJBZASMvYvTHu9GQ0YM9rjPSso.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsIjAiOiJwYXlsb2FkIn0"
>
> > form = self.app.get(url).form
>
> > This is an example of a signed_request from the Facebook
> > documentation. Since, I am a bit lazy, is there a way to sort of
> > intercept all calls to reverse and add the signed_request parameter
> > every time?
>
> You probably just want to monkeypatch urlresolvers.reverse in your test
> setUp methods. Something like this would probably work.
>
>     from django.core import urlresolvers
>     reverse_original = urlresolvers.reverse
>     def reverse(*args, **kwargs):
>         url = reverse_original(*args, **kwargs)
>         url += whatever_you_want_to_add
>         return url
>     urlresolvers.reverse = reverse
>
> --
> DR.

-- 
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: request.user not pickable anymore

2011-09-17 Thread Torsten Bronger
Hallöchen!

Łukasz Rekucki writes:

> On 16 September 2011 22:05, Torsten Bronger
>  wrote:
>
>> this means that we don't have to do anything.
>
> Not really. To 1.4 not be affected, someone needs to write a patch
> for that ticket.

Of course you are right.  I was only refering to "Milestone 1.4" and
"Release blocker" which means that it has high priority.

Tschö,
Torsten.

-- 
Torsten BrongerJabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.com

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



access fields value in template

2011-09-17 Thread Phang Mulianto
hi ..

i have a pagination objects :

in my view i got query and paginate it using this :

  objects = paginator.page(page)

then the objects goes into the view template.
i can populate the field value using this template :

{% for object in objects.object_list %}

{{ object.title }}
{{ object.content }}
{{ object.slug }} 
{{ object.is_publish }} 
{{ object.created_at }} 
{{ object.updated_at }} 
{% endfor %}

This solution give the field values of know field name, like title, content,
slug, etc...

what i want to aim is to access the field value which is unknow, like say it
is different model .
i want to use this template in any model i give the to the object_list
variable.

how to achieve this.
i try this one :
{% for x in object.items %}
{{ x }}
{% endfor %}

The html result are in table like this :
('is_publish', True)('title', u'first day with django')('created_at',
datetime.datetime(2011, 7, 10, 18, 6, 18))('updated_at',
datetime.datetime(2011, 8, 23, 0, 26, 42))('content', u'Great
start...progressing now...')('pk', 1L)('slug', u'first-day-django')

but it show the field name and the field value. how i access the value of
the field.

i want to create a record list, but not a view template for each model, but
1 template for every model.

i hear the django table, but i want to do it my own way..

anyone have suggestion.

Thanks.
Mulianto

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