Re: Reading an entire template into a string

2008-04-14 Thread nandu



On Apr 15, 8:16 am, nandu <[EMAIL PROTECTED]> wrote:
> On Apr 14, 8:42 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> > Not render, just load.
>
> > I think `django.template.loader.find_template_source` can help
>
> > On Apr 14, 4:17 pm, Darryl Ross <[EMAIL PROTECTED]> wrote:
>
> Thank you for your reply.
>
> I tried using django.template.loader.find_template_source` becuase I
> am reading in an HTML template the newlines (\n)
> do not get rendered in the browser.  Is there any way to strip out the
> newlines from the return value of
> `django.template.loader.find_template_source`
>
> Thanks,
> Nandu

Sorry django.template.loader.find_template_source does work.  It
returns a tuple a number of values in my case just two.  The first one
contains the template string itself and does not contain any newline
characters.
Hence, if I reference the first value of the tuple I will ge what I
need.

Thanks to all who have posted
Nandu
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Have you used OrderingField?

2008-04-14 Thread Julien

Hi,

I've stumbled on OrderingField in django.db.models.fields.

That looks very interesting to me but I could not find any example of
use, either in Django itself or on the web.

Do you know what it is, and how to use it?

Thanks a lot!

Julien


PS: Here's its code:

class OrderingField(IntegerField):
empty_strings_allowed=False
def __init__(self, with_respect_to, **kwargs):
self.wrt = with_respect_to
kwargs['null'] = True
IntegerField.__init__(self, **kwargs )

def get_manipulator_fields(self, opts, manipulator, change,
name_prefix='', rel=False, follow=True):
return [oldforms.HiddenField(name_prefix + self.name)]
--~--~-~--~~~---~--~~
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: Dynamic queryset to ModelChoiceField

2008-04-14 Thread [EMAIL PROTECTED]

Sure, just give the modelchoicefield Topic.objects.all() to start
with, as this will never actually get used.

On Apr 14, 11:14 pm, shabda <[EMAIL PROTECTED]> wrote:
> I have a form where I want to do something like,
>
> class SetDefaultForm(forms.Form):
>     topics = forms.ModelChoiceField()
>
>     def __init__(self, user):
>         super(SetDefaultForm, self).__init__()
>         self.fields['topics'].queryset = Topic.objects.filter(user)
>
> This does not work, of course, as ModelChoiceField has queryset as
> required argument.
>
> So I have to do something like,
>
> class SetDefaultForm(forms.Form):
>     topics = forms.ChoiceField()
>
>     def __init__(self, user):
>         super(SetDefaultForm, self).__init__()
>         self.fields['topics'].choices= [topic for topic in
> Topic.objects.filter(user)]
>
> Is there a better way?
--~--~-~--~~~---~--~~
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 overwrite the hyperlink of objects in change list template of django admin?

2008-04-14 Thread Malcolm Tredinnick


On Mon, 2008-04-14 at 20:50 -0700, Leon wrote:
> Great. I'll wait for the newforms-admin branch integration.
> 
> Is there any document about this newforms-admin?

Django's wiki and documentation and things really are very
search-engine-friendly. :-)

http://www.google.com/search?q=django+newforms-admin

The wiki page is probably the right place to start:
http://code.djangoproject.com/wiki/NewformsAdminBranch

Regards,
Malcolm

-- 
Honk if you love peace and quiet. 
http://www.pointy-stick.com/blog/


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



Dynamic queryset to ModelChoiceField

2008-04-14 Thread shabda

I have a form where I want to do something like,

class SetDefaultForm(forms.Form):
topics = forms.ModelChoiceField()

def __init__(self, user):
super(SetDefaultForm, self).__init__()
self.fields['topics'].queryset = Topic.objects.filter(user)

This does not work, of course, as ModelChoiceField has queryset as
required argument.

So I have to do something like,

class SetDefaultForm(forms.Form):
topics = forms.ChoiceField()

def __init__(self, user):
super(SetDefaultForm, self).__init__()
self.fields['topics'].choices= [topic for topic in
Topic.objects.filter(user)]

Is there a better way?
--~--~-~--~~~---~--~~
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 abstract base class in QS-RF

2008-04-14 Thread Malcolm Tredinnick


On Mon, 2008-04-14 at 23:38 -0400, Michael wrote:
> I think I convoluted my case by putting that related_name in there.
> This doesn't work without the related_name option too.
> 
> I was looking into it further and I realized that the problem with the
> syncdb is the fact that m2m_db_table is the same on each inherited
> field. Essentially this could be fixed by looking back into the model
> that the manytomanyfield is supposed to be referring to. This involves
> somehow getting access to the model of the manytomany field in the
> curried function _get_m2m_db_table.

If that's all it is, then the fix should be pretty easy: for abstract
base classes, the intermediate table name should be based on the name of
the child model, not the abstract model. I can't drop everything right
this minute to look at this, but I'm a little surprised that isn't
happening already and it should be easy enough to fix when I get some
time this evening.

However that still leaves a problem in any case where m2m fields refer
to the same model (or where somebody wants to specify the related name)
in the abstract base class and that's probably going to be a case of
hard cheese. Abstract base classes are an aid, not a crutch.
Fortunately, we can detect that problem and raise a sensible error (I
was thinking about that over lunch and it doesn't seem too hard).

Regards,
Malcolm

-- 
I don't have a solution, but I admire your problem. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 overwrite the hyperlink of objects in change list template of django admin?

2008-04-14 Thread Leon

Great. I'll wait for the newforms-admin branch integration.

Is there any document about this newforms-admin?

On Apr 15, 9:22 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2008-04-14 at 04:04 -0700, Leon wrote:
> > I've tried that method and make my own object list in the customized
> > change_list.html.
> > That REALLY duplicate a lot of works. Is it possible to add a hook
> > function (middleware?) just
> > before the change_list template being rendered?
>
> You're really asking, in general, whether it's possible to make the
> admin interface more customisable. Yes there is and through the
> advantage of owning a time machine, we've already done it in the
> newforms-admin branch. Not sure if your precise problem is addressed
> specifically there, but most customisations are easier. That's on track
> to be merged with trunk "soon", so it's not worth worrying too much
> about anything with existing admin beyond just getting something to work
> at the moment.
>
> >  In that way, I might
> > be able to modify the
> > data before it is passed to template.
>
> > I had expected there is a magic function in model class to change it. :
> > (
>
> Why? Models represent data storage not presentation. The new admin
> actually moves all of the admin stuff out of the model as part of being
> more consistent in that area (along with a bunch of other benefits like
> allowing multiple admin setups for a model).
>
> Regards,
> Malcolm
>
> --
> Always try to be modest and be proud of it!http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



GeoDjango: Completely Overwhelmed

2008-04-14 Thread Alex Ezell

I talked with a couple of folks at PyCon about using GeoDjango for my
app. I am working on getting all the pieces installed, but frankly, I
am completely overwhelmed by all the terminology.

My use case is this:
My app creates a trip which as a lat/lng pair as a starting point and
a lat/lng pair as an ending point. What I would like to do is let a
user into a location in for the start, end, or both.

The system would then show them trips which have start, end, or both
points in common with the locations they have entered in the search.
"In common" being defined as within a radius of say 100 miles or so.

I don't need great precision with the radius or search, so anything
within a mile or so of precision is more than enough.

So, with that in mind, I have two questions:
1) Can GeoDjango help me with this?
2) What part of GeoDjango should I look at first to try to accomplish
this?

I guess I should mention that I am not new to Django or Python, but
GIS stuff is foreign to me for now.

Thanks!

Alex Ezell
--~--~-~--~~~---~--~~
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 abstract base class in QS-RF

2008-04-14 Thread Michael
I think I convoluted my case by putting that related_name in there. This
doesn't work without the related_name option too.

I was looking into it further and I realized that the problem with the
syncdb is the fact that m2m_db_table is the same on each inherited field.
Essentially this could be fixed by looking back into the model that the
manytomanyfield is supposed to be referring to. This involves somehow
getting access to the model of the manytomany field in the curried function
_get_m2m_db_table.

I have been sitting with an open ticket for the last few hours trying to
write up a patch that can fix this problem, however I can't seem to be able
to accomplish this without at least adding an extra field to the
ManyToManyField and creating a new instance for each of the models. This
seems like overkill and not to follow the clean way you have done this with
the other relationships.

I would love some guidance on this one. I really see a use for an inherited
ManyToManyField to work as an opposite generic foreign key. Thanks for the
great work Malcolm,

Michael



On Mon, Apr 14, 2008 at 9:30 PM, Malcolm Tredinnick <
[EMAIL PROTECTED]> wrote:

>
>
> On Mon, 2008-04-14 at 08:23 -0700, Michael Newman wrote:
> > Imagine:
> >
> > from django.db import models
> >
> > class Mtmfield(models.Model):
> > afield = models.TextField()
> >
> > class Place(models.Model):
> > somefield = models.ManyToManyField(Mtmfield,
> > related_name='a_name_that_cant_have_conflicts')
> >
> > class Meta:
> > abstract = True
> >
> > class Restaurant(Place):
> > someotherfield = models.TextField()
> >
> > class Bar(Place):
> > somethirdfield = models.TextField()
>
> [...]
> > This only seems to occur when there is a ManyToManyField in the
> > abstract base class and there are 2 items that extend that base class.
> > This does not seem to be a problem when the base class is not
> > abstract. This also occurs in MySQL.
> >
> > I would like to open a ticket, but wanted to just make sure that I am
> > implementing the abstract base classes in the way that they were
> > designed. I would also like to help out with a patch, but can't even
> > begin to figure out where the issue is coming from.
>
> Hmm ... I suspect you're doomed there, in that there's no easy solution
> here. The requirement is that all reverse relations must have unique
> names. And if you have a Mtmfield instance and try to access the
> "a_name_that_cant_have_conflicts" attribute, it's not going to be
> unique.
>
> So I think it's a case of "don't do that". Django's default name will be
> unique for most simple cases (you're forcing the disaster here by
> specifying the related name). In complex cases -- such as multiple
> many-to-many fields on the same abstract base class that relate to the
> same model -- it might just not be possible. It's not going to be
> particularly easy to be add something that allows dynamic related name
> generation, since it has to be both completely predictable to the code
> using those model and executable at import time.
>
> I'll think about it a bit, but at the moment I'm inclined to think it's
> not worth building in that type of complex API just for this type of
> case. In these cases you'll just need to write out the fields on the
> base models and given them their own unique related names. Life's like
> that sometimes; it's a clash between not having to annotate both ends of
> a relation and still being able to traverse it both ways (requiring
> unique names), and wanting to reuse a field declaration multiple times
> (meaning all the information is the same).
>
> Regards,
> Malcolm
>
> --
> On the other hand, you have different fingers.
> http://www.pointy-stick.com/blog/
>
>
> >
>

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



Normalized dates

2008-04-14 Thread gmacgregor

Some of my project app's models have a DateTimeField where the value
is UTC while others have EDT/EST values. This is because I populate
some models (ie. a blog entry) via django-admin while other data is
populated via my flickr/del.icio.us accounts (via django-syncr ).

When displaying timestamps, I want all values to be EDT/EST-- the
timezone in which I live. Is there an easy way to handle this
conversion on the template level? Or should I start thinking about
overriding the save() method to either make all DateTimeField values
EDT/EST/UTC? Is there a simple solution out there that I just haven't
yet considered? Thanks for the help...
--~--~-~--~~~---~--~~
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 change language by clicking on link (using GET not POST) (set_language redirect)

2008-04-14 Thread Malcolm Tredinnick


On Mon, 2008-04-14 at 17:03 -0700, Simon Tite wrote:
[...]
> However, instead of clicking on submit, I would prefer the user to
> click on just a regular link, so I nead to write something like..
> 
> 
> http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Newbie Question: Is "ordering" a list or a tuple or both / either?

2008-04-14 Thread Malcolm Tredinnick


On Mon, 2008-04-14 at 08:22 -0700, Kevin Cole wrote:
> Hi,
> 
> I'm following along in the book, and noticed that when "ordering" is
> used in the Meta class (Chapter 5, page 77) it is a list.  However,
> later, when used in the Admin class (Chapter 6, page 91), it's a
> tuple.

Both work.

> Testing it out, it seems to work okay either way, but I wondered if
> there was a good reason to have Meta one way and Admin the other.  Is
> there a "best practice" here?  (Or was it simply a typo in the book?)

Meh. Either one works, so it doesn't really matter.

The only slight difference is that if you have a single ordering item, a
single item list is less error prone that a single item tuple. People
keep forgetting that a single item tuple *must* have a trailing comma.
So you'll often see cases of using

['foo']

instead of 

('foo',)

Regards,
Malcolm

-- 
If you think nobody cares, try missing a couple of payments. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Troubles with localization

2008-04-14 Thread Malcolm Tredinnick


On Mon, 2008-04-14 at 17:31 +0200, Boris Ozegovic wrote:
> I recently translated Django on croatian language, it works like a
> charm, but only on my computer?  :)  Today when I deployed application
> to server, hr localization didn't worked.  In settings.py I have 'hr'
> just like I have at my home.  Folder 'hr' is at right place, and, what
> is very important, every other localization works (de, en, you name
> it).  What could be the problem?

Does the web server have permission to read the MO files?

Two other debugging approaches to try: since you know
de/LC_MESSAGES/django.mo works, copy over that mo file to your
hr/LC_MESSAGES/ directory. Okay, Croation will now look like German if
it works, or not, if it doesn't work. In the latter case, I would
suspect permission problems (check the hr/ and hr/LC_MESSAGES/
directories).

Secondly, copy the django.mo file from the hr/LC_MESSAGES/ directory to
the de/LC_MESSAGES/ directory and view the site in German. Does it like
Croation? If so, the MO file is fine and it's a permissions problem or
something similar (you can at least start looking for differences
between the two locations). If not, there's a problem with the MO file
(and possibly with the PO file in the first place).

Also you said you "translated Django". Since Django already has a
Croation translation in trunk, does that work properly?

Regards,
Malcolm

-- 
Quantum mechanics: the dreams stuff is made of. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 abstract base class in QS-RF

2008-04-14 Thread Malcolm Tredinnick


On Mon, 2008-04-14 at 08:23 -0700, Michael Newman wrote:
> Imagine:
> 
> from django.db import models
> 
> class Mtmfield(models.Model):
> afield = models.TextField()
> 
> class Place(models.Model):
> somefield = models.ManyToManyField(Mtmfield,
> related_name='a_name_that_cant_have_conflicts')
> 
> class Meta:
> abstract = True
> 
> class Restaurant(Place):
> someotherfield = models.TextField()
> 
> class Bar(Place):
> somethirdfield = models.TextField()

[...]
> This only seems to occur when there is a ManyToManyField in the
> abstract base class and there are 2 items that extend that base class.
> This does not seem to be a problem when the base class is not
> abstract. This also occurs in MySQL.
> 
> I would like to open a ticket, but wanted to just make sure that I am
> implementing the abstract base classes in the way that they were
> designed. I would also like to help out with a patch, but can't even
> begin to figure out where the issue is coming from.

Hmm ... I suspect you're doomed there, in that there's no easy solution
here. The requirement is that all reverse relations must have unique
names. And if you have a Mtmfield instance and try to access the
"a_name_that_cant_have_conflicts" attribute, it's not going to be
unique.

So I think it's a case of "don't do that". Django's default name will be
unique for most simple cases (you're forcing the disaster here by
specifying the related name). In complex cases -- such as multiple
many-to-many fields on the same abstract base class that relate to the
same model -- it might just not be possible. It's not going to be
particularly easy to be add something that allows dynamic related name
generation, since it has to be both completely predictable to the code
using those model and executable at import time.

I'll think about it a bit, but at the moment I'm inclined to think it's
not worth building in that type of complex API just for this type of
case. In these cases you'll just need to write out the fields on the
base models and given them their own unique related names. Life's like
that sometimes; it's a clash between not having to annotate both ends of
a relation and still being able to traverse it both ways (requiring
unique names), and wanting to reuse a field declaration multiple times
(meaning all the information is the same).

Regards,
Malcolm

-- 
On the other hand, you have different fingers. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 overwrite the hyperlink of objects in change list template of django admin?

2008-04-14 Thread Malcolm Tredinnick


On Mon, 2008-04-14 at 04:04 -0700, Leon wrote:
> I've tried that method and make my own object list in the customized
> change_list.html.
> That REALLY duplicate a lot of works. Is it possible to add a hook
> function (middleware?) just
> before the change_list template being rendered?

You're really asking, in general, whether it's possible to make the
admin interface more customisable. Yes there is and through the
advantage of owning a time machine, we've already done it in the
newforms-admin branch. Not sure if your precise problem is addressed
specifically there, but most customisations are easier. That's on track
to be merged with trunk "soon", so it's not worth worrying too much
about anything with existing admin beyond just getting something to work
at the moment.

>  In that way, I might
> be able to modify the
> data before it is passed to template.
> 
> I had expected there is a magic function in model class to change it. :
> (

Why? Models represent data storage not presentation. The new admin
actually moves all of the admin stuff out of the model as part of being
more consistent in that area (along with a bunch of other benefits like
allowing multiple admin setups for a model).

Regards,
Malcolm

-- 
Always try to be modest and be proud of it! 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Reading an entire template into a string

2008-04-14 Thread nandu



On Apr 14, 8:42 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> Not render, just load.
>
> I think `django.template.loader.find_template_source` can help
>
> On Apr 14, 4:17 pm, Darryl Ross <[EMAIL PROTECTED]> wrote:

Thank you for your reply.

I tried using django.template.loader.find_template_source` becuase I
am reading in an HTML template the newlines (\n)
do not get rendered in the browser.  Is there any way to strip out the
newlines from the return value of
`django.template.loader.find_template_source`

