Re: Use one project for a blog, forums, and custom application?

2009-10-16 Thread Robert Adams

Thanks for the reply.

I realize it would be substantially easier to use mysite.com/blog type
urls, but I would still prefer use the blog.mysite.com since that is
often the convention.

You bring up a good point about the authentication though. I had not
thought of that. While it would be preferable to have them stay logged
in across the apps, this is not terrible. Also though, I am not an
expert on cookies, but can't you set cookies that were valid for a
domain and all it's subdomains?

I'm not sure if the cookies created by Django by default are set to
work this way, but maybe there is some way to tweak Django in this
respect. Also, I could be wrong about the whole thing.

Again, thanks for your reply. Unfortunately, I'm still trying to
figure this out. Does anyone else have any suggestions?

Thanks

On Oct 16, 7:32 pm, Kevin Teague  wrote:
> This isn't Django-specific, but to simplify things, you may want to go
> for:
>
> mysite.com/blog
> mysite.com/forums
> mysite.com/custom
>
> Since browsers send authentication based on the domain, if you use
> different sub-domains for each app in a web site, it will be necessary
> to login (albiet using the same credentials) for each application.
>
> And then give that structure, you'd have one Django project with
> multiple installed applications.
>
> Also, speaking from experience, when managing a site with multiple
> applications, if you can push the authentication part into it's own
> thing (e.g. a standalone WSGI middleware and app), that can be
> desirable, since you would be able to use the same credentials then if
> one of your apps was a non-Django app. Although I don't have any
> advice on what set-up to use to accomplish this ... it's still just
> something on my own to-do list - to be able to login to a Plone app,
> Django admin app, Grok app, JIRA, etc. all using the same set of
> credentials. My user's complain "w! we don't like logging in
> repeatedly!" (they do all use the same accounts for these apps, but
> they have to login separately for each one).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Use one project for a blog, forums, and custom application?

2009-10-16 Thread Kevin Teague

This isn't Django-specific, but to simplify things, you may want to go
for:

mysite.com/blog
mysite.com/forums
mysite.com/custom

Since browsers send authentication based on the domain, if you use
different sub-domains for each app in a web site, it will be necessary
to login (albiet using the same credentials) for each application.

And then give that structure, you'd have one Django project with
multiple installed applications.

Also, speaking from experience, when managing a site with multiple
applications, if you can push the authentication part into it's own
thing (e.g. a standalone WSGI middleware and app), that can be
desirable, since you would be able to use the same credentials then if
one of your apps was a non-Django app. Although I don't have any
advice on what set-up to use to accomplish this ... it's still just
something on my own to-do list - to be able to login to a Plone app,
Django admin app, Grok app, JIRA, etc. all using the same set of
credentials. My user's complain "w! we don't like logging in
repeatedly!" (they do all use the same accounts for these apps, but
they have to login separately for each one).



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Question about template

2009-10-16 Thread David

Thanks Michael for your reply.

What I need is to present money values to end users online. If the
values are less than zero, then I need to put "-$" before them.
Otherwise I just put "$" there.

I will read your link and write a filter to do this.

Thanks again.



On Oct 16, 4:53 pm, "Michael P. Jung"  wrote:
> > I would like to use if clause to check if a number is nagative or not
> > with template in my html file. I read related part in Django template
> > online document however I did not find what I need.
>
> > Is it possilbe to do this with built-in Django filter functions? Or do
> > I have to install a third-party template library?
>
> You could either use the 'smarter {% if %} tag', which might be added to
> Django 1.2 according to the "Features under consideration" list in the
> Wiki. Grab it fromhttp://www.djangosnippets.org/snippets/1350/
>
> Or write a custom template filter. Since writing filters is so straight
> forward and simple I recommend you to look into the 
> docs:http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writ...
>
> There is no built-in filter for this in Django as it's a vital sign that
> you're mixing template logic with view logic. I recommend you to ask
> yourself the following question: "Does my template really have to figure
> out x < y itself or shouldn't it just get this information from the view?".
>
> If it's a common thing you might be better of writing a filter or
> template tag specific to your use case.
>
> I know it's hard to resist the urge "but I just want...". I can tell
> from experience that investing that extra bit of time to do things the
> right way pays off in the long run. Especially as you can later reuse
> the code more easily.
>
> Sometimes even simple stuff like {% ifequals foo 0 %} would fit better
> into a custom filter. Just think of floating point values that are
> almost zero. It's {% if foo|abs < 0.001 %} vs {% if foo|is_near_zero %}.
> The latter provides you with the possibility to configure the threshold
> in the config file while the former has the logic hardcoded in the template.
>
> --mp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: create Index: non-unique, multiple column

2009-10-16 Thread Michael P. Jung

> Given the following model, I want to index the fields (sequence,stock)

There is a ticket for it, but it hasn't made it into Django, yet.

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

> create index ndx_1 on model_quotemodel(sequence,stock);
> Is there any "cleaner" way of doing it?

If you ask me, it's the cleanest way of doing it at the moment.


--mp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Question about template

2009-10-16 Thread Michael P. Jung

> I would like to use if clause to check if a number is nagative or not
> with template in my html file. I read related part in Django template
> online document however I did not find what I need.
>
> Is it possilbe to do this with built-in Django filter functions? Or do
> I have to install a third-party template library?

You could either use the 'smarter {% if %} tag', which might be added to
Django 1.2 according to the "Features under consideration" list in the
Wiki. Grab it from http://www.djangosnippets.org/snippets/1350/

Or write a custom template filter. Since writing filters is so straight
forward and simple I recommend you to look into the docs:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-filters


There is no built-in filter for this in Django as it's a vital sign that
you're mixing template logic with view logic. I recommend you to ask
yourself the following question: "Does my template really have to figure
out x < y itself or shouldn't it just get this information from the view?".


If it's a common thing you might be better of writing a filter or
template tag specific to your use case.

I know it's hard to resist the urge "but I just want...". I can tell
from experience that investing that extra bit of time to do things the
right way pays off in the long run. Especially as you can later reuse
the code more easily.

Sometimes even simple stuff like {% ifequals foo 0 %} would fit better
into a custom filter. Just think of floating point values that are
almost zero. It's {% if foo|abs < 0.001 %} vs {% if foo|is_near_zero %}.
The latter provides you with the possibility to configure the threshold
in the config file while the former has the logic hardcoded in the template.


--mp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Use one project for a blog, forums, and custom application?

2009-10-16 Thread Robert Adams

Howdy

Im still fairly new to Django, so please explain things with that in
mind.

I'm trying to create three websites using 2 subdomains and 1 domain:
for the blog, blog.mysite.com
for the forums, forums.mysite.com
for the custom web app, mysite.com

When building the custom web app, I used contrib.auth to make use of
the built-in django provided user models and functionality.

For the forums, I am planning on using SNAPboard (http://
code.google.com/p/snapboard/) with minimal, if any, modifications. On
initial inspection, it looks like it also uses contrib.auth users.

For the blog, I will probably be rolling my own lightweight blogging
app (since that seems to be the Django way and, also, b/c as Bennet
mentions, there is no killer Django Blog app)

Currently, I am considering two features that require some integration
between the three sites. First, I want to have the users of the custom
web app to use the same account to also log into the forums. Second, I
also (but I haven't figured out how I'm going to do this yet) would
like my blog posts to automatically become a topic for discussion in
the forums (this is just an idea I had, I might end up dropping it).

Ok, so to my questions:

1) Again, I'm new to Django, but this integration leads me to believe
the three websites need to be all under one project. Is this correct?

2) How would I accomplish the url structure for the websites that I
described above (blog.mysite.com, etc)? In the project's urls.py, I
don't know how to filter off of subdomains. If it was mysite.com/
forums/, that would be easy, but I don't know how to to catch
forums.mysite.com and forward it to the appropriate Django app.

3) Would I have to make use of the django.contrib.sites framework? I
don't understand that framework fully, but it seems like it's used
when two different websites are using the same django app in the
background. Whereas my three websites are all using different django
apps, but I want them to share a little bit of data.

Thanks for your 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



create Index: non-unique, multiple column

2009-10-16 Thread jneto

Given the following model, I want to index the fields (sequence,stock)

class QuoteModel(models.Model):
quotedate =  models.DateField()
high = models.FloatField() #(9,2) DEFAULT NULL,
low  = models.FloatField() #(9,2) DEFAULT NULL,
close  = models.FloatField() #(9,2) DEFAULT NULL,
closeadj  = models.FloatField() #(9,2) DEFAULT NULL,
volume  = models.IntegerField() #(9,2) DEFAULT NULL,
stock  = models.IntegerField(db_index=True) #(9,2) DEFAULT NULL,
open  = models.FloatField() #(9,2) DEFAULT NULL,
sequence = models.IntegerField() #(9,2) DEFAULT NULL,
This index should be non-unique - in mysql it should be something
like:

create index ndx_1 on model_quotemodel(sequence,stock);
The only Django workaround I know of is creating an "sql" file that
will be executed by django upon table creation. So, I created a
"stockmodel.sql" containing the following query (same as above:)

create index ndx_1 on model_quotemodel(sequence,stock);
Is there any "cleaner" way of doing it?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ViewDoesNotExist at /

2009-10-16 Thread Bayuadji

Hi,

I would check by running a shell and impor ssl_test.views.
if its work correctly, perhaps there's some import circular dependency though.

-djibon-

On 10/16/09, neri...@gmail.com  wrote:
>
> I'm not sure why I'm getting this error when the module and view are
> right where they should be.
>
> Traceback:
> File "/usr/lib/python2.6/dist-packages/django/core/handlers/base.py"
> in get_response
>   83. request.path_info)
> File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
> resolve
>   218. sub_match = pattern.resolve(new_path)
> File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
> resolve
>   125. return self.callback, args, kwargs
> File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
> _get_callback
>   134. raise ViewDoesNotExist, "Could not import %s. Error
> was: %s" % (mod_name, str(e))
>
> Exception Type: ViewDoesNotExist at /
> Exception Value: Could not import ssl_test.views. Error was: No module
> named ssl_test.views
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SVG and Django