Thanks,
Nandu
--~--~-~--~~~---~--~~
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 change language by clicking on link (using GET not POST) (set_language redirect)

2008-04-14 Thread Simon Tite

The documentation on how the user can change the language of a page/
site (from: http://www.djangoproject.com/documentation/i18n/), in the
section  "The set_language redirect view", gives the following code:





{% for lang in LANGUAGES %}
{{ lang.1 }}
{% endfor %}





This of course means the user has to click on the language required,
then click the submit button. The result is put in POST data, and then
the redirect to " /i18n/setlang/" does its magic, then returns you
back to the page you came from, with the new LANGUAGE_CODE set up
correctly and, (here's the magic), the code is also automatically
stored in the user's session and cookie data, providing useful
persistence.

However, instead of clicking on submit, I would prefer the user to
click on just a regular link, so I nead to write something like..


http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newbie Question: Is "ordering" a list or a tuple or both / either?

2008-04-14 Thread [EMAIL PROTECTED]

AFAIK, Django accepts lists and tuples interchangeably (if
isinstance(xxx, (list, tuple)) allows for xxx to be either of the two)
in many cases.

On Apr 14, 11:22 am, Kevin Cole <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm following along in the book, and noticed that when "ordering" is
> used in the Meta class (Chapter 5, page 77) it is a list.  However,
> later, when used in the Admin class (Chapter 6, page 91), it's a
> tuple.
>
> Testing it out, it seems to work okay either way, but I wondered if
> there was a good reason to have Meta one way and Admin the other.  Is
> there a "best practice" here?  (Or was it simply a typo in the book?)
--~--~-~--~~~---~--~~
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: Slow template

2008-04-14 Thread [EMAIL PROTECTED]

It sounds like what's lagging is the rendering - try saving the
rendered page as html, how long does Firefox/Firefox with Fasterfox
take to display that? You might also want to try with Fasterfox
disabled, some of its tweaks might be detrimental if you're querying a
server on the same machine.
Good luck!

On Apr 14, 10:28 am, Sebastian <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Ive been using Django for a while now, and there has been one page in
> my application that has been running very slowly no matter what I do.
> Im using Django 0.96.1.
>
> The page in question renders approximately 8 tables, each with about
> 50 rows.
> This does not seem like the kind of page that should take 5-7 seconds
> to load
> (timing from fasterfox).
>
> The view in question uses three raw-sql queries so I am sure there are
> no hidden
> db performance caveats as they have all been profiled and run in the
> millisecond range. I have inserted a few timing lines which yielded
> the following:
>
> The following shows the time elapsed between entering the view's
> authentication
> decorator all the way to just before my template rendering code:
>
> start auth decorator function: 2008-04-14 14:59:18.973822
> just before template render  : 2008-04-14 14:59:19.869873
>
> So thats about 1 second.
>
> The next section relates to the template rendering:
>
> source, origin = loader.find_template_source('test.html')
> time taken was: 0:00:00.004000
>
> template = loader.get_template_from_string(source, origin,
> 'test.html')
> time taken was: 0:00:00.004001
>
> template.render(context)
> time taken was: 0:00:00.248014
>
> Thats only a total of at most 2 seconds! I have no idea where the
> other 4-5 seconds could be coming from. The above samples were taken
> using the Django runtime server to dispatch my
> media files, so I can understand that it is a little slower. However,
> in our
> production environment (where we us apache (with mod_python) to handle
> media files)
> the end result is only slightly better.
>
> Can anyone think of other areas that might be taking up time?
>
> Regards,
> Sebastian
--~--~-~--~~~---~--~~
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: Per user settings and records in the admin views

2008-04-14 Thread dimrub

OK, I seem to have found a way to achieve the first task, even though
it doesn't seem to be a rather elegant one. Here's the code that I
wrote for it:

from django.contrib.admin.views.main import change_list

def index(request):
# Copy the GET dict in order to modify it
g = request.GET.copy()
g['user__id__exact'] = request.user.id
request.GET = g
return change_list(request, 'measurements', 'measurement')

Basically, I pretend as if a filter has been defined, thus cheating
the admin view into filtering the data according to my wish. As I
said, not a pretty sight. And, well, I've still got that other problem
to solve. So, any help will still be greatly appreciated.


--~--~-~--~~~---~--~~
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 extend django.views.generic.date_based to return more "context variables"?

2008-04-14 Thread fizban

On 14 Apr, 20:43, fizban <[EMAIL PROTECTED]> wrote:
> So there must be something wrong in the way I pass data to myview
> (it's either year/month/day/slug/ or the queryset). The queryset
> itself, however is setup right because it works when I use
> 'object_detail' instead of myview. Same goes for the regexp's, they
> work with 'object_detail'.

I have finally solved my problem re-writing "myview":

def myview(request, **kwargs):

extra_context = {
'year': kwargs['year'],
'month': kwargs['month'],
'day': kwargs['day']
}

kwargs['extra_context'] = extra_context

return date_based.object_detail(
request, **kwargs
)



--~--~-~--~~~---~--~~
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: Missing help_text for ManyToManyFields with filter_interface

2008-04-14 Thread Karen Tracey
On Mon, Apr 14, 2008 at 4:07 PM, Rodrigo Culagovski <[EMAIL PROTECTED]>
wrote:

> The help_text for my ManyToManyFields dissapears when I use
> "filter_interface=models.HORIZONTAL" (or "=models.VERTICAL").
> I figure that it's the JavaScript in the filter_interface, as the
> help_text is there before the JavaScript modifies the field. Using
> trunk.
>

I doubt this will be fixed on trunk, but there's an open ticket for it
against newforms-admin:

http://code.djangoproject.com/ticket/6183

It's got a patch you could try out if you'd like a fix before the ticket
gets resolved (+ newforms-admin merged to trunk).  Not sure if the patch
will need modification to work on trunk.

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



Re: Dynamically limiting choices in admin.

2008-04-14 Thread Rodrigo Culagovski

Richard,

I see your point, but there could be many, many issues for each
magazine, and over a hundred magazines total, so I don't want to make
the users wade through a few thousand issues each time. I'd like to be
able to drill down, first pick a magazine, then one of its issues.

What I'm thinking is do it backwards: give Magazine a
ManyToManyField(Issue), and Issue a ManyToManyField(Article), so you
create or select a Magazine, add an Issue, and then add Articles to
it.

Thanks!

Rodrigo


On Apr 14, 4:19 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> This is where I would suggest you rethink your data model.  Is there a
> reason to link Article to both Issues and Magazine?
>
> Why not something like:
>
> Issues has FK (magazine) to Magazine
> Articles has FK (issue) to Issues
>
> Issues could be configured to return its magazine.title and
> self.issue_number (or whatever) in its __unicode__() function so when you
> created an article, you would make one selection: the issue the article was
> in.  If the articles could be in multiple issues, make the Article.issues a
> [EMAIL PROTECTED]
> hth,
> -richard
>
> On 4/14/08, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have 3 models: Magazine, Issue and Article.
> > Each Magazine has 1 or more Issues and each Issue has 1 or more
> > Articles.
> > Article has models.ForeignKey(Issue) and models.ForeignKey(Magazine).
> > Issue has models.ForeignKey(Magazine)).
> > In the admin, when creating a new article, I choose which Magazine it
> > belongs to and then which Issue of  that Magazine.
>
> > Is there a way to limit the Issues to only those that belong to the
> > chosen Magazine?
>
> > Could this be done by dynamically updating the list of Issues when you
> > select a Magazine, without needing to save the record first?
> > JavaScript, AJAX maybe?
--~--~-~--~~~---~--~~
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: Dynamically limiting choices in admin.

2008-04-14 Thread Richard Dahl
This is where I would suggest you rethink your data model.  Is there a
reason to link Article to both Issues and Magazine?

Why not something like:

Issues has FK (magazine) to Magazine
Articles has FK (issue) to Issues

Issues could be configured to return its magazine.title and
self.issue_number (or whatever) in its __unicode__() function so when you
created an article, you would make one selection: the issue the article was
in.  If the articles could be in multiple issues, make the Article.issues a
[EMAIL PROTECTED]
hth,
-richard




On 4/14/08, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
>
>
> I have 3 models: Magazine, Issue and Article.
> Each Magazine has 1 or more Issues and each Issue has 1 or more
> Articles.
> Article has models.ForeignKey(Issue) and models.ForeignKey(Magazine).
> Issue has models.ForeignKey(Magazine)).
> In the admin, when creating a new article, I choose which Magazine it
> belongs to and then which Issue of  that Magazine.
>
> Is there a way to limit the Issues to only those that belong to the
> chosen Magazine?
>
> Could this be done by dynamically updating the list of Issues when you
> select a Magazine, without needing to save the record first?
> JavaScript, AJAX maybe?
> >
>

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



www.romaworld.ro Florin Niculescu

2008-04-14 Thread romaworld.ro

 Florin Niculescu a sustinut doua concerte, la inceputul lunii, la
Paris.
www.romaworld.ro
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Missing help_text for ManyToManyFields with filter_interface

2008-04-14 Thread Rodrigo Culagovski

The help_text for my ManyToManyFields dissapears when I use
"filter_interface=models.HORIZONTAL" (or "=models.VERTICAL").
I figure that it's the JavaScript in the filter_interface, as the
help_text is there before the JavaScript modifies the field. Using
trunk.
--~--~-~--~~~---~--~~
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: cannot resolve keyword mmtype__eq into field

2008-04-14 Thread [EMAIL PROTECTED]

http://www.djangoproject.com/documentation/db-api/#field-lookups

On Apr 14, 3:02 pm, Jaap <[EMAIL PROTECTED]> wrote:
> Thanks - that worked. I then tried
> pdata=myfile.objects.filter(mmtype__in=["W", "X"])
> and that worked too!
>
> Question: where can I find the complete documentation of the filter
> expressions? I've been reading a lot about Django and Python - and
> don't know where to find this information in the pile anymore...
--~--~-~--~~~---~--~~
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: cannot resolve keyword mmtype__eq into field

2008-04-14 Thread Jaap

Thanks - that worked. I then tried
pdata=myfile.objects.filter(mmtype__in=["W", "X"])
and that worked too!

Question: where can I find the complete documentation of the filter
expressions? I've been reading a lot about Django and Python - and
don't know where to find this information in the pile anymore...

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



Dynamically limiting choices in admin.

2008-04-14 Thread Rodrigo Culagovski

I have 3 models: Magazine, Issue and Article.
Each Magazine has 1 or more Issues and each Issue has 1 or more
Articles.
Article has models.ForeignKey(Issue) and models.ForeignKey(Magazine).
Issue has models.ForeignKey(Magazine)).
In the admin, when creating a new article, I choose which Magazine it
belongs to and then which Issue of  that Magazine.

Is there a way to limit the Issues to only those that belong to the
chosen Magazine?

Could this be done by dynamically updating the list of Issues when you
select a Magazine, without needing to save the record first?
JavaScript, AJAX maybe?
--~--~-~--~~~---~--~~
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: cannot resolve keyword mmtype__eq into field

2008-04-14 Thread Richard Dahl
try this

pdata = myfile.objects.filter(mmtype__exact="W")
hth,
-richard

On 4/14/08, Jaap <[EMAIL PROTECTED]> wrote:
>
>
> django version 0.96.1 on windows xp home.
>
> error is caused by statement in view:
> pdata = myfile.objects.filter(mmtype__eq="W")
>
> where the model is:
>
> mxt = (
>('N", 'Narrow'),
>('W', 'Wide'),
> )
>
> class Example(models.Model):
>name=models.Charfield(maxlength=30)
>mmtype=models.Charfield(maxlength=1, choices=mxt)
>
> What is the problem 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
-~--~~~~--~~--~--~---



cannot resolve keyword mmtype__eq into field

2008-04-14 Thread Jaap

django version 0.96.1 on windows xp home.

error is caused by statement in view:
pdata = myfile.objects.filter(mmtype__eq="W")

where the model is:

mxt = (
('N", 'Narrow'),
('W', 'Wide'),
)

class Example(models.Model):
name=models.Charfield(maxlength=30)
mmtype=models.Charfield(maxlength=1, choices=mxt)

What is the problem 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
-~--~~~~--~~--~--~---



Re: chained many-to-manys

2008-04-14 Thread Richard Dahl
 How about:

a = A.objects.get(pk=1)
c = C.objects.filter(Q(a__exact = a) | Q(b__a__exact = a)).distinct()
hth,
-richard



On 4/14/08, Jeff Gentry <[EMAIL PROTECTED]> wrote:
>
>
> I have a setup that I figured I could just crib off of the
> User/Group/Permission code because the setup is basically identical, but
> falling a bit short here (perhaps I'm just not looking at the right code).
>
> I have three classes, As, Bs & Cs.
>
> A has a M2M relationship with both B & C.
> B has a M2M relationship with C.
>
> For any given instance of A, I want to see all of its C's - either
> directly via its M2M or inherited via its Bs.  You can see why I said this
> is basically identical to the user/group/permission setup.
>
> I looked at django.contrib.auth.models and Group has a M2M
> "permissions" and User has a M2M user_permissions, but all of the code
> that I found referencing a user's effective permission set is going out to
> the auth backends which I'm sure is not really what I want to do here.  Is
> there another place to look to find the best way to get what I want?
>
>
> >
>

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



Per user settings and records in the admin views

2008-04-14 Thread dimrub

Hi, all!

I am fairly new to Django, but I think I've looked rather thoroughly
at the available documentation, and couldn't come up with an answer,
so I'll ask here, and please forgive me if it's a FAQ.

I would like to do basically two things, both are related to the admin
views and to users. The situation is that I have a model with the user
as a foreign key. I would like to:

1. show to the user only the records that belong to this user (i.e.
have his username as the value of the key field)
2. show in the list and add/change view only the fields that the user
has chosen in his preferences (and, while at that, get the caption of
several of these fields from the preferences as well)

Also, I wonder whether it is possible to combine the list and the add/
change views, that is: to have a view, that has first the add/change
stuff, and then - the list of last several items.

I understand more or less how to do all of this with my own views, but
ideally I would like to do it using the admin views - I feel I'm 80%
there, and I'd loath to redo it all by myself.

Thanks a lot in advance!
--~--~-~--~~~---~--~~
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: am i using direct_to_template the wrong way?

2008-04-14 Thread Filipe Correia

Thank you. My eyes were repeatedly missing it, somehow :|

Cheers,
Filipe

On Apr 14, 7:21 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 14, 2008 at 1:37 PM, Filipe Correia <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm getting the following error when using a direct_to_template view:
>
> > TypeError at /help/
> > direct_to_template() takes at least 2 non-keyword arguments (1 given)
>
> > I have the following code on my urls.py:
>
> > urlpatterns = patterns('django.views.generic.simple',
> >   (r'^$', 'redirect_to', {'url': 'search/'}),
> >   (r'^help/$', 'direct_to_template', {'template:': 'help.html'}),
>
> You have an extra colon before the close quote for 'template'.  So
> direct_to_template isn't getting its required 'template' argument, instead
> it is getting 'template:'.
>
> Karen
>
>
>
> > )
>
> > I'm sure I'm missing something trivial... only I don't know what. any
> > thoughts?
> > Btw, I'm using the trunk (rev 7420).
>
> > Thanks,
> > Filipe
--~--~-~--~~~---~--~~
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 extend django.views.generic.date_based to return more "context variables"?

2008-04-14 Thread fizban



On 14 Apr, 19:33, "Norman Harman" <[EMAIL PROTECTED]> wrote:
>
> myview should be in the views.py of your app.  The urlpatterns above is
> pointing to some django views file.  You shouldn't edit the django
> source if you can avoid it.

myview resides in views.py and I'm importing it correctly (from
myapp.views import myview), that's why I'm calling myview and not
"myview" or 'myview' in that pattern. I'm calling the "django views
file" in the urlpattern because, as I said, it is used by all the
other patterns residing in this urlconf. I tried to get rid of that
django view file, leaving empty '' but it didn't work either
(returning 404 on a valid url).

> urlpatterns = patterns('',
>         (r'(?P\d{4})/(?P\d{2})/(?P\d{2})/(?P[\w\d\-]
> +)/$', "myapp.views.myview", dict(entry_info_dict, month_format='%m', 
> template_object_name='entry')),
> )
>
> Not sure if that caused your 404.  They are usually caused by missing
> data (if you used incorrect slug in url), or if regex in urlpatterns is
> wrong.  Turning debug=True in your settings.py should give you more
> information on why there is 404's.

Debug *is* enabled, but it is just throwing me the 404 with no
additional info. Therefore I am assuming there's something wrong in
how I wrote myview, but I am 100% sure it gets called because if I
intentionally mess up myview, it throws errors when I load an url
matching its pattern.