2009-10-16 Thread Bayuadji

Perhaps also should set some response headers to svg type?

On 10/16/09, Javier Guerra  wrote:
>
> On Fri, Oct 16, 2009 at 2:35 PM, claytonbonelli  wrote:
>> The image file is displayed on
>> my html page, but the SVG file dont.
>
> maybe some mime-type configuration missing?
>
>
> --
> Javier
>
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Question about template

2009-10-16 Thread David

Hello,

I would like to use if clause to check if a number is nagative or not
with template in my html file. I read related part in Django template
online document however I did not find what I need.

Is it possilbe to do this with built-in Django filter functions? Or do
I have to install a third-party template library?

Any suggestions?

Thanks so much.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid sytax when naming url

2009-10-16 Thread David

Ah great thanks!

On Oct 15, 10:33 pm, Adam Olsen  wrote:
> On Thu, Oct 15, 2009 at 10:14 PM, David  wrote:
>
> > I can't figure out why this is invalid syntax...
>
> You can't pass a keyword argument to a tuple.  It should read:
>
> url(r'^$', object_list, list_args, name='list'),
>
> --
> Adam Olsen
> SendOutCards.comhttp://www.vimtips.orghttp://last.fm/user/synic
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: UML and OCL

2009-10-16 Thread jcabot

I guess it would be a good idea to at least provide the link to the
transformation service I mentioned in the last email :-D

http://modeling-languages.com/content/xmi2-tool-exchanging-uml-models-among-case-tools:


Jordi

--
Software modeling languages portal: http://modeling-languages.com
Software modeling blog: http://modeling-languages.com/blog
Personal Home page: http://jordicabot.com



On 16 oct, 08:46, Goffer Looney  wrote:
> Hi,
>
> You might be interested in this tool called UML to Django:
>
> http://code.google.com/p/uml-to-django/
>
> It is a python script which automatically converts a UML class diagram
> into Django models (and admins). It currently works with Argo UML
> diagrams but could, in theory, be easily extended to support other UML
> authoring applications.
>
> It has been successfully used with small size projects.
>
> Best,
>
> Goffer
>
> On Oct 2, 3:50 pm, Geobase Isoscale  wrote:
>
> > Thanks Maggie for your quick, response you keep me going. I hope to find one
> > these tools that translate UML into Models. Thanks very much.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: UML and OCL

2009-10-16 Thread jcabot


> ). It currently works with Argo UML
> diagrams but could, in theory, be easily extended to support other UML
> authoring applications.

Or you could use my free XMI transformation service to export models
created with other UML tools to ArgoUML. Btw, I've been using WebML,
UML/OCL for a long time so I'd be interested in knowing your opinion
about using UML/WebML models as a previous step to the implementation
of your application with Django
>
> It has been successfully used with small size projects.
>
> Best,
>
> Goffer
>
> On Oct 2, 3:50 pm, Geobase Isoscale  wrote:
>
> > Thanks Maggie for your quick, response you keep me going. I hope to find one
> > these tools that translate UML into Models. Thanks very much.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django SAAS projects

2009-10-16 Thread Savy



Hi Djangonauts,

I am developing  a Django project (with a few pluggable apps).

I want to offer this project as a SaaS (something like 37signals.com).

i.e: customer1.product1.com , customer2.product2.com etc

product1 could be the basecamp product2 could be highrise and so on.

I want to know how the project should be structured for these
products.

Should there be a single project under which all products will be an
application.  OR  Should I be making different projects for
all the products.

Also interms of database.. should all the products look into a single
database or we should have seperate databases for each product.

I am looking out for the most efficient and scalable way to do this.

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SVG and Django

2009-10-16 Thread Javier Guerra

On Fri, Oct 16, 2009 at 2:35 PM, claytonbonelli  wrote:
> The image file is displayed on
> my html page, but the SVG file dont.

maybe some mime-type configuration missing?


-- 
Javier

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ViewDoesNotExist at /

2009-10-16 Thread neri...@gmail.com

I'm not sure why I'm getting this error when the module and view are
right where they should be.

Traceback:
File "/usr/lib/python2.6/dist-packages/django/core/handlers/base.py"
in get_response
  83. request.path_info)
File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
resolve
  218. sub_match = pattern.resolve(new_path)
File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
resolve
  125. return self.callback, args, kwargs
File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
_get_callback
  134. raise ViewDoesNotExist, "Could not import %s. Error
was: %s" % (mod_name, str(e))

Exception Type: ViewDoesNotExist at /
Exception Value: Could not import ssl_test.views. Error was: No module
named ssl_test.views
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Navigation without lose data

2009-10-16 Thread gustavo

Hi,

I have a image gallery and I am trying to make a fixed menu with the
gallerie's names, so I can click each name and see the thumbs on the
left below positon from the menu, and then click each thumb to see the
real picture on the right below position from the menu.

But when I click on a gallery link I got my page showing the thumbs,
but the menu is gone. Same when I click on a thumb, I got the image
but the thumbs are gone.

How can I navigate through the galleries, thumbs and images without
loose the data??

Thanks a lot!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Best way to generate a local file from a models + views ?

2009-10-16 Thread Nicolas Steinmetz

Hello,

I'm building a django app to manage the reverse proxies of my firm. I'm 
at the step where I want to generate configuration files for apache and 
then send it from the server that host the django app to the reverse 
proxies.

I built a view base on a generic view (object_detail) with some extra 
code. With a mimetype set to plain/text it generates the right 
configuration file as a view.

I read the doc regarding outputin csv/pdf file but they are proposed for 
download and not generated on the server itself.

I tried to play with render_to_string() (based on [1]) within a view but 
with no success so far. File is created but remains empty. You can see 
the code here [2] and the working view is here [3]

If someone already did something similar to what I need, I'll be glad to 
see some running code :)

Cheers,
Nicolas

[1] http://www.djangosnippets.org/snippets/689/
[2] http://friendpaste.com/9emHQNyTWuLt10S8jlqhY
[3] http://friendpaste.com/4Z2bikQnCVXQ1EKh1Puq9B


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Trouble on Apache: unable to open database file

2009-10-16 Thread John D Giotta

I'm running django with mod_python/Apache and its my first time
setting up a server. Among the problems, when I navigate to the
address I receive an OperationalError "unable to open database file."

I can't help but think my vhosts.conf is done 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Good News !! A mate found for your dog ...

2009-10-16 Thread Gerard

Ik think it's .. My dog ate the website :)

?? ? wrote:
> It's the dog. The dog is the one who uses Django. All the time.
> 
> On Fri, Oct 16, 2009 at 9:18 PM, jc  > wrote:
> 
> 
> Finally.  I wonder if their site uses django?
> 
> On Fri, Oct 16, 2009 at 7:36 AM, turk970  > wrote:
>  >
>  > You love your dog and your dog love’s you!
>  >
>  >
>  > Give your dog the opportunity to find a soul mate, enjoy life to the
>  > full and who knows maybe end up with little puppies.
> HavlaTavla.Com is
>  > the new dog mating portal that can help you live your dogs dreams.
>  > Havlatavla lists all types of dogs, breeds and owners together in one
>  > easy to search site that allows you the opportunity to find a
> mate for
>  > your dog and who knows perhaps a mate for yourself. Membership is
> free
>  > and simple. You can search by filtering city, neighbourhood, race and
>  > dog breeds to allow you to find the perfect match for your dog.
>  >
>  > Enjoy looking at pictures of thousands of partner candidates and read
>  > their pickup massages. Help your dog to find its love by becoming our
>  > member so we can match the best bride/groom for your dog as soon as
>  > possible.
>  > http://www.havlatavla.com
>  >
>  >
>  >
>  >
>  > >
>  >
> 
> 
> 
> 
> 
> -- 
> regards,
> Mihail
> 
> 
> > 


-- 
self.url = www.gerardjp.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Should (or can) you have many to many relationship with abstract base class

2009-10-16 Thread Kurt Neufeld


You're mixing two metaphors and will run into troubles, just accept  
that relational databases are not an inherited object model.

But to answer your question consider the following:

table PetType:
   int id
   string name
   int number_of_legs

table Pet
   int id
   int type_id // foreign key of PetType

is roughly equivalent to:

class Pet {

   virtual int NumLegs() = 0;

protected:
   int id;
   int number_of_legs;
}

class Bird : public Pet {
   int NumLegs() { return 2; }
}

class Lizard : public Pet {
   int NumLegs() { return 4; }
}

select id from pet, pettype where pet.type_id = pettype.id and  
pettype.num_of_legs = 4;

When you have a table with a foreign key then that table is kinda like  
an abstract base type. Now just put a table in between pettype and pet  
for your many-to-many but the principle is the same.

Kurt




On 2009-10-16, at 12:17 PM, Chip Grandits wrote:

>
> I am fairly new to Django.  I have a strong background in object
> oriented design, but only a shallow familiarity with relational
> database design.  I am trying to develop my models and I have a sort
> of general philosophical question about what the ORM is capable of,
> and how it should be used.
>
> So lets say, for example you are designing a website for a network of
> people who take care of pets.  The caretaker would have a many-to-many
> relationship with pets, since one caretaker could take of more than
> one pet, and one pet might very well have more than one caretaker.  Of
> course pet is an abstract class - and we can easily imagine many
> concrete derived classes such as dog, cat, fish, snake, ferret, etc.
> These derived classes have much in common but seem to have enough
> distinction that they each have some attributes that makes it seem bad
> design to "munge" them all into a general concrete pet class.
>
> I am not clear if the the philosophy of the Django models is meant to
> allow a model to have a many-to-many relationship with an abstract
> base class.  To help me understand, I read several time in books and
> online docs about how an explicit 'through' table works as the
> intermediary for a many to many relationship.  But I cannot get my
> head around how this would actually work for an abstract base class in
> the relational database.  It seems that the intermediate table might
> have a column (or multiple columns) with primary keys, but it would be
> the primary keys of different tables for the different base classes.
> To use my example, a table representing a "Caretaking Relation", would
> have a column with a primary key to the Caretaker table, and another
> column (or multiple columns) with primary keys to the various tables
> that are the subclasses of pet, i.e. the dog table, the cat table, the
> snake table, the fish table, etc.  And I guess I am not comfortable
> that this idea really works.  Will the manager classes "get confused"
> about which table the foreign keys refer to?  I guess I'm worried that
> it might actually produce code that runs without producing errors, but
> leads me into a morass of problems down the road.
>
> So perhaps there is a good link someone can point me to?  Or perhaps
> just a reassurance that this is an effective technique?  Or a warning
> that it depends upon the particular database engine?  Or advice on
> some coding and design that needs to be done to avoid problems (e.g.
> Maybe I have to somehow make sure that the primary keys for the
> derived class tables are unique among all the derived class tables)?
> Or perhaps just a statement that such a design does not map well from
> object oriented code to relational databases and I should use a
> different design strategy?
>
> 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SVG and Django