So there must be something wrong in the way I pass data to myview
(it's either year/month/day/slug/ or the queryset). The queryset
itself, however is setup right because it works when I use
'object_detail' instead of myview. Same goes for the regexp's, they
work with 'object_detail'.
--~--~-~--~~~---~--~~
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: Announcing the Django Dash!

2008-04-14 Thread [EMAIL PROTECTED]

Jonathan,


I consider those to be utility libraries (unlikely to comprise your
entire app) and should be fine for use.  You may want to document what
versions you will be using to package with your project/application so
that the judges can replicate.


Daniel




On Apr 13, 7:46 pm, Jonathan Lukens <[EMAIL PROTECTED]> wrote:
> What about Python libraries like PIL or ReportLab?
>
> On Apr 11, 10:42 pm, "Daniel Lindsley" <[EMAIL PROTECTED]> wrote:
>
> > We'd like to announce the firstDjangoDash
> > (http://www.djangodash.com/) to the community.DjangoDashis a web
> > application building competition forDjangodevelopers. The gist is
> > that you and (optionally) one other person can form a team and have 48
> > hours to crank out a fullDjangoapplication. Your application will
> > then be pitted against others for bragging rights (and hopefully some
> > prizes).
>
> > ==
>
> > What IsDjangoDash?
> > A 48 hour, start-to-finish race to produce the bestDjango-based web
> > application you can. Mostly for fun/bragging rights but we're working
> > on upping the ante.
>
> > Who Can Compete?
> > Anyone but myself and (hopefully) three other judges, though this is
> > subject to change depending on popularity.
>
> > When Is It?
> > We'll be hosting theDashon May 31 - June 1, 2008.
>
> > Where?
> > We're running this over the web, so you can be anywhere you like.
> > Coffee shop, work (though we're not responsible for the ramifications
> > of that one), at home, wherever you can find internet access and
> > power.
>
> > How Can I Compete?
> > First, please peruse the rules and judging information 
> > athttp://www.djangodash.com/. We will be opening registration for teams
> > on May 3, 2008. You're not allowed to start anything but ideas and
> > paper mockups until the competition begins on May 31, 2008.
>
> > Why?
> > It's a chance to test yourself and push your limits. A chance to show
> > people what you're capable of. Maybe some exposure. But mostly because
> > we've found competitions like this to be a lot of fun.
>
> > ==
>
> > More details can be found athttp://www.djangodash.com/. We will keep
> > it updated as things develop. If you're interested in competing in theDash, 
> > we'd appreciate if you'd fill out the mini-email form on the
> > front page so we can get an idea of how many people are interested.
>
> > How can I help out?
> > TheDashis really missing two things right now. First, we'd like to
> > have three fair judges signed on to help judge the apps once the
> > competition is over. Second, we're looking for sponsors who can
> > provide prizes as awards. No minimum/maximum dollar value is
> > required/requested. More details on this can be found 
> > athttp://www.djangodash.com/sponsors/.
>
> > Thanks and hope to see some of you competing!
>
> > Daniel Lindsley
> > Toast Drivenhttp://www.toastdriven.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: __unicode__(self):

2008-04-14 Thread Brandon Taylor

Thanks! I was trying to use a + concatenator and it just wasn't happy.

Brandon

On Apr 14, 1:00 am, 1234 <[EMAIL PROTECTED]> wrote:
> add    "self"
>
> 2008/4/14, Malcolm Tredinnick <[EMAIL PROTECTED]>:
>
>
>
> > On Sun, 2008-04-13 at 22:04 -0700, Brandon Taylor wrote:
> > > Hello everyone,
>
> > > I'm pretty new to Django, so please bear with me.
>
> > > When I'm defining a model, and I want to return a value to use in the
> > > admin for the information to be displayed as such:
>
> > > from django.db import models
>
> > > class Link(models.Model):
> > >     name = models.CharField()
> > >     url = models.CharField()
> > >     position = models.PositiveSmallIntegerField()
>
> > >     def __unicode__(self):
> > >         return name
>
> > That will give you a NameError, since "name" does not exist. You want to
> > do "return self.name" there.
>
> > > Is it possible to concatenate fields for the def__unicode__(self)
> > > method? I can't seem to find a way to do that, and was just wondering
> > > if it's possible?
>
> > A __unicode__ method must return a unicode string. That's all. How you
> > construct that string is entirely up to you. If you want to construct it
> > by putting various attribute values together, that's fine. It's just
> > Python. So, for example,
>
> >         return u"%s %s" % (self.name, self.url)
>
> > would return a concatenation of the name and url attributes. Season to
> > taste.
>
> > Regards,
> > Malcolm
>
> > --
> > Honk if you love peace and quiet.
> >http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
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: am i using direct_to_template the wrong way?

2008-04-14 Thread Karen Tracey
On Mon, Apr 14, 2008 at 1:37 PM, Filipe Correia <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I'm getting the following error when using a direct_to_template view:
>
> TypeError at /help/
> direct_to_template() takes at least 2 non-keyword arguments (1 given)
>
> I have the following code on my urls.py:
>
> urlpatterns = patterns('django.views.generic.simple',
>   (r'^$', 'redirect_to', {'url': 'search/'}),
>   (r'^help/$', 'direct_to_template', {'template:': 'help.html'}),


You have an extra colon before the close quote for 'template'.  So
direct_to_template isn't getting its required 'template' argument, instead
it is getting 'template:'.

Karen


>
> )
>
> I'm sure I'm missing something trivial... only I don't know what. any
> thoughts?
> Btw, I'm using the trunk (rev 7420).
>
> Thanks,
> Filipe
> >
>

--~--~-~--~~~---~--~~
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: working example of django.contrib.localflavor ?

2008-04-14 Thread Karen Tracey
On Mon, Apr 14, 2008 at 11:58 AM, e <[EMAIL PROTECTED]> wrote:

>
> I have a form set up and all working, its basically straight out of
> the Form Processing chapter of the django book:
>
> class ContactForm(forms.Form):
>email = forms.EmailField(required=True)
>message = forms.CharField()
>phone_number = forms.CharField()
>
> def contact(request):
>form = ContactForm()
>return render_to_response('contact.html', {'form': form})
>
> Now this works just fine, but I want to use
> django.contrib.localflavor.us.forms.USPhoneNumberFIeld instead of the
> CharField for the phone_number.  When I replace it with this line:
> phone_number = us.forms.USPhoneNumberField(max_length=100)
>
> I get this error:
>
> ViewDoesNotExist: Tried contact in module mysite.contact.views. Error
> was: 'module' object has no attribute 'forms'
>
> What am I doing wrong?
>

I'm assuming you have:

from django.contrib.localflavor import us

somewhere before you try to define phone_number as us.forms.USPhone...

Instead try:

from django.contrib.localflavor.us.forms import USPhoneNumberField
phone_number = USPhoneNumberField()

This works for me.  I don't know why the documentation (
http://www.djangoproject.com/documentation/localflavor/) shows an example
using the first kind of import, since it does not appear that things are set
up for that to work.

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



am i using direct_to_template the wrong way?

2008-04-14 Thread Filipe Correia

Hi,

I'm getting the following error when using a direct_to_template view:

TypeError at /help/
direct_to_template() takes at least 2 non-keyword arguments (1 given)

I have the following code on my urls.py:

urlpatterns = patterns('django.views.generic.simple',
   (r'^$', 'redirect_to', {'url': 'search/'}),
   (r'^help/$', 'direct_to_template', {'template:': 'help.html'}),
)

I'm sure I'm missing something trivial... only I don't know what. any
thoughts?
Btw, I'm using the trunk (rev 7420).

Thanks,
Filipe
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



chained many-to-manys

2008-04-14 Thread Jeff Gentry

I have a setup that I figured I could just crib off of the
User/Group/Permission code because the setup is basically identical, but
falling a bit short here (perhaps I'm just not looking at the right code).

I have three classes, As, Bs & Cs.

A has a M2M relationship with both B & C.
B has a M2M relationship with C.

For any given instance of A, I want to see all of its C's - either
directly via its M2M or inherited via its Bs.  You can see why I said this
is basically identical to the user/group/permission setup.

I looked at django.contrib.auth.models and Group has a M2M
"permissions" and User has a M2M user_permissions, but all of the code
that I found referencing a user's effective permission set is going out to
the auth backends which I'm sure is not really what I want to do here.  Is
there another place to look to find the best way to get what I want?


--~--~-~--~~~---~--~~
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 extend django.views.generic.date_based to return more "context variables"?

2008-04-14 Thread Norman Harman

fizban wrote:
>
> On 14 Apr, 16:54, "Norman Harman" <[EMAIL PROTECTED]> wrote:
>   
>> Why don't you use the extra_context parameter to generic views?  Or am I
>> misunderstanding what you are trying to do?
>>
>> def myview(request):
>>context = dict()
>>context["my_custom_var"] = "wwgd"
>>return generic_view(request, extra_context = context, bla=blah,...)
>> 
>
> I have just tried setting it up but it is returning a 404 when I try
> to load the page (and it obviously works with date_based.object_detail
> and/or my custom "entry_detail")
>
> This is the view I tried to setup:
>
> def myview(request, year, month, day, queryset, date_field,
> month_format, slug, template_object_name):
>   context = dict()
>   context['year'] = year
>   context['month'] = month
>   context['day'] = day
>
>   return date_based.object_detail(
>   request, year, month, day, queryset, date_field, month_format, 
> slug,
> template_object_name, extra_context=context,
>   )
>
> As far as I understood your suggestion and the docs I found it should
> work, shouldn't it?
>
> The urlconf, beside the from ... import statements is the following:
>
>
> entry_info_dict = {
>   'queryset': Entry.live.all(),
>   'date_field': 'pub_date',
> }
>
> urlpatterns = patterns('django.views.generic.date_based',
>   (r'(?P\d{4})/(?P\d{2})/(?P\d{2})/(?P[\w\d\-]
> +)/$', myview, dict(entry_info_dict, month_format='%m',
> template_object_name='entry')),
> )
>
> (I'm using django.views.generic.date_based there since it's needed by
> the other patterns, I didn't include them since they are relevant --
> however it won't work even if I snip it out)
>
>   

myview should be in the views.py of your app.  The urlpatterns above is 
pointing to some django views file.  You shouldn't edit the django 
source if you can avoid it.

urlpatterns = patterns('',
(r'(?P\d{4})/(?P\d{2})/(?P\d{2})/(?P[\w\d\-]
+)/$', "myapp.views.myview", dict(entry_info_dict, month_format='%m', 
template_object_name='entry')),
)


Not sure if that caused your 404.  They are usually caused by missing 
data (if you used incorrect slug in url), or if regex in urlpatterns is 
wrong.  Turning debug=True in your settings.py should give you more 
information on why there is 404's.

-- 
Norman J. Harman Jr.  512 912-5939
Technology Solutions Group, Austin American-Statesman

___
Get out and about this spring with the Statesman! In print and online,
the Statesman has the area's Best Bets and recreation events.
Pick up your copy today or go to statesman.com 24/7.

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



Do you want to have successful web site

2008-04-14 Thread a.f


To have successful web site you need
First you need to put your hand in good idea for your site
Than you need web page making software links to free download 4
webpage / html editors including front page 2003
How to chose your web hosting and get the best offers
Links to 5 email extracting + bulk mail sending programs
850 link to sup mating pages of all searches engine & site
directors
Understanding   how search engines work and how to dell with it
Understanding how spam protecting programs work and how to avoid it
  How to dell with goggle ad sense & ad words to maximum your profit
How to sell your items on line
How to get   visitors and keep them
So you need this free e-book get it for free
I hope you like it I do
http://www.4shared.com/file/43764181/476314f4/webmaster_manual.html


--~--~-~--~~~---~--~~
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 extend django.views.generic.date_based to return more "context variables"?

2008-04-14 Thread fizban



On 14 Apr, 16:54, "Norman Harman" <[EMAIL PROTECTED]> wrote:
> Why don't you use the extra_context parameter to generic views?  Or am I
> misunderstanding what you are trying to do?
>
> def myview(request):
>    context = dict()
>    context["my_custom_var"] = "wwgd"
>    return generic_view(request, extra_context = context, bla=blah,...)

I have just tried setting it up but it is returning a 404 when I try
to load the page (and it obviously works with date_based.object_detail
and/or my custom "entry_detail")

This is the view I tried to setup:

def myview(request, year, month, day, queryset, date_field,
month_format, slug, template_object_name):
context = dict()
context['year'] = year
context['month'] = month
context['day'] = day

return date_based.object_detail(
request, year, month, day, queryset, date_field, month_format, 
slug,
template_object_name, extra_context=context,
)

As far as I understood your suggestion and the docs I found it should
work, shouldn't it?

The urlconf, beside the from ... import statements is the following:


entry_info_dict = {
'queryset': Entry.live.all(),
'date_field': 'pub_date',
}

urlpatterns = patterns('django.views.generic.date_based',
(r'(?P\d{4})/(?P\d{2})/(?P\d{2})/(?P[\w\d\-]
+)/$', myview, dict(entry_info_dict, month_format='%m',
template_object_name='entry')),
)