2009-10-16 Thread claytonbonelli

Thanks,

The SVG file AND the image files are on the same location (production
server), and that location works fine. The image file is displayed on
my html page, but the SVG file dont.

On Oct 16, 9:35 am, Tim Chase  wrote:
> > 
> >    
> >    
> >       
> >       >            type="image/svg+xml"
> >            pluginspage="http://www.adobe.com/svg/viewer/install/;
> >      />
> >       
> >    
> > 
>
> > This file works fine when I opened it with firefox, but dont work if
> > the file is served by django server. The SVG image (radial2.svg) is
> > not displayed.
>
> Is this the production server or the dev server?  Assuming the
> SVG file is just more static media, so you'll want to read up on
> that.  If it's the production server, make sure that you have it
> serving the static media instead of handing it off to Django.  If
> it's the development server, make sure that you're serving static
> files.  I usually do this with something like
>
> if 'runserver' in argv:
>      urlpatterns += patterns('',
>          (r'^site_media/(?P.*)$',
>              'django.views.static.serve',
>              {'document_root': '../media'}
>              ),
>          )
>
> in my urls.py so that when I use the dev server, it also handles
> static media.
>
> If the SVG is dynamically created (yay, SVG!), make sure your
> urls.py can find it and that you point to an appropriate view.
>
> -tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Design decision

2009-10-16 Thread Chip Grandits

I'm not sure if there is an exact technical defintion of the term
'bind' here. I am assuming you will need the two applications to
share a common database? And I am assuming that other application has
already been developed and
deployed and so you are inclined to work around it?

So this becomes more of a database question, and might be
particular to the particular database engine in use.  I hope it is
clear that you do NOT have to use a database that is created
with the manage.py syncdb command; although you must have
a database that is compatible with one that is created by that
command - but it can be a 'superset' of that database.

My guess is that you might need to know a little bit about the
command line interface of the database engine (I doubt you
need to be a "power user")  And then brush up on the
manage.py database subcommands (dumpdata, inspectdb,
and various sql*) and that will help clarify a solution path.

-Chip
On Oct 16, 10:10 am, Léon Dignòn  wrote:
> I have a project. Within that project I have the app callerlist.
> Callerlist is a list of either inbound or outbound phone calls. To
> each phone call the following information should be written down: own
> name, name of the caller, subject, message and time. This app has to
> be coherent.
>
> Now, for example, I want to bind the above app to an crm system or
> another application with customer data. I am not sure which is the
> best way to provide that interface. Should I provide an additional
> field as a foreign key to the customer table? The table could be
> defined via a variable in the settings.py.
>
> Or are there better solutions?
>
> ld
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Template code runs in both branches of an if statement

2009-10-16 Thread Chip Grandits

Pete,
I'm not completely familiar with you problem or what exactly
'get_latest' does.
But my intuition is that you may wish to consider rewriting
'get_latest' to be more "lazy"
If it is not exactly clear what I mean by that see Django online docs
on lazy querysets
e.g. http://docs.djangoproject.com/en/dev/topics/db/queries/#querysets-are-lazy

I became a big fan of laziness when I learned Haskell last year.
IMHO laziness is usually a good design consideration.

Of course this advice might not really apply to your problem - it's
just a suggestion

-Chip

On Oct 16, 8:49 am, "pjrhar...@gmail.com"  wrote:
> I have some template code which looks something like this:
> {% if condition %}
> {% get_latest parameter1 %} - foo
> {% else %}
> {% get_latest parameter2 %} - bar
> {% endif %}
>
> get_latest is a custom template tag, and I noticed that in my
> debugging output it is being run both times - ie with parameter1 and
> parameter2. Since it hits the database I'd rather not have it do
> this.
>
> On the other hand only foo or bar appears in the rendered page. I
> guess the template system renders all the tags, then discards
> whichever branch does not apply.
>
> So the question is, can I avoid this? Or should I just change my
> template tag so I can call it with:
> {% get_latest condition parameter1 parameter2 %}
>
> Thanks,
>
> Pete
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Should (or can) you have many to many relationship with abstract base class

2009-10-16 Thread Chip Grandits

I am fairly new to Django.  I have a strong background in object
oriented design, but only a shallow familiarity with relational
database design.  I am trying to develop my models and I have a sort
of general philosophical question about what the ORM is capable of,
and how it should be used.

So lets say, for example you are designing a website for a network of
people who take care of pets.  The caretaker would have a many-to-many
relationship with pets, since one caretaker could take of more than
one pet, and one pet might very well have more than one caretaker.  Of
course pet is an abstract class - and we can easily imagine many
concrete derived classes such as dog, cat, fish, snake, ferret, etc.
These derived classes have much in common but seem to have enough
distinction that they each have some attributes that makes it seem bad
design to "munge" them all into a general concrete pet class.

I am not clear if the the philosophy of the Django models is meant to
allow a model to have a many-to-many relationship with an abstract
base class.  To help me understand, I read several time in books and
online docs about how an explicit 'through' table works as the
intermediary for a many to many relationship.  But I cannot get my
head around how this would actually work for an abstract base class in
the relational database.  It seems that the intermediate table might
have a column (or multiple columns) with primary keys, but it would be
the primary keys of different tables for the different base classes.
To use my example, a table representing a "Caretaking Relation", would
have a column with a primary key to the Caretaker table, and another
column (or multiple columns) with primary keys to the various tables
that are the subclasses of pet, i.e. the dog table, the cat table, the
snake table, the fish table, etc.  And I guess I am not comfortable
that this idea really works.  Will the manager classes "get confused"
about which table the foreign keys refer to?  I guess I'm worried that
it might actually produce code that runs without producing errors, but
leads me into a morass of problems down the road.

So perhaps there is a good link someone can point me to?  Or perhaps
just a reassurance that this is an effective technique?  Or a warning
that it depends upon the particular database engine?  Or advice on
some coding and design that needs to be done to avoid problems (e.g.
Maybe I have to somehow make sure that the primary keys for the
derived class tables are unique among all the derived class tables)?
Or perhaps just a statement that such a design does not map well from
object oriented code to relational databases and I should use a
different design strategy?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django blog

2009-10-16 Thread lafada

Hi,

  I'm trying to integrate django basic apps blog Application.
I installed it on my project. the blog index templates works fine,
but post details is now working, shows me following error.

TemplateSyntaxError at /blog/2009/oct/15/hello-world/

Caught an exception while rendering: Reverse for '' with arguments '()' and keyword arguments
'{}' not found.

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/usr/lib/python2.5/site-packages/django/template/__init__.py",
line 909, in render
return func(*resolved_vars)
  File "/usr/lib/python2.5/site-packages/django/contrib/comments/
templatetags/comments.py", line 253, in comment_form_target
return comments.get_form_target()
  File "/usr/lib/python2.5/site-packages/django/contrib/comments/
__init__.py", line 61, in get_form_target
return urlresolvers.reverse
("django.contrib.comments.views.comments.post_comment")
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 341, in reverse
*args, **kwargs)))
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 291, in reverse
"arguments '%s' not found." % (lookup_view, args, kwargs))
NoReverseMatch: Reverse for ''
with arguments '()' and keyword arguments '{}' not found

I'm using

Django 1.1
basic apps from code.google.com svn path.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help to choose web-template

2009-10-16 Thread Михаил Лукин
Adam, thanks for the link! So much to choose from.

Mario, I'll check out blueprintcss. Other three sites provide (as I can see)
just layouts. Pretty good layouts, but colors and fonts are another things
that I do not want to waste my time to :)

Again, thanks you both!

On Fri, Oct 16, 2009 at 9:43 PM, Mario  wrote:

>
> If you are going to learn something new might as well learn something
> useful and beneficial. I suggest trying out Blueprint CSS Framework.
> It works great with Django templates.
>
> The URL is http://www.blueprintcss.org/
>
> Or try these following sites:
>
>
> http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/
> http://www.alistapart.com/articles/holygrail/
> http://www.webmonkey.com/codelibrary/tag/html
>
> Cheers
>
> _Mario
>
> On Oct 16, 1:20 pm, Михаил Лукин  wrote:
> > Not really Django question, so i'm sorry :)
> >
> > I'm Python programmer, not a web-designer. I wasted a whole day by
> > reinventing the wheel. First, I made base template myself. Then I dumped
> > HTML and CSS from some favorite sites and tried to apply them to my app.
> > Then I googled for free web-templates and found nothing good for me.
> >
> > The app is neither blog nor company portal. It is front-end for hardware
> and
> > software database. So, It must be VERY simple. It should contain header
> (for
> > app title), main menu, sidebar (for object context menu), styles for
> tables
> > with caption. I'll be happy if there will be footer and simple search bar
> > (somewhere in header or main menu).
> >
> > I appreciate any advice.
> >
> > --
> > regards,
> > Mihail
> >
>


-- 
regards,
Mihail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: One to Many relationship display

2009-10-16 Thread cerberos

Familiarise yourself with the python command line ('manage.py shell')
and the querying docs, shouldn't take long.

http://docs.djangoproject.com/en/dev/topics/db/queries/


I like the improvements that ipython brings to the command line, but
that's not relevant.

Hope this helps



On Oct 16, 11:55 pm, eugened  wrote:
> Probably trivial question but I can't find the answer:
> My model consist of 2 objects:
> Profile and Folder
> One profile can have multiple folders
> My task is to display or serialize into json Profile and list of
> folders in one request.
> So far I get only parent fields(Profile) but not folders.
> I am new to Django, come from Java camp - please help.
> Thanks.
>
> My Model:
> class Profile(models.Model):
>     profileid = models.DecimalField(primary_key=True)
>     email = models.CharField(max_length=70, blank=True)
>     firstname = models.CharField(max_length=100, blank=True)
>     lastname = models.CharField(max_length=100, blank=True)
>
> class Folder(models.Model):
>     folderid = models.DecimalField(primary_key=True,unique=True)
>     owner = models.ForeignKey(Profile,db_column='ownerid')
>     name = models.CharField(max_length=100)
>
> My code in a view:
> def getUser(request,profile_id):
>     profile=get_object_or_404(Profile, pk=profile_id)
>     queryset=Profile.objects.select_related().filter(pk=profile_id)
>     json_serializer = serializers.get_serializer("json")()
>
>     json_serializer.serialize(queryset, ensure_ascii=False)
>     data = json_serializer.getvalue()
>
>     return HttpResponse(data,mimetype="application/json",status=200)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help to choose web-template

2009-10-16 Thread Mario

If you are going to learn something new might as well learn something
useful and beneficial. I suggest trying out Blueprint CSS Framework.
It works great with Django templates.

The URL is http://www.blueprintcss.org/

Or try these following sites:

http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/
http://www.alistapart.com/articles/holygrail/
http://www.webmonkey.com/codelibrary/tag/html

Cheers

_Mario

On Oct 16, 1:20 pm, Михаил Лукин  wrote:
> Not really Django question, so i'm sorry :)
>
> I'm Python programmer, not a web-designer. I wasted a whole day by
> reinventing the wheel. First, I made base template myself. Then I dumped
> HTML and CSS from some favorite sites and tried to apply them to my app.
> Then I googled for free web-templates and found nothing good for me.
>
> The app is neither blog nor company portal. It is front-end for hardware and
> software database. So, It must be VERY simple. It should contain header (for
> app title), main menu, sidebar (for object context menu), styles for tables
> with caption. I'll be happy if there will be footer and simple search bar
> (somewhere in header or main menu).
>
> I appreciate any advice.
>
> --
> regards,
> Mihail
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help to choose web-template

2009-10-16 Thread Adam Stein