(I'm using django.views.generic.date_based there since it's needed by
the other patterns, I didn't include them since they are relevant --
however it won't work even if I snip it out)

--~--~-~--~~~---~--~~
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: What happened to django-updates?

2008-04-14 Thread Karen Tracey
On Mon, Apr 14, 2008 at 11:45 AM, James Bennett <[EMAIL PROTECTED]>
wrote:

>
> On Mon, Apr 14, 2008 at 10:43 AM, John-Scott
> <[EMAIL PROTECTED]> wrote:
> >  There hasn't been any updates on the django-updates mailing list since
> >  March 18. At the time, someone on IRC said they thought it was due to
> >  the traffic from the sprint but that was a month ago. I am tracking
> >  trunk with my projects and it was really convenient to get email
> >  updates on trunk commits (with handy gmail filters to trim out all the
> >  non-commit noise). I can accomplish the same thing via
> >
> http://trac.tripology.com/tripology-trac/timeline?changeset=on=50=90=rss
> >  but just wanted to bring it to the attention of whoever is in charge.
>
> "Whoever is in charge" would be the developers who write and maintain
> Google's mailing-list systems. It is not a problem that anyone
> associated with Django can fix.
>

Really?  I just assumed the problem was on the trac side, where the messages
are supposed to be generated, not on the Google group side.  What exactly is
happening?  Has it been posted as a problem on the Google Groups help forum
(I can't find anything that seems relevant there)?  I know reporting
problems to Google is like tossing stuff into a black hole but the Groups
help forum actually seems to have some activity from Google employees.  I'd
be willing to try to raise an issue there but I'd need to have half a clue
what the problem is.

Is it known for sure that trac is sending the mails to the google group
address, and that the origin email ID is allowed to post to the group (did
it get auto-banned for some reason)?  Will the group update if mail is sent
from a different ID (may require authorizing another ID to post to the group
in order to test)?  Can the group owner(s) verify the config looks correct
on the Google side, or are there issues with accessing the group management
pages?

Really, I'd be willing to spend considerable effort getting this resolved,
since I find the group emails much more convenient/effective than the other
avenues that have been mentioned, so if I can help by trying to get a
response from Google on the problem please let me know.  But I will need to
know what exactly the problem is.  Right now based solely on the symptoms an
end user can see, like I said, I would have guessed it was a trac problem.

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



Re: What happened to django-updates?

2008-04-14 Thread John-Scott



On Apr 14, 11:45 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 14, 2008 at 10:43 AM, John-Scott
>
> <[EMAIL PROTECTED]> wrote:
> >  There hasn't been any updates on the django-updates mailing list since
> >  March 18. At the time, someone on IRC said they thought it was due to
> >  the traffic from the sprint but that was a month ago. I am tracking
> >  trunk with my projects and it was really convenient to get email
> >  updates on trunk commits (with handy gmail filters to trim out all the
> >  non-commit noise). I can accomplish the same thing via
> >  http://trac.tripology.com/tripology-trac/timeline?changeset=on=50...
> >  but just wanted to bring it to the attention of whoever is in charge.
>
> "Whoever is in charge" would be the developers who write and maintain
> Google's mailing-list systems. It is not a problem that anyone
> associated with Django can fix.

Pardon my ignorance. I lack a priori knowledge about how the Django
Trac instance has been configured or whatever hook script is set up to
automate sending mail to the list to know that there couldn't possibly
be any problem with this configuration. I thought that the error would
most likely be on that end of things and not on the Google end of
things, since Groups seems to work just fine for all the other lists
(django-users, django-developers, etc.). You know differently, so
thanks for clearing that up.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



working example of django.contrib.localflavor ?

2008-04-14 Thread e

I have a form set up and all working, its basically straight out of
the Form Processing chapter of the django book:

class ContactForm(forms.Form):
email = forms.EmailField(required=True)
message = forms.CharField()
phone_number = forms.CharField()

def contact(request):
form = ContactForm()
return render_to_response('contact.html', {'form': form})

Now this works just fine, but I want to use
django.contrib.localflavor.us.forms.USPhoneNumberFIeld instead of the
CharField for the phone_number.  When I replace it with this line:

phone_number = us.forms.USPhoneNumberField(max_length=100)

I get this error:

ViewDoesNotExist: Tried contact in module mysite.contact.views. Error
was: 'module' object has no attribute 'forms'

What am I doing wrong?
--~--~-~--~~~---~--~~
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: Troubles with localization

2008-04-14 Thread J. Cliff Dyer

Did you recompile your .po files on the server?

On Mon, 2008-04-14 at 17:31 +0200, Boris Ozegovic wrote:
> I recently translated Django on croatian language, it works like a
> charm, but only on my computer?  :)  Today when I deployed application
> to server, hr localization didn't worked.  In settings.py I have 'hr'
> just like I have at my home.  Folder 'hr' is at right place, and, what
> is very important, every other localization works (de, en, you name
> it).  What could be the problem?
> 
> > 


--~--~-~--~~~---~--~~
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: ModelForms: overwriting a field using parameters from the form constructor

2008-04-14 Thread Richard Dahl
You could do something like this:

f  = forms.form_for_model(modelname)
f.base_fields['fieldname'].queryset = (query_based_on_variable)

I automatically do this for a number of forms (to enforce role-based access)
by looping through the base fields:

get_form(model_type, r):
f = forms.form_for_model(model_type)
for y in f.base_fields.iteritems():
if isinstance(y[1], forms.models.ModelChoiceField):
y[1].queryset = (y[1].queryset.model.permissible.all(role=r))
return f

'permissible' is a custom manager
hth
-richard


On 4/14/08, Bram <[EMAIL PROTECTED]> wrote:
>
>
> Hi all,
>
> I'm using a ModelForm with a ModelChoiceField. I need to set the
> queryset of this field using a variable that's passed to the form
> constructor. I couldn't declare the field in the class itself, because
> I don't have access to the variable at the class level. How could I
> fix this?
>
> Bram
> >
>

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



Permissions not working in Admin Interface

2008-04-14 Thread Josh.MIPS

I have recently been working on the admin interface for a django
site.  There is one model under an application that will only show up
if I set a user as a super user.  I can assign them privileges to
create, change and delete these objects but they do not show up and
when I point the browser to the url associated with these objects it
says permission denied.  I have even tried giving them every single
permission without making them a super user and this one field still
does not show up.  Then if I make them a super user it shows up.  Does
anyone have any idea what is going on.  Thanks in advance.
Josh
--~--~-~--~~~---~--~~
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: What happened to django-updates?

2008-04-14 Thread Justin Lilly
I think this has largely been supplanted by empty & brosner's TWiD (This
Week in Django) podcast. They go over all of that stuff along with spiffy
interviews and whatnot. Its very neat stuff.
 -justin

On Mon, Apr 14, 2008 at 11:43 AM, John-Scott <[EMAIL PROTECTED]>
wrote:

>
> There hasn't been any updates on the django-updates mailing list since
> March 18. At the time, someone on IRC said they thought it was due to
> the traffic from the sprint but that was a month ago. I am tracking
> trunk with my projects and it was really convenient to get email
> updates on trunk commits (with handy gmail filters to trim out all the
> non-commit noise). I can accomplish the same thing via
>
> http://trac.tripology.com/tripology-trac/timeline?changeset=on=50=90=rss
> but just wanted to bring it to the attention of whoever is in charge.
> >
>


-- 
Justin Lilly
Web Developer/Designer
http://justinlilly.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: What happened to django-updates?

2008-04-14 Thread James Bennett

On Mon, Apr 14, 2008 at 10:43 AM, John-Scott
<[EMAIL PROTECTED]> wrote:
>  There hasn't been any updates on the django-updates mailing list since
>  March 18. At the time, someone on IRC said they thought it was due to
>  the traffic from the sprint but that was a month ago. I am tracking
>  trunk with my projects and it was really convenient to get email
>  updates on trunk commits (with handy gmail filters to trim out all the
>  non-commit noise). I can accomplish the same thing via
>  
> http://trac.tripology.com/tripology-trac/timeline?changeset=on=50=90=rss
>  but just wanted to bring it to the attention of whoever is in charge.

"Whoever is in charge" would be the developers who write and maintain
Google's mailing-list systems. It is not a problem that anyone
associated with Django can fix.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



What happened to django-updates?

2008-04-14 Thread John-Scott

There hasn't been any updates on the django-updates mailing list since
March 18. At the time, someone on IRC said they thought it was due to
the traffic from the sprint but that was a month ago. I am tracking
trunk with my projects and it was really convenient to get email
updates on trunk commits (with handy gmail filters to trim out all the
non-commit noise). I can accomplish the same thing via
http://trac.tripology.com/tripology-trac/timeline?changeset=on=50=90=rss
but just wanted to bring it to the attention of whoever is in charge.
--~--~-~--~~~---~--~~
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: Fedora Core 4 - Django-dev & Mysql

2008-04-14 Thread martyn

Ok, I'll get the source from SVN, I think I'll have to get setup
tool.
I tried this solution on my computer, I needed "setuptool" because
installer is written in Python.

Thanks.


On 14 avr, 16:52, "Peter Herndon" <[EMAIL PROTECTED]> wrote:
> The immediate solution is to download the source and compile.  A
> better solution, i.e. a prebuilt RPM, might be available from
> somewhere, I haven't searched.
>
> ---Peter
>
> On 4/14/08, martyn <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > I'm using Fedora Core 4 and MySQL as my database for Django.
> > I installed mysql-python from here
> >http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fed...
> > Then I run Django (the dev version - 0.97-pre-SVN-unknown) and it
> > tells me this :
>
> > ""ImproperlyConfigured: MySQLdb-1.2.1p2 or newer is required; you have
> > 1.2.0""
>
> > I can't find any mysql-python-1.2.1 for FedoraCore4.
> > If someone knows the problem, thanks for helping me.
>
> > Martyn
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Troubles with localization

2008-04-14 Thread Boris Ozegovic

I recently translated Django on croatian language, it works like a
charm, but only on my computer?  :)  Today when I deployed application
to server, hr localization didn't worked.  In settings.py I have 'hr'
just like I have at my home.  Folder 'hr' is at right place, and, what
is very important, every other localization works (de, en, you name
it).  What could be the problem?

--~--~-~--~~~---~--~~
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 abstract base class in QS-RF

2008-04-14 Thread Michael Newman

Imagine:

from django.db import models

class Mtmfield(models.Model):
afield = models.TextField()

class Place(models.Model):
somefield = models.ManyToManyField(Mtmfield,
related_name='a_name_that_cant_have_conflicts')

class Meta:
abstract = True

class Restaurant(Place):
someotherfield = models.TextField()

class Bar(Place):
somethirdfield = models.TextField()


Running a manage.py syncdb throws:

Creating table inheritance_mtmfield
Creating table inheritance_bar
Creating table inheritance_restaurant
Traceback (most recent call last):
  File "./manage.py", line 11, in 
execute_manager(settings)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/__init__.py", line 272, in execute_manager
utility.execute()
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/__init__.py", line 219, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/base.py", line 72, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/base.py", line 86, in execute
output = self.handle(*args, **options)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/base.py", line 168, in handle
return self.handle_noargs(**options)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/commands/syncdb.py", line 91, in handle_noargs
cursor.execute(statement)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/db/backends/util.py", line 18, in execute
return self.cursor.execute(sql, params)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/db/backends/sqlite3/base.py", line 136, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: table "inheritance_bar_somefield" already
exists

This only seems to occur when there is a ManyToManyField in the
abstract base class and there are 2 items that extend that base class.
This does not seem to be a problem when the base class is not
abstract. This also occurs in MySQL.

I would like to open a ticket, but wanted to just make sure that I am
implementing the abstract base classes in the way that they were
designed. I would also like to help out with a patch, but can't even
begin to figure out where the issue is coming from.

Thanks,

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



Newbie Question: Is "ordering" a list or a tuple or both / either?

2008-04-14 Thread Kevin Cole

Hi,

I'm following along in the book, and noticed that when "ordering" is
used in the Meta class (Chapter 5, page 77) it is a list.  However,
later, when used in the Admin class (Chapter 6, page 91), it's a
tuple.

Testing it out, it seems to work okay either way, but I wondered if
there was a good reason to have Meta one way and Admin the other.  Is
there a "best practice" here?  (Or was it simply a typo in the book?)

--~--~-~--~~~---~--~~
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 extend django.views.generic.date_based to return more "context variables"?

2008-04-14 Thread Norman Harman

Why don't you use the extra_context parameter to generic views?  Or am I 
misunderstanding what you are trying to do?

def myview(request):
   context = dict()
   context["my_custom_var"] = "wwgd"
   return generic_view(request, extra_context = context, bla=blah,...)

-- 
Norman J. Harman Jr.  512 912-5939
Technology Solutions Group, Austin American-Statesman

___
Get out and about this spring with the Statesman! In print and online,
the Statesman has the area's Best Bets and recreation events.
Pick up your copy today or go to statesman.com 24/7.

--~--~-~--~~~---~--~~
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: Fedora Core 4 - Django-dev & Mysql