Have you checked out Open Source Web Design (http://www.oswd.org/)?  I
got all the templates that I use from this site.

On Fri, 2009-10-16 at 21:20 +0400, Михаил Лукин wrote:
> Not really Django question, so i'm sorry :)
> 
> I'm Python programmer, not a web-designer. I wasted a whole day by
> reinventing the wheel. First, I made base template myself. Then I
> dumped HTML and CSS from some favorite sites and tried to apply them
> to my app. Then I googled for free web-templates and found nothing
> good for me.
> 
> The app is neither blog nor company portal. It is front-end for
> hardware and software database. So, It must be VERY simple. It should
> contain header (for app title), main menu, sidebar (for object context
> menu), styles for tables with caption. I'll be happy if there will be
> footer and simple search bar (somewhere in header or main menu).
> 
> I appreciate any advice.
> 
> -- 
> regards,
> Mihail
> 
> 
> > 
-- 
Adam Stein @ Xerox Corporation   Email: a...@eng.mc.xerox.com

Disclaimer: Any/All views expressed
here have been proven to be my own.  [http://www.csh.rit.edu/~adam/]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Good News !! A mate found for your dog ...

2009-10-16 Thread jc

Hmm, well that's no good! ;)

On Fri, Oct 16, 2009 at 10:21 AM, Ramdas S  wrote:
>
>
> On Fri, Oct 16, 2009 at 10:48 PM, jc  wrote:
>>
>> Finally.  I wonder if their site uses django?
>
> Its php
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Good News !! A mate found for your dog ...

2009-10-16 Thread Михаил Лукин
It's the dog. The dog is the one who uses Django. All the time.

On Fri, Oct 16, 2009 at 9:18 PM, jc  wrote:

>
> Finally.  I wonder if their site uses django?
>
> On Fri, Oct 16, 2009 at 7:36 AM, turk970  wrote:
> >
> > You love your dog and your dog love’s you!
> >
> >
> > Give your dog the opportunity to find a soul mate, enjoy life to the
> > full and who knows maybe end up with little puppies. HavlaTavla.Com is
> > the new dog mating portal that can help you live your dogs dreams.
> > Havlatavla lists all types of dogs, breeds and owners together in one
> > easy to search site that allows you the opportunity to find a mate for
> > your dog and who knows perhaps a mate for yourself. Membership is free
> > and simple. You can search by filtering city, neighbourhood, race and
> > dog breeds to allow you to find the perfect match for your dog.
> >
> > Enjoy looking at pictures of thousands of partner candidates and read
> > their pickup massages. Help your dog to find its love by becoming our
> > member so we can match the best bride/groom for your dog as soon as
> > possible.
> > http://www.havlatavla.com
> >
> >
> >
> >
> > >
> >
>
> >
>


-- 
regards,
Mihail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Good News !! A mate found for your dog ...

2009-10-16 Thread Ramdas S
On Fri, Oct 16, 2009 at 10:48 PM, jc  wrote:

>
> Finally.  I wonder if their site uses django?
>

Its php

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Help to choose web-template

2009-10-16 Thread Михаил Лукин
Not really Django question, so i'm sorry :)

I'm Python programmer, not a web-designer. I wasted a whole day by
reinventing the wheel. First, I made base template myself. Then I dumped
HTML and CSS from some favorite sites and tried to apply them to my app.
Then I googled for free web-templates and found nothing good for me.

The app is neither blog nor company portal. It is front-end for hardware and
software database. So, It must be VERY simple. It should contain header (for
app title), main menu, sidebar (for object context menu), styles for tables
with caption. I'll be happy if there will be footer and simple search bar
(somewhere in header or main menu).

I appreciate any advice.

-- 
regards,
Mihail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Good News !! A mate found for your dog ...

2009-10-16 Thread jc

Finally.  I wonder if their site uses django?

On Fri, Oct 16, 2009 at 7:36 AM, turk970  wrote:
>
> You love your dog and your dog love’s you!
>
>
> Give your dog the opportunity to find a soul mate, enjoy life to the
> full and who knows maybe end up with little puppies. HavlaTavla.Com is
> the new dog mating portal that can help you live your dogs dreams.
> Havlatavla lists all types of dogs, breeds and owners together in one
> easy to search site that allows you the opportunity to find a mate for
> your dog and who knows perhaps a mate for yourself. Membership is free
> and simple. You can search by filtering city, neighbourhood, race and
> dog breeds to allow you to find the perfect match for your dog.
>
> Enjoy looking at pictures of thousands of partner candidates and read
> their pickup massages. Help your dog to find its love by becoming our
> member so we can match the best bride/groom for your dog as soon as
> possible.
> http://www.havlatavla.com
>
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



One to Many relationship display

2009-10-16 Thread eugened

Probably trivial question but I can't find the answer:
My model consist of 2 objects:
Profile and Folder
One profile can have multiple folders
My task is to display or serialize into json Profile and list of
folders in one request.
So far I get only parent fields(Profile) but not folders.
I am new to Django, come from Java camp - please help.
Thanks.

My Model:
class Profile(models.Model):
profileid = models.DecimalField(primary_key=True)
email = models.CharField(max_length=70, blank=True)
firstname = models.CharField(max_length=100, blank=True)
lastname = models.CharField(max_length=100, blank=True)

class Folder(models.Model):
folderid = models.DecimalField(primary_key=True,unique=True)
owner = models.ForeignKey(Profile,db_column='ownerid')
name = models.CharField(max_length=100)

My code in a view:
def getUser(request,profile_id):
profile=get_object_or_404(Profile, pk=profile_id)
queryset=Profile.objects.select_related().filter(pk=profile_id)
json_serializer = serializers.get_serializer("json")()

json_serializer.serialize(queryset, ensure_ascii=False)
data = json_serializer.getvalue()

return HttpResponse(data,mimetype="application/json",status=200)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Template code runs in both branches of an if statement

2009-10-16 Thread pjrhar...@gmail.com

I dont think that helps, but I have just realised when fiddling around
that if both template tags really were being called it would have
raised an error as only one isn't always valid.

The debugging output I was seeing came from the __init__ of my
template tag's Node class. However, the render method isn't called,
and thus the database isn't actually touched. So really it's not an
issue, but possibly something to be aware of.

Pete

On Oct 16, 5:11 pm, dononyx  wrote:
> try firstof??
> {% firstof var1 var2 var3 %}
> This is equivalent to:
>
> {% if var1 %}
>     {{ var1 }}
> {% else %}{% if var2 %}
>     {{ var2 }}
> {% else %}{% if var3 %}
>     {{ var3 }}
> {% endif %}{% endif %}{% endif %}
>
> On Oct 16, 9:49 am, "pjrhar...@gmail.com"  wrote:
>
> > I have some template code which looks something like this:
> > {% if condition %}
> > {% get_latest parameter1 %} - foo
> > {% else %}
> > {% get_latest parameter2 %} - bar
> > {% endif %}
>
> > get_latest is a custom template tag, and I noticed that in my
> > debugging output it is being run both times - ie with parameter1 and
> > parameter2. Since it hits the database I'd rather not have it do
> > this.
>
> > On the other hand only foo or bar appears in the rendered page. I
> > guess the template system renders all the tags, then discards
> > whichever branch does not apply.
>
> > So the question is, can I avoid this? Or should I just change my
> > template tag so I can call it with:
> > {% get_latest condition parameter1 parameter2 %}
>
> > Thanks,
>
> > Pete
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problems with filter_horizontal

2009-10-16 Thread gumbah

I seem to have the same problem...

Anyone know if this is a bug?

On Sep 1, 2:59 pm, Sandra Django  wrote:
> Hi friends, I'm using Django 1.1, and I want to change the widget by default
> on ManyToManyField for it looks as user permissions field in Django.
> For that, in my admin.py I wrote:
>
> from django.contrib import admin
> from myproject.app.models import Book
>
> class BookAdmin(admin.ModelAdmin):
>     filter_horizontal = ('author',)
>
> admin.site.register(Book, BookAdmin)
>
> I copied all .js (SelectBox.js, SelectFilter2.js, among others) to
> /myproject/media/js. But don't work, because don't appears any widget in
> author field. Why? What is the mistake?
> Thank's for any help,
> Sandra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Template code runs in both branches of an if statement

2009-10-16 Thread dononyx

try firstof??
{% firstof var1 var2 var3 %}
This is equivalent to:

{% if var1 %}
{{ var1 }}
{% else %}{% if var2 %}
{{ var2 }}
{% else %}{% if var3 %}
{{ var3 }}
{% endif %}{% endif %}{% endif %}

On Oct 16, 9:49 am, "pjrhar...@gmail.com"  wrote:
> I have some template code which looks something like this:
> {% if condition %}
> {% get_latest parameter1 %} - foo
> {% else %}
> {% get_latest parameter2 %} - bar
> {% endif %}
>
> get_latest is a custom template tag, and I noticed that in my
> debugging output it is being run both times - ie with parameter1 and
> parameter2. Since it hits the database I'd rather not have it do
> this.
>
> On the other hand only foo or bar appears in the rendered page. I
> guess the template system renders all the tags, then discards
> whichever branch does not apply.
>
> So the question is, can I avoid this? Or should I just change my
> template tag so I can call it with:
> {% get_latest condition parameter1 parameter2 %}
>
> Thanks,
>
> Pete
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Design decision

2009-10-16 Thread Léon Dignòn

I have a project. Within that project I have the app callerlist.
Callerlist is a list of either inbound or outbound phone calls. To
each phone call the following information should be written down: own
name, name of the caller, subject, message and time. This app has to
be coherent.

Now, for example, I want to bind the above app to an crm system or
another application with customer data. I am not sure which is the
best way to provide that interface. Should I provide an additional
field as a foreign key to the customer table? The table could be
defined via a variable in the settings.py.

Or are there better solutions?

ld
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Building a form to write one of two models

2009-10-16 Thread Antoni Aloy

2009/10/16 Luke Sneeringer :
>
> Good morning,
> I have two models that have mostly-similar fields (they both inherit
> from a single, abstract model in Django) and one different field. I'd
> really like it to be two separate tables in the database for
> normalization (each has a separate, one-to-many relationship with
> another table and the two are of distinct type and do not intersect).
>
> However, I would like to make a form that will seamlessly create (or
> edit) a row in one of these two tables. So, at first I set out to make
> a generic form (extending django.forms.Form) that displayed the
> fields, as well as a "type" ChoiceField that determined whether to
> save an instance of the first model or the second. Then, for editing,
> I simply have straight, unrelated django.forms.ModelForm classes that
> are instantiated.

You can create a factory for the form. That is, given the information
from the html, you choose wicht form to instantiate.

def get_form(param):
  if param == 'op1':
 return Form1
  elif param =='op2':
return Form2
...

On the view file

MyForm = get_form(param_from_request)

Form1 and Form2 are Modelforms


-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: When would you use Context instead of RequestContext?

2009-10-16 Thread wiswaud

On Oct 15, 9:17 am, Russell Keith-Magee 
wrote:
> On Thu, Oct 15, 2009 at 9:01 PM, wiswaud  wrote:

> It's strange you should raise that issue, because as of about 24 hours
> ago, it isn't the case any more. Luke Plant checked in some changes to
> trunk that make the retrieval of messages by RequestContext both lazy
> and memoized, so they won't be retrieved unless you explicitly request
> them, and they will be preserved for the length of the request once
> retrieved.

That's awesome, and a smart + beautiful solution to this problem!

> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Complex annotated/aggregated QuerySet ?

2009-10-16 Thread Javier Guerra

On Fri, Oct 16, 2009 at 9:09 AM, Thierry  wrote:
> What I would like to do, however, is the following:
> Retrieving Objective objects, each with a count of completed tasks and
> remaining tasks (i.e grouping by their status).
>
> Can this be done 'natively' using Django querysets?
> Thanks for any hint (sorry, my SQL skills are not even sharp enough to
> translate this requirement with raw SQL).

i have a similar requirement (but wanted to count each of more than
two states for tasks).  'native' annotation didn't help, so i used
'.extra()'

something like this:
Objective.objects.all().extra (select={
'completed' : '(SELECT COUNT(*) from app_task WHERE
objective_id=app_objective.id AND status=1',
'remaining' : '(SELECT COUNT(*) from app_task WHERE
objective_id=app_objective.id AND status=0',
})

(where 'app' is your appname, because you have to use SQL-level table
and field names)

note that this is still a QuerySet, so you can use .filter(), or even
.annotate() as you wish.

i get the feeling that it might be possible to do with some clever
manager-fu, if you could manage to have two fields on Objective, that
return the completed and remaining task sets respectively...
unfortunately, i have no idea how to do that.


-- 
Javier

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unable to see SQL even after DEBUG=True in settings

2009-10-16 Thread Javier Guerra

On Fri, Oct 16, 2009 at 1:55 AM, Jani Tiainen  wrote:
>> I have run the app such that it has executed number of db queries and I
>> know for sure there must be some sql.  But still I don't see any in
>> connection.queries.  what am I doing wrong?
>
> Are you sure that querysets are evaluated? Meaning that you actually
> access them, just create querysets.


also, from the transcript you send, it's not obvious if you actually
run the app in the same python process or if it's running separately
and you'd want to magically see the effect in an independent
interpreter


-- 
Javier

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Template code runs in both branches of an if statement

2009-10-16 Thread pjrhar...@gmail.com

I have some template code which looks something like this:
{% if condition %}
{% get_latest parameter1 %} - foo
{% else %}
{% get_latest parameter2 %} - bar
{% endif %}

get_latest is a custom template tag, and I noticed that in my
debugging output it is being run both times - ie with parameter1 and
parameter2. Since it hits the database I'd rather not have it do
this.

On the other hand only foo or bar appears in the rendered page. I
guess the template system renders all the tags, then discards
whichever branch does not apply.

So the question is, can I avoid this? Or should I just change my
template tag so I can call it with:
{% get_latest condition parameter1 parameter2 %}

Thanks,

Pete

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Good News !! A mate found for your dog ...

2009-10-16 Thread turk970

You love your dog and your dog love’s you!


Give your dog the opportunity to find a soul mate, enjoy life to the
full and who knows maybe end up with little puppies. HavlaTavla.Com is
the new dog mating portal that can help you live your dogs dreams.
Havlatavla lists all types of dogs, breeds and owners together in one
easy to search site that allows you the opportunity to find a mate for
your dog and who knows perhaps a mate for yourself. Membership is free
and simple. You can search by filtering city, neighbourhood, race and
dog breeds to allow you to find the perfect match for your dog.

Enjoy looking at pictures of thousands of partner candidates and read
their pickup massages. Help your dog to find its love by becoming our
member so we can match the best bride/groom for your dog as soon as
possible.
http://www.havlatavla.com




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Complex annotated/aggregated QuerySet ?

2009-10-16 Thread Thierry

Hi,

Considering the following models (simplified time-tracking app):
-
class Objective(models.Model):
  pass

class Task(models.Model):
  status = models.IntegerField()
  objective = models.ForeignKey(Objective, related_name='tasks')
-

I can retrieve Objective objects, each with a count of associated
tasks, using annotation/aggregation:
Objective.objects.annotate(count_tasks=Count('objective__tasks'))

What I would like to do, however, is the following:
Retrieving Objective objects, each with a count of completed tasks and
remaining tasks (i.e grouping by their status).

Can this be done 'natively' using Django querysets?
Thanks for any hint (sorry, my SQL skills are not even sharp enough to
translate this requirement with raw SQL).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Building a form to write one of two models

2009-10-16 Thread Luke Sneeringer

Good morning,
I have two models that have mostly-similar fields (they both inherit
from a single, abstract model in Django) and one different field. I'd
really like it to be two separate tables in the database for
normalization (each has a separate, one-to-many relationship with
another table and the two are of distinct type and do not intersect).

However, I would like to make a form that will seamlessly create (or
edit) a row in one of these two tables. So, at first I set out to make
a generic form (extending django.forms.Form) that displayed the
fields, as well as a "type" ChoiceField that determined whether to
save an instance of the first model or the second. Then, for editing,
I simply have straight, unrelated django.forms.ModelForm classes that
are instantiated.

My problem: That's not DRY, and I don't feel like it's the right way
to do it. So, I'm wondering if anyone can fill me in on a better way
to...
- if the form is unbound, present the form, plus a "type" dropdown to
assess where to place the information on save (I also need one
dependent field, but I can do that with simple JavaScript and an
intelligent save() method).
- if the form is bound, do not include the "type" field (as I don't
want the user to be able to change it)

I'm pretty sure my solution is off base. Can someone enlighten me
regarding a better way? Much obliged!

Thanks,
Luke Sneeringer

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: validation error depending on widget

2009-10-16 Thread wmstudio

thanks a lot

On Oct 16, 3:21 pm, Daniel Roseman  wrote:
> On Oct 16, 2:18 pm, wmstudio  wrote:
>
>
>
>
>
> > Hi,
>
> > I have a model containing:
>
> > class Book(models.Model):
> >     title = models.CharField(max_length=128)
> >     price = models.DecimalField(max_digits=8, decimal_places=2,
> > help_text='Please enter the price in $')
> >     summary = models.TextField(blank=True)
>
> > and I adjust the textarea size using admin.py:
>
> > class BookModelForm(forms.ModelForm):
> >     title = forms.CharField(widget=forms.TextInput(attrs=
> > {'size':'80'}))
> >     summary = forms.CharField(widget=forms.widgets.Textarea(attrs=
> > {'rows':30, 'cols':100}))
> >     class Meta:
> >         Book
>
> > Now notice the model option "blank=True" for the summary field. When I
> > have an admin form and I enter the data but leave the "summary" field
> > empty I get a validation error, stating "This field is required".
> > However when I ommit the the summary entry in the admin class
> > BookModelForm like this:
>
> > class BookModelForm(forms.ModelForm):
> >     title = forms.CharField(widget=forms.TextInput(attrs=
> > {'size':'80'}))
> >     class Meta:
> >         Book
>
> > I am not the getting the validation error. Nothing changes in the
> > actual model. Am I missing something?
>
> When you override a field by redefining it in the modelform, you
> override everything, including its required/not required status. Since
> the default for form fields is for them to be required, you will get a
> validation error. You will need to specify required=False explicitly
> on the summary field if you override it.
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: validation error depending on widget

2009-10-16 Thread Daniel Roseman

On Oct 16, 2:18 pm, wmstudio  wrote:
> Hi,
>
> I have a model containing:
>
> class Book(models.Model):
>     title = models.CharField(max_length=128)
>     price = models.DecimalField(max_digits=8, decimal_places=2,
> help_text='Please enter the price in $')
>     summary = models.TextField(blank=True)
>
> and I adjust the textarea size using admin.py:
>
> class BookModelForm(forms.ModelForm):
>     title = forms.CharField(widget=forms.TextInput(attrs=
> {'size':'80'}))
>     summary = forms.CharField(widget=forms.widgets.Textarea(attrs=
> {'rows':30, 'cols':100}))
>     class Meta:
>         Book
>
> Now notice the model option "blank=True" for the summary field. When I
> have an admin form and I enter the data but leave the "summary" field
> empty I get a validation error, stating "This field is required".
> However when I ommit the the summary entry in the admin class
> BookModelForm like this:
>
> class BookModelForm(forms.ModelForm):
>     title = forms.CharField(widget=forms.TextInput(attrs=
> {'size':'80'}))
>     class Meta:
>         Book
>
> I am not the getting the validation error. Nothing changes in the
> actual model. Am I missing something?

When you override a field by redefining it in the modelform, you
override everything, including its required/not required status. Since
the default for form fields is for them to be required, you will get a
validation error. You will need to specify required=False explicitly
on the summary field if you override it.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Archiving Model Instances?

2009-10-16 Thread Thomas Guettler

I forgot to mention, that you can write a custom manager. This
way FooModel.objects.all() only returns not archived instances.


Thomas Guettler wrote:
> Hi,
> 
> If you use indices to access the models, you will see no noticable difference
> in speed between 1,000 and 100,000 rows. This may be different if use no
> indices (e.g. SQL LIKE "%...%"). But if the boolean column "archived" has
> an index, the sequential scan will be fast.
...

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



validation error depending on widget

2009-10-16 Thread wmstudio

Hi,

I have a model containing:

class Book(models.Model):
title = models.CharField(max_length=128)
price = models.DecimalField(max_digits=8, decimal_places=2,
help_text='Please enter the price in $')
summary = models.TextField(blank=True)

and I adjust the textarea size using admin.py:

class BookModelForm(forms.ModelForm):
title = forms.CharField(widget=forms.TextInput(attrs=
{'size':'80'}))
summary = forms.CharField(widget=forms.widgets.Textarea(attrs=
{'rows':30, 'cols':100}))
class Meta:
Book

Now notice the model option "blank=True" for the summary field. When I
have an admin form and I enter the data but leave the "summary" field
empty I get a validation error, stating "This field is required".
However when I ommit the the summary entry in the admin class
BookModelForm like this:

class BookModelForm(forms.ModelForm):
title = forms.CharField(widget=forms.TextInput(attrs=
{'size':'80'}))
class Meta:
Book

I am not the getting the validation error. Nothing changes in the
actual model. Am I missing something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django default date formatting changes

2009-10-16 Thread David De La Harpe Golden

vishak wrote:
> what you have told is OK but when you enter in datefield 10-OCT-09
> instead of 2009-10-10 it gives error.
> 

If you don't tell a forms.DateField to expect 10-OCT-09, it won't.
Django's DateField default input format list doesn't include that
particular '%d-%b-%y' format by default.

It does have a bunch of others, including e.g. "10 Oct 2009", _not_ just
'-mm-dd'! Beware in particular it allows the confusing 'mm/dd/'
order that you might well want to kill with fire unless you're american.
http://docs.djangoproject.com/en/dev/ref/forms/fields/#datefield

You are probably autogenerating forms from your models, in your
frontend or in the django admin or both.  If so, model.DateFields will
engender form.DateFields with default values including the default
input_formats list.   So you need to override the form field
appropriately to set a nondefault input_formats list including
your desired one.

For your own forms on a one-off individual field basis, this is easy,
just override the field in your form class appropriately.

To do a bunch of 'em, one possible approach you could use is to make
datefield subclass with the default you want
http://docs.djangoproject.com/en/dev/howto/custom-model-fields/

class MyFormDateField(forms.DateField):
def __init__(self, *args, **kwargs):
# you still want %Y-%m-%d on the list as it's
# what the javascript datepicker used by the admin
# injects on the client side.
d = dict(input_formats=('%d-%b-%y','%Y-%m-%d',))
d.update(kwargs)
super(MyDateField, self).__init__(*args, **d)

class MyModelDateField(models.DateField):
def formfield(self, *args, **kwargs):
d = dict(form_class=MyFormDateField)
d.update(kwargs)
return super(MyModelDateField, self).formfield(*args, **d)

class MyModel(models.Model):
mydate = MyModelDateField()



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: UML and OCL

2009-10-16 Thread Goffer Looney

Hi,

You might be interested in this tool called UML to Django:

http://code.google.com/p/uml-to-django/

It is a python script which automatically converts a UML class diagram
into Django models (and admins). It currently works with Argo UML
diagrams but could, in theory, be easily extended to support other UML
authoring applications.

It has been successfully used with small size projects.

Best,

Goffer

On Oct 2, 3:50 pm, Geobase Isoscale  wrote:
> Thanks Maggie for your quick, response you keep me going. I hope to find one
> these tools that translate UML into Models. Thanks very much.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SVG and Django

2009-10-16 Thread Tim Chase

> 
>
>
>   
>type="image/svg+xml"
>   pluginspage="http://www.adobe.com/svg/viewer/install/;
> />
>   
>
> 
> 
> This file works fine when I opened it with firefox, but dont work if
> the file is served by django server. The SVG image (radial2.svg) is
> not displayed.

Is this the production server or the dev server?  Assuming the 
SVG file is just more static media, so you'll want to read up on 
that.  If it's the production server, make sure that you have it 
serving the static media instead of handing it off to Django.  If 
it's the development server, make sure that you're serving static 
files.  I usually do this with something like

if 'runserver' in argv:
 urlpatterns += patterns('',
 (r'^site_media/(?P.*)$',
 'django.views.static.serve',
 {'document_root': '../media'}
 ),
 )

in my urls.py so that when I use the dev server, it also handles 
static media.

If the SVG is dynamically created (yay, SVG!), make sure your 
urls.py can find it and that you point to an appropriate view.

-tim




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SVG and Django

2009-10-16 Thread wancharle sebastiao quirino
try accessing the url http://127.0.0.1:8000/radial2.svg in firefox and see
what happens.

Probably you have not set the right url for static files.


2009/10/16 claytonbonelli 

>
> I have a HMLT file with a SVG embed tag, like this:
>
> 
>   
>   
>  
>  type="image/svg+xml"
>pluginspage="http://www.adobe.com/svg/viewer/install/;
>  />
>  
>   
> 
>
> This file works fine when I opened it with firefox, but dont work if
> the file is served by django server. The SVG image (radial2.svg) is
> not displayed.
>
> Any help?
>
> Thanks
>
> Clayton
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



edit basic user data not validating on website front end

2009-10-16 Thread grimmus

Hi,

On my website i have a edit profile page, this enables users to edit 4
fields : username, first name, last name and email address. For some
reason the form never validates, is it not enough just to pass the 4
fields i want to edit and leave the others as they are ?

My view looks like

def profile_edit(request):
if request.method == 'POST':
form = UserChangeForm(request.POST, instance=request.user)
if form.is_valid():
edit_user = form.save()
return HttpResponseRedirect("/accounts/profile/updated")
else:
return render_to_response("registration/
profile_edit.html")
print form.errors
else:
user=request.user
form = UserChangeForm(instance=user)
return render_to_response("registration/profile_edit.html",
{ 'form':form,})

Is there something else i need to pass to make it validate ?

Thanks for any 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django default date formatting changes

2009-10-16 Thread Bayuadji

Hi,

perhaps you could create clean_*date in your form,
and change the datefield 10-OCT-09 to 10-10-2009

-djibon-


On 10/16/09, vishak  wrote:
>
> what you have told is OK but when you enter in datefield 10-OCT-09
> instead of 2009-10-10 it gives error.
>
> On Oct 16, 4:41 pm, Михаил Лукин  wrote:
>> Try thishttp://docs.djangoproject.com/en/dev/ref/settings/#date-format
>>
>>
>>
>> On Fri, Oct 16, 2009 at 2:21 PM, vishak  wrote:
>>
>> > Hi Django users,
>>
>> >   I have one question in django for which details are given below
>>
>> > 1] The default date format in django is '`2009-10-10' when entered
>> > through frontend (i.e by using models.DateField()).  I manipulated
>> > this behavior to '10-OCT-09'.
>>
>> > 2] Everything is fine upto now, but when i save the data the django
>> > validation error comes saying
>> > "Date format should be -mm-dd".
>>
>> > Can anyone provide a solution to override this behavior of django and
>> > also explain why django supports only '-mm-dd' format.
>>
>> > Thanks in advance
>>
>> > Vishak.V
>>
>> --
>> regards,
>> Mihail
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



SVG and Django

2009-10-16 Thread claytonbonelli

I have a HMLT file with a SVG embed tag, like this:


   
   
  
  http://www.adobe.com/svg/viewer/install/;
  />
  
   


This file works fine when I opened it with firefox, but dont work if
the file is served by django server. The SVG image (radial2.svg) is
not displayed.

Any help?

Thanks

Clayton

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django default date formatting changes

2009-10-16 Thread vishak

what you have told is OK but when you enter in datefield 10-OCT-09
instead of 2009-10-10 it gives error.

On Oct 16, 4:41 pm, Михаил Лукин  wrote:
> Try thishttp://docs.djangoproject.com/en/dev/ref/settings/#date-format
>
>
>
> On Fri, Oct 16, 2009 at 2:21 PM, vishak  wrote:
>
> > Hi Django users,
>
> >   I have one question in django for which details are given below
>
> > 1] The default date format in django is '`2009-10-10' when entered
> > through frontend (i.e by using models.DateField()).  I manipulated
> > this behavior to '10-OCT-09'.
>
> > 2] Everything is fine upto now, but when i save the data the django
> > validation error comes saying
> > "Date format should be -mm-dd".
>
> > Can anyone provide a solution to override this behavior of django and
> > also explain why django supports only '-mm-dd' format.
>
> > Thanks in advance
>
> > Vishak.V
>
> --
> regards,
> Mihail
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django default date formatting changes

2009-10-16 Thread Михаил Лукин
Try this
http://docs.djangoproject.com/en/dev/ref/settings/#date-format

On Fri, Oct 16, 2009 at 2:21 PM, vishak  wrote:

>
> Hi Django users,
>
>   I have one question in django for which details are given below
>
> 1] The default date format in django is '`2009-10-10' when entered
> through frontend (i.e by using models.DateField()).  I manipulated
> this behavior to '10-OCT-09'.
>
> 2] Everything is fine upto now, but when i save the data the django
> validation error comes saying
> "Date format should be -mm-dd".
>
> Can anyone provide a solution to override this behavior of django and
> also explain why django supports only '-mm-dd' format.
>
> Thanks in advance
>
> Vishak.V
> >
>


-- 
regards,
Mihail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: erronr during rendering

2009-10-16 Thread nausikaa


Ciao Luca


I think the problem are the '%' in the datetime string.
Have a look here:
http://docs.djangoproject.com/en/dev/ref/templates/builtins/

and try this:

{{ value|date }}

i.e.

...
20  {{ m.dataora|date }}
...

respectively.
Does it cure the problem?

nausikaa


On Oct 16, 10:53 am, luca72  wrote:
> hello can you explain how to solve this error:
> Exception Type: TemplateSyntaxError at /vis_scar/
> Exception Value: Caught an exception while rendering: Incorrect
> datetime value: '%2009-10-15 15:45:59%' for column 'dataora' at row 1
>
> He stop at line 17
>
> 8       
> 9       
> 10      
> 11       Nome File
> 12       Data 
> 13       IP 
> 14       Utente 
> 15      
> 16      
> 17      {% for m in tutti %}
> 18      
> 19      {{m.nome_file}}
> 20      {{m.dataora}}
> 21      {{m.indirizzo_ip}}
> 22      {{m.utente}}
> 23      
> 24      {% endfor %}
> 25      
>
> Thanks Luca
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django default date formatting changes