2008-04-14 Thread Peter Herndon

The immediate solution is to download the source and compile.  A
better solution, i.e. a prebuilt RPM, might be available from
somewhere, I haven't searched.

---Peter



On 4/14/08, martyn <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm using Fedora Core 4 and MySQL as my database for Django.
> I installed mysql-python from here
> http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/MySQL-python-1.2.0-1.i386.rpm
> Then I run Django (the dev version - 0.97-pre-SVN-unknown) and it
> tells me this :
>
> ""ImproperlyConfigured: MySQLdb-1.2.1p2 or newer is required; you have
> 1.2.0""
>
> I can't find any mysql-python-1.2.1 for FedoraCore4.
> If someone knows the problem, thanks for helping me.
>
> Martyn
> >
>

--~--~-~--~~~---~--~~
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: Fedora Core 4 - Django-dev & Mysql

2008-04-14 Thread Karen Tracey
On Mon, Apr 14, 2008 at 8:06 AM, martyn <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I'm using Fedora Core 4 and MySQL as my database for Django.
> I installed mysql-python from here
>
> http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/MySQL-python-1.2.0-1.i386.rpm
> Then I run Django (the dev version - 0.97-pre-SVN-unknown) and it
> tells me this :
>
> ""ImproperlyConfigured: MySQLdb-1.2.1p2 or newer is required; you have
> 1.2.0""
>
> I can't find any mysql-python-1.2.1 for FedoraCore4.
> If someone knows the problem, thanks for helping me.
>

If there is no prepackaged mysqldb 1.2.1 for the OS you are running, you
have two options:
1 - download and build/install it yourself
2 - specify mysql_old instead of mysql as your database backend.  Note,
thought that there were known problem with the old version that led to
requiring the new one, so you might run into problems with this approach.  I
think the problems were threading-related, so you may or may not hit them
depending on your own setup.

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



Slow template

2008-04-14 Thread Sebastian

Hi all,

Ive been using Django for a while now, and there has been one page in
my application that has been running very slowly no matter what I do.
Im using Django 0.96.1.

The page in question renders approximately 8 tables, each with about
50 rows.
This does not seem like the kind of page that should take 5-7 seconds
to load
(timing from fasterfox).

The view in question uses three raw-sql queries so I am sure there are
no hidden
db performance caveats as they have all been profiled and run in the
millisecond range. I have inserted a few timing lines which yielded
the following:

The following shows the time elapsed between entering the view's
authentication
decorator all the way to just before my template rendering code:

start auth decorator function: 2008-04-14 14:59:18.973822
just before template render  : 2008-04-14 14:59:19.869873

So thats about 1 second.

The next section relates to the template rendering:

source, origin = loader.find_template_source('test.html')
time taken was: 0:00:00.004000

template = loader.get_template_from_string(source, origin,
'test.html')
time taken was: 0:00:00.004001

template.render(context)
time taken was: 0:00:00.248014

Thats only a total of at most 2 seconds! I have no idea where the
other 4-5 seconds could be coming from. The above samples were taken
using the Django runtime server to dispatch my
media files, so I can understand that it is a little slower. However,
in our
production environment (where we us apache (with mod_python) to handle
media files)
the end result is only slightly better.

Can anyone think of other areas that might be taking up time?

Regards,
Sebastian

--~--~-~--~~~---~--~~
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: Django.cgi on Linux Hosting

2008-04-14 Thread Karen Tracey
On Mon, Apr 14, 2008 at 3:41 AM, Aldo <[EMAIL PROTECTED]> wrote:

> Yes, so thats fair enough - it just means that maybe MAYBE the dj
> script is being called - but when i access it via www.gfdfdf.com/admin/
> it gives me a 404
>

(You've switched from http://www.musicischarity.com to
www.gfdfdf.com
?)

So the next step is to figure out if the 404 is coming from Apache or
Django.  Do you have the admin urls configured for your Django app?  If not,
then it's expected you'd get a 404 trying to access that url -- I just used
it as an example of one that might work since I have no idea what your own
application urls are.

Some ways to determine if the 404 is coming from Apache or Django:
1 - appearance -- does it look like the standard Apache "not found" or your
own 404.html template?
2 - turn on DEBUG=True in your settings file and you will see the Django
debug "page not found" page that includes all the urlpatterns and how the
one it was handed didn't match any of them, if you are getting to Django
3 - the Apache error log will have "File not found" errors listed for
something ending in "admin" if it is Apache returning the 404, but not if it
is Django.
4 - How long does it take for the 404 to be returned?  Quick means it's
probably coming from Apache, slow means probably your script is running and
it's your app/Django that is ultimately returning the 404.  (This config is
a VERY slow way of running Django, and I'm not sure you will find
performance acceptable even if/when you get it to work.)

If it is Apache returning the 404 then somehow your rewrite rules are not
kicking in.  What you list below rewrites everything ending in a slash (you
did include the trailing slash on the attempt to access admin?) except for
those that start with cgi-bin or media, plus it rewrites an empty url to a
Django url of 'home/' (so you'd need a urlpattern for 'home/' in your Django
config).

If it is Django returning the 404 than the urlpattern configuration is not
handling the incoming urls as you expect, and you need to fix them.

Karen


> On Apr 11, 4:28 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > On Fri, Apr 11, 2008 at 9:28 AM, Aldo <[EMAIL PROTECTED]> wrote:
> >
> > > Fair point.
> >
> > > My problem is - Initially i created my index.html in the root(DOCUMENT
> > > ROOT).
> > > Now I have downloaded Django as described - put it in my root.
> > > I have created my .htaccess files as
> > > RewriteEngine on
> > > RewriteRule ^cgi-bin/ - [L]
> > > RewriteRule ^media/ - [L]
> > > RewriteRule ^(.*)(/)$ cgi-bin/dj/$1/
> > > RewriteRule ^$ cgi-bin/dj/home/
> > > Ive created the cgi-bin/dj file and gave permissions.
> > > However when i try to access that file(http://www.musicischarity.com/
> > > cgi-bin/dj ) it gives me an
> > > error -  Error 500: Internal Server Error
> >
> > You are not supposed to access the script directly like this.  Rather
> you
> > are supposed to use your application's normal urls (e.g.
> http://www.muicscharity.com/admin/for, say, the Django admin app), and the
> > RewriteRules convert that to an invocation of your dj script.
> >
> >
> >
> >
> >
> > > (Usually I would have content-type in it - but its not in the
> > > examples. tried it and still no good.)
> > > The dj file was edited to contain my own details. paths etc. maybe i
> > > have them wrong.
> > > sys.path.append("/hsphere/local/home/musicisc/Django-0.96")
> > > sys.path.append("/hsphere/local/home/musicisc")
> > > and
> > > # Change this to the directory above your site code.
> > > sys.path.append("/hsphere/local/home/musicisc/Django-0.96/")
> > > os.chdir("/hsphere/local/home/musicisc/Django-0.96/")
> > > # Change mysite to the name of your site package
> > > os.environ['DJANGO_SETTINGS_MODULE'] = 'musicischarity.settings'
> > > run_with_cgi(django.core.handlers.wsgi.WSGIHandler())
> >
> > > I am not sure anyone will be able to help - but my alternative is to
> > > give up - ive been working on this for hours.
> >
> > CGI is not at all a recommended way to run Django (see the discussion
> inhttp://code.djangoproject.com/ticket/2407) but it seems it can be made
> to
> > work after a fashion if it's your only option.
> >
> > Karen
> >
> >
> >
> > > On Apr 11, 1:23 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > > > On Fri, Apr 11, 2008 at 6:48 AM, Aldo <[EMAIL PROTECTED]> wrote:
> >
> > > > > Hi folks I have a linux hosting account with digiweb. I want to
> run my
> > > > > django app on it - but am running into problems.
> >
> > > > >
> http://care.register365.com/index.php?_m=knowledgebase&_a=viewarticle.
> > > ..
> >
> > > > >
> http://seamusc.com/blog/2007/jun/11/how-get-django-working-digiwebie-.
> > > ..
> >
> > > > > I am trying to follow examples such as below but to no avail.
> Could
> > > > > anyone be able to help me out? or give me pointers?
> >
> > > > You provide links to two sites with detailed instructions on how to
> do
> > > what
> > > > you 

Session out of view (error)

2008-04-14 Thread wkn

Hello,

I've got a little question about using sessions outside of a view. I'm
trying to implement a tag that keeps track of a certain variables that
have to be set into a session. Within the tag I don't have access to
the request object. According to the docs the SessionStore provides a
way of accessing session variables outside a view.

However when I try the exact code at
http://www.djangoproject.com/documentation/sessions/#using-sessions-out-of-views
I receive a DoesNotExist (Session matching query does not exist)
exception at this method call: s =
Session.objects.get(pk='2b1189a188b44ad18c35e113ac6ceead')

I'm using the most recent trunk SVN version of Django.

Hopefully someone can enlighten me why this does not work.

Kind Regards,

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



ModelForms: overwriting a field using parameters from the form constructor

2008-04-14 Thread Bram

Hi all,

I'm using a ModelForm with a ModelChoiceField. I need to set the
queryset of this field using a variable that's passed to the form
constructor. I couldn't declare the field in the class itself, because
I don't have access to the variable at the class level. How could I
fix this?

Bram
--~--~-~--~~~---~--~~
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: Feel free to test queryset-refactor branch

2008-04-14 Thread mrts

Big cheers and big thanks!

Has anyone tried merging qs-rf and nf-admin already?

MS
--~--~-~--~~~---~--~~
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: Decoupling the URLconfs Tutorial 3 Problem

2008-04-14 Thread Karen Tracey
On Mon, Apr 14, 2008 at 3:03 AM, garazy <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I am going through the tutorial and have come to Decoupling the
> URLconfs @ http://www.djangoproject.com/documentation/tutorial03/
>
>
> When I decouple the page at http://192.168.0.101:8000/polls/ just
> gives me a "It Worked!" welcome page. I've attached my urls.py configs
>
>
> Thanks for your help,
>
> Gary
>
>
>
>
>
>
> mysite/urls.py
> =-=-=-=-=-=-=-=
>
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns(
>(r'^polls/', include('mysite.polls.urls')),
> )
>
>
You are missing the first argument to patterns() here, which is the view
prefix.  For your case it should be an empty string:

urlpatterns = patterns('',
   (r'^polls/', include('mysite.polls.urls')),
)

Karen


>
>
> mysite/polls/urls.py
> =-=-=-=-=-=-=-=-=-=
>
> 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'),
> )
>
>
>
>
> mysite/polls/views.py
> =-=-=-=-=-=-=-=-=-=-=
>
> from django.shortcuts import render_to_response, get_object_or_404
> from mysite.polls.models import Poll
>
> def index(request):
>latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
>return render_to_response('polls/index.html', {'latest_poll_list':
> latest_poll_list})
>
>
> def detail(request, poll_id):
>p = get_object_or_404(Poll, pk=poll_id)
>return render_to_response('polls/detail.html', {'poll': p})
>
> >
>

--~--~-~--~~~---~--~~
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: Reading an entire template into a string

2008-04-14 Thread Alex Koshelev

Not render, just load.

I think `django.template.loader.find_template_source` can help

On Apr 14, 4:17 pm, Darryl Ross <[EMAIL PROTECTED]> wrote:
> nandu wrote:
> > Dear Folks,
>
> > I wish to read an entire template into a string or at least use a
> > method in django.template that will output the template as a string.
> > Note I am not trying to render the template I am just trying to save
> > it in a string.
>
> > I hope you can help me in this request or at least point me in the
> > right direction.
>
> http://www.google.com.au/search?q=django+render_to_string
>
> --
>
> Darryl Ross
> Director
> AFOYI, "Information Technology Solutions"
> p 08 7127 1831
> m 0400 206 443
> f 08 8425 9607
> e [EMAIL PROTECTED]
>
>  signature.asc
> 1KDownload
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



I cannot beleive it :o Video!

2008-04-14 Thread cooklooks

I cannot beleive it :o Video!
http://videoriporter.hu/vr/fs?content=/vr/player/1320/date/count
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



technomobilequebec.com

2008-04-14 Thread Etienne Robillard


Hi,

Here is a link to technomobilequebec.com, a small computer services
and repair website.

This site is powered by a development snapshot of notmm (revision 674)
and also requires a modified Django tree.

Moreover, it uses FastCGI to communicate with Nginx, which makes
things
quite efficient and speedy, considering the minimal amount of
resources
available.

I hope to post more informations about its development here, as it
might
be helpful to peoples interested in notmm-based apps! :)

Best regards,
Etienne

http://technomobilequebec.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to use dojo toolkit in django?

2008-04-14 Thread bobhaugen

On Mon, 14 Apr 2008 00:13:35 -0700 (PDT)
Duke <[EMAIL PROTECTED]> wrote:
> Where to store the dojo toolkit in the project

You can avoid all of the static files issues with dojo by serving it
from AOL, like so:
http://o.aolcdn.com/dojo/1.1.0/
dojo/dojo.xd.js">

I'm doing it that way, both in development and production. So far, no
hiccups, it's faster than having Django serve it, and does not burden
my host.

--~--~-~--~~~---~--~~
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: Reading an entire template into a string

2008-04-14 Thread Darryl Ross

nandu wrote:

Dear Folks,

I wish to read an entire template into a string or at least use a
method in django.template that will output the template as a string.
Note I am not trying to render the template I am just trying to save
it in a string.

I hope you can help me in this request or at least point me in the
right direction.


http://www.google.com.au/search?q=django+render_to_string


--

Darryl Ross
Director
AFOYI, "Information Technology Solutions"
p 08 7127 1831
m 0400 206 443
f 08 8425 9607
e [EMAIL PROTECTED]




signature.asc
Description: OpenPGP digital signature


Fedora Core 4 - Django-dev & Mysql

2008-04-14 Thread martyn

Hi,

I'm using Fedora Core 4 and MySQL as my database for Django.
I installed mysql-python from here
http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/MySQL-python-1.2.0-1.i386.rpm
Then I run Django (the dev version - 0.97-pre-SVN-unknown) and it
tells me this :

""ImproperlyConfigured: MySQLdb-1.2.1p2 or newer is required; you have
1.2.0""

I can't find any mysql-python-1.2.1 for FedoraCore4.
If someone knows the problem, thanks for helping me.

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



Reading an entire template into a string

2008-04-14 Thread nandu

Dear Folks,

I wish to read an entire template into a string or at least use a
method in django.template that will output the template as a string.
Note I am not trying to render the template I am just trying to save
it in a string.

I hope you can help me in this request or at least point me in the
right direction.

Thank you.

Yours sincerely,
Nandu
14 Apr 08
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



REAL BRUTAL RAPE VIDEOS HERE.SEE IT AND ENJOY. ALL THE GIRLS WERE

2008-04-14 Thread nash . coccer

 REAL BRUTAL RAPE VIDEOS HERE.SEE IT AND ENJOY. ALL THE GIRLS WERE
SCREAM .BUT IT IS SWEAT.THE LINK IS BELOW

http://onlinemillionare.blogspot.com/


ENJOY HOW SWEET IT IS



--~--~-~--~~~---~--~~
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: Application Concepts

2008-04-14 Thread Waldemar Kornewald

On 14 Apr., 13:12, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 14, 2008 at 6:03 AM, Waldemar Kornewald
>
> <[EMAIL PROTECTED]> wrote:
> >  I agree that you can't always reuse those media files, but why does
> >  that mean there shouldn't be an easy (automatic) way to serve media
> >  files?
>
> Because Django should have nothing whatsoever to do with your media
> files. That's a path you just don't want to go down, and the only way
> to avoid it is to force the up-front separation of dynamic and static
> content.

I never said that static media should *always* be served through
Django. For instance, my code only serves it if you execute "manage.py
runserver". That could be documented, so everyone understands that on
the production server they'll have to add Apache/lighttpd media
serving.

Or let me say it this way: With up-front separation, isn't almost
every developer going to add media serving via static.serve, manually?
I mean, if you use runserver on your local machine then you have
almost no alternative. Well, except for running an Apache instance in
the background that serves those media files from the checked-out
repository. But I wouldn't call that a real alternative.

Why should we make it more difficult than necessary to have the
*development* environment (runserver and testserver) set up?

Bye,
Waldemar Kornewald
--~--~-~--~~~---~--~~
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 use dojo toolkit in django?

2008-04-14 Thread Etienne Robillard

On Mon, 14 Apr 2008 00:13:35 -0700 (PDT)
Duke <[EMAIL PROTECTED]> wrote:

> 
> How to use dojo toolkit in django project?
> Where to store the dojo toolkit in the project and how to use them in
> the html page?
> 

http://code.djangoproject.com/wiki/AJAX/Dojo/RefactoredFormSubmit

Feel free to review/extend this example too, as it's for me a good
reference for building UIs specifically with Dojo, Ajax and Django.

Regards,

Etienne


--~--~-~--~~~---~--~~
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: Application Concepts

2008-04-14 Thread James Bennett

On Mon, Apr 14, 2008 at 6:03 AM, Waldemar Kornewald
<[EMAIL PROTECTED]> wrote:
>  I agree that you can't always reuse those media files, but why does
>  that mean there shouldn't be an easy (automatic) way to serve media
>  files?

Because Django should have nothing whatsoever to do with your media
files. That's a path you just don't want to go down, and the only way
to avoid it is to force the up-front separation of dynamic and static
content.

>  There still is the global media folder and quite a few novice
>  users would have an easier time getting started with Django. Even
>  advanced developers could save those few lines of code which repeat in
>  every project, anyway.

If you know of an advanced developed who's serving static media files
through Django, please forward my statement above to him/her.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 overwrite the hyperlink of objects in change list template of django admin?

2008-04-14 Thread Leon

I've tried that method and make my own object list in the customized
change_list.html.
That REALLY duplicate a lot of works. Is it possible to add a hook
function (middleware?) just
before the change_list template being rendered? In that way, I might
be able to modify the
data before it is passed to template.

I had expected there is a magic function in model class to change it. :
(

On Apr 14, 9:23 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2008-04-13 at 06:20 -0700, Leon wrote:
> > Hi,
> >   I use django admin to manage a table. There is a hyperlink for
> > each object in the change_list template, which will bring me to the
> > change_form template. I want to change that hyperlink and redirect it
> > to another url to handle. I didn't want to customize the current
> > change_form for this model because it is still used somewhere else.
> >   Anybody knows how to do it?
>
> It's possible, but fairly fiddly. You can create a custom
> change_list.html template for just that application + model name
> combination (since the admin interface tries to load a template under
> admin///change_list.html as one of the options for
> that page). Then you need to write a template that displays what you
> would like, which possibly means duplicating a lot of the logic of the
> original page and the template tags that construct it. With a bit of
> tracing through the code (admin/templates/admin/change_list.html,
> admin/tempates/admin/change_list_result.html,
> admin/templatetags/admin_list.py, admin/views/main.py) it should be
> quite possible to achieve what you want. Take your time and you'll get
> there (or use newforms-admin or wait for newforms-admin to be merged
> into trunk, both of which will be easier).
>
> Note that this sort of customisation does require you to read some
> Python code and templates and do a bit of design work. There isn't a
> step-by-step guide, so if you aren't up to being able to read the code a
> bit, this probably isn't the right sort of customisation to be trying to
> make.
>
> Regards,
> Malcolm
>
> --
> Tolkien is hobbit-forming.http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
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: Application Concepts

2008-04-14 Thread Waldemar Kornewald

On 14 Apr., 11:45, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Thu, Apr 10, 2008 at 2:49 AM, jurian <[EMAIL PROTECTED]> wrote:
> >  Does anyone else think I should add a ticket request for this as a
> >  future feature?
>
> I'm ambivalent, but leaning toward "no". In my experience, it's very
> rare to have media files that are truly coupled to a single specific
> application; django.contrib.admin is the only example I can think of.
> This is a consequence of the fact that, most of the time, media files
> vary from site to site -- Site A uses this stylesheet and this icon
> set and this JavaScript toolkit, but Site B has its own styles, its
> own icon set and uses a different JS toolkit.

I agree that you can't always reuse those media files, but why does
that mean there shouldn't be an easy (automatic) way to serve media
files? There still is the global media folder and quite a few novice
users would have an easier time getting started with Django. Even
advanced developers could save those few lines of code which repeat in
every project, anyway.

And if we're already at it we can do it correctly and serve the admin
media folder automatically, too. Also, at least in our case, we do
have reusable components which need their own media folder. E.g., we
have a JavaScript text-field autocompletion app. It would even be much
easier to extend Django with JavaScript support by putting the code
into its own app with its own media folder.

Bye,
Waldemar Kornewald
--~--~-~--~~~---~--~~
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 extend django.views.generic.date_based to return more "context variables"?

2008-04-14 Thread fizban

I mean: ok I can use the {% with %} tag, but why do I have to parse
some object's date (one or more time doesn't really matter) if the
view has those variables already set up (gets them from the urlconf)?

I don't know, it doesn't probably matter at all on performance, but
I'm used to avoid any processing unless I *really* have to do some
processing :)
--~--~-~--~~~---~--~~
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 extend django.views.generic.date_based to return more "context variables"?

2008-04-14 Thread fizban

On 14 Apr, 11:48, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 14, 2008 at 4:41 AM, fizban <[EMAIL PROTECTED]> wrote:
> >  In fact by default it only returns "object" (or the
> >  template_object_name name you pass), but I need it to return "year",
> >  "month" and "day" too. This is because in my *_detail.html template
> >  I'd have to keep on formatting object.pubdate over and over again to
> >  achieve a simple "breadcrumbs" and this is obviously boring other than
> >  not DRY at all ;)
>
> If you're just displaying the breadcrumbs once, there's no repetition;
> you'll have to find a way to format each element no matter what, after
> all.

Well, speaking of the breadcrumbs, the year is being accessed 4 times,
month 2 times, day 2 times.
"object.pub_date|date:" was repeated 9 times.. there was a lot of
repetition going on ;)

> If you're displaying them multiple times, you want the {% with %} tag.

Thanks, I really missed that tag!

Anyway, my question still stands.. is there a more elegant way to
extend a generic view to output more variables than it does by default
(see my first message for more details)? Beside this case it would be
handy for some other case too


--~--~-~--~~~---~--~~
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 extend django.views.generic.date_based to return more "context variables"?

2008-04-14 Thread James Bennett

On Mon, Apr 14, 2008 at 4:41 AM, fizban <[EMAIL PROTECTED]> wrote:
>  In fact by default it only returns "object" (or the
>  template_object_name name you pass), but I need it to return "year",
>  "month" and "day" too. This is because in my *_detail.html template
>  I'd have to keep on formatting object.pubdate over and over again to
>  achieve a simple "breadcrumbs" and this is obviously boring other than
>  not DRY at all ;)

If you're just displaying the breadcrumbs once, there's no repetition;
you'll have to find a way to format each element no matter what, after
all.

If you're displaying them multiple times, you want the {% with %} tag.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: Application Concepts

2008-04-14 Thread James Bennett

On Thu, Apr 10, 2008 at 2:49 AM, jurian <[EMAIL PROTECTED]> wrote:
>  Does anyone else think I should add a ticket request for this as a
>  future feature?

I'm ambivalent, but leaning toward "no". In my experience, it's very
rare to have media files that are truly coupled to a single specific
application; django.contrib.admin is the only example I can think of.
This is a consequence of the fact that, most of the time, media files
vary from site to site -- Site A uses this stylesheet and this icon
set and this JavaScript toolkit, but Site B has its own styles, its
own icon set and uses a different JS toolkit.

The same generally goes for templates; it's actually fairly rare,
outside of templates used by inclusion tags, that you can provide
templates to be usable by any site an application is installed on.

So I wouldn't see much utility in adding a new option to support this
sort of case; if you run into a situation where you truly do need to
do this (as with the admin), you can package the media files and tell
people to symlink or copy them.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 extend django.views.generic.date_based to return more "context variables"?

2008-04-14 Thread fizban

Hello,

I'm trying to extend django.views.generic.date_based (specifically
object_detail). The goal is to make it return more context variables
(is that how they are called?) then it is supposed to return.