2009-10-16 Thread vishak

Hi Django users,

   I have one question in django for which details are given below

1] The default date format in django is '`2009-10-10' when entered
through frontend (i.e by using models.DateField()).  I manipulated
this behavior to '10-OCT-09'.

2] Everything is fine upto now, but when i save the data the django
validation error comes saying
"Date format should be -mm-dd".

Can anyone provide a solution to override this behavior of django and
also explain why django supports only '-mm-dd' format.

Thanks in advance

Vishak.V
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Archiving Model Instances?

2009-10-16 Thread davor



On Oct 16, 11:02 am, Thomas Guettler  wrote:
> Hi,
>
> If you use indices to access the models, you will see no noticable difference
> in speed between 1,000 and 100,000 rows. This may be different if use no
> indices (e.g. SQL LIKE "%...%"). But if the boolean column "archived" has
> an index, the sequential scan will be fast.
>
> I would *not* create a second table and "move" the data from one table
> to the other.
>
> Léon Dignòn wrote:

I agree with thomas, create Boolean attribute on your model and index
it
http://docs.djangoproject.com/en/dev/ref/models/fields/#db-index

It should be reasonably fast to say Model.objects.filter
(archive=False) even with a high row count.

You can even override admins change list queryset later to show only
records that have not been archived or you can set up a filter for it.

http://blog.dougalmatthews.com/2008/10/filter-the-django-modeladmin-set/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin why deleting related(null=True) objects?

2009-10-16 Thread x_O

I've created a Ticket for that issue
http://code.djangoproject.com/ticket/12003#preview

but for now no response ...


On 8 Paź, 19:05, Alex Robbins  wrote:
> This sounds related to this tickethttp://code.djangoproject.com/ticket/9308,
> which supposedly fixed this issue 5 months ago. You should probably
> file a bug report.
>
> On Oct 7, 4:19 pm, Peter Sagerson  wrote:
>
> > Yes, Django always cascades deletes. There's talk about providing more  
> > options in a future release, but for now it's kind of a problem. I  
> > generally find this behavior potentially catastrophic, so I wrote an  
> > intermediate model base class that clears all nullable foreign keys  
> > before deleting an object:
>
> >http://www.djangosnippets.org/snippets/1231/
>
> > Note that this probably won't stop the admin app from warning about  
> > the anticipated cascade.
>
> > On Oct 7, 2009, at 6:37 AM, x_O wrote:
>
> > > Hi
>
> > > My question that I'm getting right that situation. I've two models:
>
> > > class First(db.models):
> > >    second_item = models.ForeignKey('Second',null=True)
> > >    ...
>
> > > class Second(db.models):
> > >    ...
>
> > > I've both models registered in admin.py as AdminModels.
>
> > > Why when I'm trying to delete some object created from "Second" class
> > > which is RELATED to other one created from "First" class, admin is
> > > telling me that will remove also that "First" object (relation in
> > > ForeignKey is null). I understand that when there is null=False
> > > attribute should remove it, by why when it is null=True?
>
> > > In my interpretation of that should just leave First object with
> > > 'second_item' = None.
>
> > > x_O
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Flatpage on first page of a website

2009-10-16 Thread Lars Stavholm

Alessandro Ronchi wrote:
> I need to put a flatpage on /
> and make www.example.com
> return the flatpage.
> 
> Is it possible? What url must I put in flatpage admin?

No flatpages in admin as far as I know.

At the frontend (your web site www.example.com) however:

1. Create a flatpage for with URL /
2. Add django.contrib.flatpages.middleware.FlatpageFallbackMiddleware
   to MIDDLEWARE_CLASSES in settings.py
3. Add django.contrib.flatpages to INSTALLED_APPS.

That should do it.

/L


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can't get css working

2009-10-16 Thread David

> The "interesting discussion" was actually a practical example of a
> setup that is known to work and really helps avoiding typos.

Of course I included your suggestion before I was replying. The only
thing i did not get was the part with TEMPLATE_CONTEXT_PROCESSORS, so
I hardcoded the URL in the template.
>From the server output i reckon that i have the output right. And when
I have thsi working, I will try to understand the
TEMPLATE_CONTEXT_PROCESSORS-part.

I will give it another try with an old project I had where that worked
and also try a complete clean trial. If that won't work I'll comeback!
would you try using a debugger?


thanks anyway for all your help!


On 15 Okt., 23:54, bruno desthuilliers 
wrote:
> On 15 oct, 17:44, David  wrote:
>
> > Thank you for the interesting discussion.
> > Still, my original problem is bothering me.
>
> The "interesting discussion" was actually a practical example of a
> setup that is known to work and really helps avoiding typos.
>
> Did you try to rewrite your code according to this example ? If yes,
> and it still fails, please make a tarball of your project and post it
> somewhere we can get it.
>
> > Any idea what I could do to narrow it down?
>
> Make sure you have 'DEBUG=True' in your settings.py and
> "django.core.context_processors.debug" listed in your
> TEMPLATE_CONTEXT_PROCESSORS, run the dev server and point your browser
> to "127.0.0.1:8000/media_site/style.css". You should get a  debug page
> telling you whether the 404 comes from the dispatcher not being able
> to resolve the url, or if the url was resolved but the file not found.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Archiving Model Instances?

2009-10-16 Thread Thomas Guettler

Hi,

If you use indices to access the models, you will see no noticable difference
in speed between 1,000 and 100,000 rows. This may be different if use no
indices (e.g. SQL LIKE "%...%"). But if the boolean column "archived" has
an index, the sequential scan will be fast.

I would *not* create a second table and "move" the data from one table
to the other.

Léon Dignòn wrote:
> Hello,
> 
> I am programming an application where a model instance could be
> archived if necessary. For example: in gmail I can archive e-mails and
> they move in the archived folder.
> 
> The question is: is it only a boolean class-attribute called archived?
> Or is there more technical know how behind it?
> 
> If I have 20,000 entries in one model (table), a search takes longer
> than with only 1,000 entries. Now is there a better solutions than
> moving archived entries into another model (table)? … or a more common
> solution?


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



erronr during rendering

2009-10-16 Thread luca72

hello can you explain how to solve this error:
Exception Type: TemplateSyntaxError at /vis_scar/
Exception Value: Caught an exception while rendering: Incorrect
datetime value: '%2009-10-15 15:45:59%' for column 'dataora' at row 1

He stop at line 17