In fact by default it only returns "object" (or the
template_object_name name you pass), but I need it to return "year",
"month" and "day" too. This is because in my *_detail.html template
I'd have to keep on formatting object.pubdate over and over again to
achieve a simple "breadcrumbs" and this is obviously boring other than
not DRY at all ;)

So: what I did was to get the object_detail code from
django.views.generic.date_based and stick it in my myapp.views and
have urlconf to point at it. myapp.views.object_detail is identical to
the original beside for this portion:

c = RequestContext(request, {
template_object_name: obj,
'year': year,
'month': month,
'day': day,
}, context_processors)

Where I'm passing year, month, day.

However I kinda have the feeling there is a more elegant way to extend
a generic view like this, but I can't seem to find much on the
subject. What I want to do is not to do any special operation (like
formatting the object.date) in order to pass those vars since they are
already in use in the object_detail view, it'd be just a waste.

Can anyone throw me some tip, if any? (I'm ok with sticking to my
slightly modified object_detail view if this can't be done in any
other way)
--~--~-~--~~~---~--~~
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: Application Concepts

2008-04-14 Thread James Bennett

On Fri, Apr 11, 2008 at 1:09 PM, andy baxter
<[EMAIL PROTECTED]> wrote:
>  What /should/ be inside the project folder?

I often get severely flamed for saying this, but:

I very rarely have a "project folder". All it is is a place to stick a
settings file and a root URLConf module, both of which are just plain
old Python files which can live anywhere you can import from. So most
of the time I don't bother creating a folder just to do that; I only
do so when I have groups of configuration files that I want to
organize.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: Application Concepts

2008-04-14 Thread Waldemar Kornewald

On 10 Apr., 09:49, jurian <[EMAIL PROTECTED]> wrote:
> Does anyone else think I should add a ticket request for this as a
> future feature?

Yes, please do. I can even contribute some code if that feature will
make it into django.

The only thing you need to do is specify a MEDIA_URL in your
settings.py (the URL must start with a '/', i.e., point to the same
server) and add an urlpattern (r'', include('media_urls')) somewhere
in your urls.py. The latter could be done automatically if it gets
incorporated into Django, so you'd simply specify a MEDIA_URL and it
would magically work. I hope that's not too much magic for the Django
folks. :)

Bye,
Waldemar Kornewald
--~--~-~--~~~---~--~~
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 use dojo toolkit in django?

2008-04-14 Thread Kenneth Gonsalves


On 14-Apr-08, at 2:02 PM, Kenneth Gonsalves wrote:

>> How to use dojo toolkit in django project?
>> Where to store the dojo toolkit in the project and how to use them in
>> the html page?
>
> http://www.djangoproject.com/documentation/serialization/

sorry - that is for ajax. Use dojo in django precisely as you use  
javascript in a normal html page. Put a block in the head section of  
your base.html where you can load the dojo libraries - either in  
base.html itself or in the required page.

in base.html:

{% block javascripthere %}
{% endblock %}


and in the template:
{% block javascripthere %}

load dojo libraries here
{% endblock %}

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~-~--~~~---~--~~
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 use dojo toolkit in django?

2008-04-14 Thread James Bennett

On Mon, Apr 14, 2008 at 2:13 AM, Duke <[EMAIL PROTECTED]> wrote:
>  Where to store the dojo toolkit in the project

The same place you put all other CSS stylesheets, JavaScript, images
and other static files. Similarly, they will be served the same way.
There is specific documentation on how to handle the serving of static
files, and you probably want to start by reading that.

> and how to use them in
>  the html page?

The same way you use any other JavaScript in any other web page you
have ever built.



-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 use dojo toolkit in django?

2008-04-14 Thread Kenneth Gonsalves


On 14-Apr-08, at 12:43 PM, Duke wrote:

> How to use dojo toolkit in django project?
> Where to store the dojo toolkit in the project and how to use them in
> the html page?

http://www.djangoproject.com/documentation/serialization/

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~-~--~~~---~--~~
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: TemplateSyntaxError when moving from 0.96.1 to SVN

2008-04-14 Thread Gonzalo Delgado
El Sun, 13 Apr 2008 19:42:19 -0300
"Ramiro Morales" <[EMAIL PROTECTED]> escribió:

> 
> On Sun, Apr 13, 2008 at 7:36 PM, Gonzalo Delgado
> <[EMAIL PROTECTED]> wrote:
> > Hi there, I'm trying to move my django projects to  0.97-pre (trunk). The 
> > first error I get is this one (when trying to load the admin interface in a 
> > small project):
> >
> >  TemplateSyntaxError at /admin
> >  Template u'admin/base_site.html' cannot be extended, because it doesn't 
> > exist
> 
> Are you extending the admin app UI?.

Not at all. "cannot be extended" refers to the first line of the template being 
loaded: {% extends "admin/base_site.html" %}. For some reason Django can't find 
admin/base_site.html. The same happens to every template which inherits from 
other template.

> >
> >  Is there a guide for this kind of migration?
> 
> Yes, take a look at
> 
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
> 

I couldn't find anything resembling to my problem there :(

> Regards,
> 
> -- 
>  Ramiro Morales
> 


-- 
Gonzalo Delgado <[EMAIL PROTECTED]>


pgpwqHtkBgQ6Q.pgp
Description: PGP signature


Re: sudo: port: command not found

2008-04-14 Thread Horst Gutmann

Uhmm and this has what exactly to do with Django? ;-)

But in general, just add this to your ~/.profile (just create it if
you don't have it)

export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/man:$MANPATH
export LD_LIBRARY_PATH=/opt/local/lib:$LD_LIBRARY_PATH

(among other things if you also want to compile against headers there etc.)

- Horst

On Mon, Apr 14, 2008 at 9:49 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I just installed MacPorts as instructed with X11 and XCode 3.0 on OSX
>  version 10.5.2 MacBook and I'm not finding the usual .bash_profile
>  or .profile and therefore get this error.
>
>  Thanks for any help,
>
>  Jason
>  >
>

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



sudo: port: command not found

2008-04-14 Thread [EMAIL PROTECTED]

I just installed MacPorts as instructed with X11 and XCode 3.0 on OSX
version 10.5.2 MacBook and I'm not finding the usual .bash_profile
or .profile and therefore get this error.

Thanks for any help,

Jason
--~--~-~--~~~---~--~~
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: Django.cgi on Linux Hosting

2008-04-14 Thread Aldo

Yes, so thats fair enough - it just means that maybe MAYBE the dj
script is being called - but when i access it via www.gfdfdf.com/admin/
it gives me a 404

On Apr 11, 4:28 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Fri, Apr 11, 2008 at 9:28 AM, Aldo <[EMAIL PROTECTED]> wrote:
>
> > Fair point.
>
> > My problem is - Initially i created my index.html in the root(DOCUMENT
> > ROOT).
> > Now I have downloaded Django as described - put it in my root.
> > I have created my .htaccess files as
> > RewriteEngine on
> > RewriteRule ^cgi-bin/ - [L]
> > RewriteRule ^media/ - [L]
> > RewriteRule ^(.*)(/)$ cgi-bin/dj/$1/
> > RewriteRule ^$ cgi-bin/dj/home/
> > Ive created the cgi-bin/dj file and gave permissions.
> > However when i try to access that file(http://www.musicischarity.com/
> > cgi-bin/dj ) it gives me an
> > error -  Error 500: Internal Server Error
>
> You are not supposed to access the script directly like this.  Rather you
> are supposed to use your application's normal urls 
> (e.g.http://www.muicscharity.com/admin/for, say, the Django admin app), and 
> the
> RewriteRules convert that to an invocation of your dj script.
>
>
>
>
>
> > (Usually I would have content-type in it - but its not in the
> > examples. tried it and still no good.)
> > The dj file was edited to contain my own details. paths etc. maybe i
> > have them wrong.
> > sys.path.append("/hsphere/local/home/musicisc/Django-0.96")
> > sys.path.append("/hsphere/local/home/musicisc")
> > and
> > # Change this to the directory above your site code.
> > sys.path.append("/hsphere/local/home/musicisc/Django-0.96/")
> > os.chdir("/hsphere/local/home/musicisc/Django-0.96/")
> > # Change mysite to the name of your site package
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'musicischarity.settings'
> > run_with_cgi(django.core.handlers.wsgi.WSGIHandler())
>
> > I am not sure anyone will be able to help - but my alternative is to
> > give up - ive been working on this for hours.
>
> CGI is not at all a recommended way to run Django (see the discussion 
> inhttp://code.djangoproject.com/ticket/2407) but it seems it can be made to
> work after a fashion if it's your only option.
>
> Karen
>
>
>
> > On Apr 11, 1:23 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > > On Fri, Apr 11, 2008 at 6:48 AM, Aldo <[EMAIL PROTECTED]> wrote:
>
> > > > Hi folks I have a linux hosting account with digiweb. I want to run my
> > > > django app on it - but am running into problems.
>
> > > >http://care.register365.com/index.php?_m=knowledgebase&_a=viewarticle.
> > ..
>
> > > >http://seamusc.com/blog/2007/jun/11/how-get-django-working-digiwebie-.
> > ..
>
> > > > I am trying to follow examples such as below but to no avail. Could
> > > > anyone be able to help me out? or give me pointers?
>
> > > You provide links to two sites with detailed instructions on how to do
> > what
> > > you are interested in, but no details on what trouble you have run into
> > > trying to follow those instructions.  It's rather hard to provide any
> > > guidance with no clues as to what isn't working.
>
> > > 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
-~--~~~~--~~--~--~---



How to use dojo toolkit in django?

2008-04-14 Thread Duke

How to use dojo toolkit in django project?
Where to store the dojo toolkit in the project and how to use them in
the html page?

--~--~-~--~~~---~--~~
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 the URLconfs Tutorial 3 Problem

2008-04-14 Thread garazy

Hi,

I am going through the tutorial and have come to Decoupling the
URLconfs @ http://www.djangoproject.com/documentation/tutorial03/


When I decouple the page at http://192.168.0.101:8000/polls/ just
gives me a "It Worked!" welcome page. I've attached my urls.py configs


Thanks for your help,

Gary






mysite/urls.py
=-=-=-=-=-=-=-=

from django.conf.urls.defaults import *

urlpatterns = patterns(
(r'^polls/', include('mysite.polls.urls')),
)




mysite/polls/urls.py
=-=-=-=-=-=-=-=-=-=

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'),
)




mysite/polls/views.py
=-=-=-=-=-=-=-=-=-=-=

from django.shortcuts import render_to_response, get_object_or_404
from mysite.polls.models import Poll

def index(request):
latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
return render_to_response('polls/index.html', {'latest_poll_list':
latest_poll_list})


def detail(request, poll_id):
p = get_object_or_404(Poll, pk=poll_id)
return render_to_response('polls/detail.html', {'poll': p})

--~--~-~--~~~---~--~~
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: __unicode__(self):

2008-04-14 Thread 1234
add"self"

2008/4/14, Malcolm Tredinnick <[EMAIL PROTECTED]>:
>
>
>
> On Sun, 2008-04-13 at 22:04 -0700, Brandon Taylor wrote:
> > Hello everyone,
> >
> > I'm pretty new to Django, so please bear with me.
> >
> > When I'm defining a model, and I want to return a value to use in the
> > admin for the information to be displayed as such:
> >
> > from django.db import models
> >
> > class Link(models.Model):
> > name = models.CharField()
> > url = models.CharField()
> > position = models.PositiveSmallIntegerField()
> >
> > def __unicode__(self):
> > return name
>
>
> That will give you a NameError, since "name" does not exist. You want to
> do "return self.name" there.
>
>
> > Is it possible to concatenate fields for the def__unicode__(self)
> > method? I can't seem to find a way to do that, and was just wondering
> > if it's possible?
>
>
> A __unicode__ method must return a unicode string. That's all. How you
> construct that string is entirely up to you. If you want to construct it
> by putting various attribute values together, that's fine. It's just
> Python. So, for example,
>
> return u"%s %s" % (self.name, self.url)
>
> would return a concatenation of the name and url attributes. Season to
> taste.
>
> Regards,
> Malcolm
>
>
> --
> Honk if you love peace and quiet.
> http://www.pointy-stick.com/blog/
>
>
>
> >
>

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