8   
9   
10  
11   Nome File
12   Data 
13   IP 
14   Utente 
15  
16  
17  {% for m in tutti %}
18  
19  {{m.nome_file}}
20  {{m.dataora}}
21  {{m.indirizzo_ip}}
22  {{m.utente}}
23  
24  {% endfor %}
25  

Thanks Luca
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Flatpage on first page of a website

2009-10-16 Thread Alessandro Ronchi

I need to put a flatpage on /
and make www.example.com
return the flatpage.

Is it possible? What url must I put in flatpage admin?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: windows localhost send email

2009-10-16 Thread grimmus

Thanks for the replies, i did the command line option and it's working
great

On Oct 16, 9:47 am, Servais Nabil  wrote:
> On linux you can use command :
>
> sudo python -m smtpd -n -c DebuggingServer localhost:25
>
> I suppose you can adapt it on windows (by changing port number for exemple)
>
> On Fri, Oct 16, 2009 at 9:28 AM, grimmus  wrote:
>
> > Hi,
>
> > I am setting up the password reset function in my app.
>
> > When i click 'Reset my password' i get the error
>
> > (10061, 'No connection could be made because the target machine
> > actively refused it')
>
> > I am guessing it's because there is trouble sending the email. How can
> > i setup my machine to be able to send emails ?
>
> > My app is running on localhost:
>
> > Thanks for any info.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: djangocon videos

2009-10-16 Thread bittin
nice :)

On Thu, Oct 15, 2009 at 12:39 AM, Nick Lo wrote:

>
> > anybody knows when djangocon september/portland videos will be
> > available?
>
> I expect you'll hear about their availability here first:
>
> http://twitter.com/djangocon
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: app model

2009-10-16 Thread Léon Dignòn

User signals:

models.py
--
def do_something(sender, instance=None, **kwargs):
"""Does something
instance is the user instance.
"""
if instance is not None:
# Do Something
post_save.connect(do_something, sender=User) # User is the user model.

On 14 Okt., 13:17, Zilva  wrote:
> Hi,
>
> seeking a way how user ID automatically add in to the integer field,
> Django model.
> Would anyone know any simple solution?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: windows localhost send email

2009-10-16 Thread Léon Dignòn

Download and run "Free SMTP Server": http://www.softstack.com/freesmtp.html

No need to configure anything. Your sent e-mails will probably moved
in your spam folder.

-ld

On 16 Okt., 09:47, Angel Cruz  wrote:
> In your settings.py, make sure you set EMAIL_HOST correctly.
>
> 1. test if you are able to email with a simple python program:
> If you have comcast cable in your home, this should work:
>
> ---
> import smtplib
>
> from email.mime.multipart import MIMEMultipart
> from email.mime.text import MIMEText
>
> def email_me(myRecipient):
>     me = "whatevermyem...@gmail.com"
>     EMAIL_HOST='smtp.comcast.net'
>
>     # Create message container - the correct MIME type is
> multipart/alternative.
>     msg = MIMEMultipart('alternative')
>     msg['Subject'] = "Test email"
>     msg['From'] = me
>     msg['To'] = myRecipient
>
>     # Create the body of the message (a plain-text and an HTML version).
>     text = """
>     this is just a test
> """
>
>     html = """\
>     
>     
>     
>      This is just a test    
>     
>     
>     
> """
>
>     part1 = MIMEText(text, 'plain')
>     part2 = MIMEText(html, 'html')
>
>     msg.attach(part1)
>     msg.attach(part2)
>
>     # Send the message via local SMTP server.
>     s = smtplib.SMTP(EMAIL_HOST)
>     # sendmail function takes 3 arguments: sender's address, recipient's
> address
>     # and message to send - here it is sent as one string.
>     s.sendmail(me, myRecipient, msg.as_string())
>     s.quit()
> 
> # --- MAIN --- #
> 
>     email_me("mywhatver_em...@gmail.com")
> ---­---
>
> 2.
> Once above test email code works, you can set the EMAIL_HOST in your
> settings.py to the same.
>
>
>
> On Fri, Oct 16, 2009 at 12:28 AM, grimmus  wrote:
>
> > Hi,
>
> > I am setting up the password reset function in my app.
>
> > When i click 'Reset my password' i get the error
>
> > (10061, 'No connection could be made because the target machine
> > actively refused it')
>
> > I am guessing it's because there is trouble sending the email. How can
> > i setup my machine to be able to send emails ?
>
> > My app is running on localhost:
>
> > Thanks for any info.- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: windows localhost send email

2009-10-16 Thread Servais Nabil
On linux you can use command :

sudo python -m smtpd -n -c DebuggingServer localhost:25

I suppose you can adapt it on windows (by changing port number for exemple)


On Fri, Oct 16, 2009 at 9:28 AM, grimmus  wrote:
>
> Hi,
>
> I am setting up the password reset function in my app.
>
> When i click 'Reset my password' i get the error
>
> (10061, 'No connection could be made because the target machine
> actively refused it')
>
> I am guessing it's because there is trouble sending the email. How can
> i setup my machine to be able to send emails ?
>
> My app is running on localhost:
>
> Thanks for any info.
> >

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: windows localhost send email

2009-10-16 Thread Angel Cruz
In your settings.py, make sure you set EMAIL_HOST correctly.

1. test if you are able to email with a simple python program:
If you have comcast cable in your home, this should work:

---
import smtplib

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

def email_me(myRecipient):
me = "whatevermyem...@gmail.com"
EMAIL_HOST='smtp.comcast.net'

# Create message container - the correct MIME type is
multipart/alternative.
msg = MIMEMultipart('alternative')
msg['Subject'] = "Test email"
msg['From'] = me
msg['To'] = myRecipient

# Create the body of the message (a plain-text and an HTML version).
text = """
this is just a test
"""

html = """\



 This is just a test



"""

part1 = MIMEText(text, 'plain')
part2 = MIMEText(html, 'html')

msg.attach(part1)
msg.attach(part2)

# Send the message via local SMTP server.
s = smtplib.SMTP(EMAIL_HOST)
# sendmail function takes 3 arguments: sender's address, recipient's
address
# and message to send - here it is sent as one string.
s.sendmail(me, myRecipient, msg.as_string())
s.quit()

# --- MAIN --- #

email_me("mywhatver_em...@gmail.com")
--

2.
Once above test email code works, you can set the EMAIL_HOST in your
settings.py to the same.




On Fri, Oct 16, 2009 at 12:28 AM, grimmus  wrote:

>
> Hi,
>
> I am setting up the password reset function in my app.
>
> When i click 'Reset my password' i get the error
>
> (10061, 'No connection could be made because the target machine
> actively refused it')
>
> I am guessing it's because there is trouble sending the email. How can
> i setup my machine to be able to send emails ?
>
> My app is running on localhost:
>
> Thanks for any info.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Archiving Model Instances?

2009-10-16 Thread Léon Dignòn

Hello,

I am programming an application where a model instance could be
archived if necessary. For example: in gmail I can archive e-mails and
they move in the archived folder.

The question is: is it only a boolean class-attribute called archived?
Or is there more technical know how behind it?

If I have 20,000 entries in one model (table), a search takes longer
than with only 1,000 entries. Now is there a better solutions than
moving archived entries into another model (table)? … or a more common
solution?

What would you propose?

-ld
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



windows localhost send email

2009-10-16 Thread grimmus

Hi,

I am setting up the password reset function in my app.

When i click 'Reset my password' i get the error

(10061, 'No connection could be made because the target machine
actively refused it')

I am guessing it's because there is trouble sending the email. How can
i setup my machine to be able to send emails ?

My app is running on localhost:

Thanks for any info.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: hosting from /some/url in apache

2009-10-16 Thread Jani Tiainen

Graham Dumpleton kirjoitti:
> 
> 
> On Oct 15, 5:14 am, Jani Tiainen  wrote:
>> Chris Withers kirjoitti:
>>> Hi All,
>>> I need to host my django project from /some/folder in my apache instance.
>>> I have the following:
>>> WSGIScriptAlias /some/folder /path/to/django.wsgi
>>> Does this now mean I have to prefix all my entries in urls.py with
>>> /some/folder?
>>> I hope not, but give that going to:
>>> http://myserver/some/folder
>>> ...gives me a 404 unless I do, I'm not hopeful.
>>> What am I doing wrong?
>> "nothing".
>>
>> Term is called "suburl deployment" and I've done it (for testing purposes).
>>
>> Apache config:
>>
>> RewriteEngine On
>>
>> #add missing trailing slash if needed
>> RewriteRule^/$  //  [R]
> 
> This rewrite rule should not be required for things to work.

I needed it because if it was missing before call entered in Django 
login stuff, return URL was emtpy ("") and it didn't resolved correctly.

There is something a bit fishy in login part (when accessing 
http://example.invalid/mysite/someurl) it didn't worked correctly.

Also I do not know why I was required to set "LOGIN_URL" to absolute 
path... (Or could there have been some alternative way to do that)

-- 
Jani Tiainen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unable to see SQL even after DEBUG=True in settings

2009-10-16 Thread Jani Tiainen

Indudhar Devanath kirjoitti:
> Here is what is happening.
> 
>  >>> from django.db import connection
>  >>> from mysite import settings
>  >>> settings.DEBUG
> True
>  >>> connection.queries
> []
> 
> I have run the app such that it has executed number of db queries and I 
> know for sure there must be some sql.  But still I don't see any in 
> connection.queries.  what am I doing wrong?

Are you sure that querysets are evaluated? Meaning that you actually 
access them, just create querysets.

Also in your example there is no queries happening, nor constructed.

-- 
Jani Tiainen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: app model

2009-10-16 Thread Zilva

Find way

models.py

.
uid= models.IntegerField(blank = True, null = True, ...


admin.py


class Media:
js = (
'js/jquery.min.js',
'js/us.js'
)


us.js

$(document).ready(function(){
$(".form-row.uid").css("display","none");
u=$("#uid").attr("value");
$("#id_uid").attr("value",u);
});

in  /django/contrib/admin/templates/admin/base.html

add 

that`s  work :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---