why i cannot load css from django lib?

2011-08-20 Thread smith jack
face a strange problem, now i am using django.contrib.admin module
with its default page, but i cannot load css code now, so the web page
is ugly
what's 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.



DB based translations?

2011-08-20 Thread Joshua Russo
Ok, I've been looking into the different database based translation 
solutions out there and I can't find what I really had in mind. I need to 
have non-technical people easily update the translations. So I wanted a 
solution where I could create an interface to ease the process.

One problem is that none of the solutions seem to talk about translating 
static text. I'm thinking I need to create a site_content table to handle my 
static text translations and then use one of these solutions against it. 

If this is an appropriate solution, what are people's experience with the 
different database driven translation solutions? I tried 
django_multilingual, and django_multilingual_ng but they seemed to have 
issues with South. (Of course that was a few months back and I can't 
remember the exact problems I was having.) I'm now looking at 
django_modeltranslation, but none of these products really give the 
impression of being production worthy.

I'm willing to give them a shot because I need something and it's small 
enough project that I can take a little more risk. What are people's 
experience with them?

Thanks in advance
Josh

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

2011-08-20 Thread kenneth gonsalves
On Sat, 2011-08-20 at 17:03 -0700, Christian Ramsey wrote:
> Thank you for your response, I was trying to explain it in detail, I
> believe I get the greater whole of the project which I've specified by
> explaining the project but the parts I don't I've asked a question
> about. Maybe my approach is incorrect, I did not mean that my
> informative parts were suppose to be answered but again merely a poke
> at trying not to be short, but thank you, I will read the Prepare the
> question section and see if I can recreate my collection of queries in
> a refined way in which I hope you and everyone else would consider
> "industrious" and possibly feel the ability to help rather than to
> lecture.

also read something about normal forms, as your question is not so much
django related as rdbms related. Hint: look at foreign keys.
-- 
regards
Kenneth Gonsalves

-- 
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: Port of Django Template Language to PHP

2011-08-20 Thread kenneth gonsalves
On Sat, 2011-08-20 at 21:28 +0200, Masklinn wrote:
> > Those of you moonlighting in PHP, might be interested in a pure PHP
> > port of the Django Template Language that I've just released. It's
> > called Chano and has doc pages at http://chano.readthedocs.org and a
> > github account at https://github.com/runekaagaard/php-chano .
> This sounds like a huge duplication of effort: there's already
> Twig[0],
> a port of Jinja2[1] which is basically a reimplementation and
> extension
> of Django's own templating language. 

if people did not keep reinventing the wheel we would be still in the
age of oxcarts.
-- 
regards
Kenneth Gonsalves

-- 
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: Missing datepicker in Django 1.3 admin

2011-08-20 Thread kenneth gonsalves
On Sat, 2011-08-20 at 20:49 +0300, Yaşar Arabacı wrote:
> Did you copy admin static files to your static path? They are stored
> in {DJANGO_ROOT_DIR}/contrib/admin/media . You need to copy all of
> them to {YOUR_STATIC_ROOT}/admin
> 
> 

or do collectstatic
-- 
regards
Kenneth Gonsalves

-- 
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: Missing datepicker in Django 1.3 admin

2011-08-20 Thread kenneth gonsalves
On Sat, 2011-08-20 at 10:40 -0700, George wrote:
> Yep, that's what I did .. ADMIN_MEDIA_PREFIX = '/static/admin/'  ...
> was there by default. It does't show even with a new Project! 

ADMIN_MEDIA_PREFIX is not there in 1.3
-- 
regards
Kenneth Gonsalves

-- 
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: Missing datepicker in Django 1.3 admin

2011-08-20 Thread kenneth gonsalves
On Sat, 2011-08-20 at 03:40 -0700, George wrote:
> I commented that out .. I'm still not seeing the datepicker icons in
> admin! 

did you do python manage.py collectstatic?
-- 
regards
Kenneth Gonsalves

-- 
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 beginner question

2011-08-20 Thread Christian Ramsey
Hi and thank you so much,  this provided a ton of clarity, especially
the modelling of the order table with a foreign key to a user, I was
locked on thinking the user table needed to somehow have the orders
within it. But I see I needed to step back.

I've already started to implement all of this and I am trying to
understand the  additional table, if the Order table already contains
the user it belongs to, then what will the additional table be set
for, from my perspective would this be to keep the original order?

Thanks so much again.

On Aug 20, 6:10 pm, Gelonida N  wrote:
> On 08/21/2011 12:56 AM, Christian Ramsey wrote:
>
>
>
>
>
>
>
>
>
> > Hi I am a Django beginner and I am just getting into creating apps
> > with it, my goal was to create a simple
> > order application for practice. The app will be somewhat like this:
>
> > 1.A user will login or create an account.
> > 2.A user will order from a list of items and depending on the item it
> > may have size and/or type, some will have preset sizes and no type at
> > all.
> > 3. Upon purchase which for this demo will not have a monetary system
> > integrated, so as a replacement it will email the admin email with the
> > details and also display the order to them for printing once they are
> > finished.
> > 4. The user will be able to check his/her orders in which the admin
> > will be able to set to pending or shipped to each order
> > 5. The admin will also be able to view all orders from every user and
> > delete, edit, mark the details of the order.
>
> > Pretty straightforward I thought but I can't seem to wrap my head
> > around the models mostly and especially the product table.
>
> > For the products would I be creating an array of different orders and
> > a separate array of sizes in the controller and assigning that to the
> > form?
>
> > My 3 classes in my model are currently Users, Products, Orders
> > I am not sure how a order from the products is assigned to a user in
> > the database,
> > does the Users class need to have both products and orders inside of
> > it as a one to many for both?
>
> > So when I create the form that submits this information how does it
> > assign that order to that product to that user?
>
> I guess you could already start with the products and the users.
> This is what yuou need in any case and which allows you already to learn
> qutie some django.
> - Create the User and product Models and create either your own views or
> admin views such, that you can populate the Users and Product database.
>
> Then you could work on the view allowing a logged in user to select
> products to be put in the shopping cart.
>
> Only then you had to care about how to implement the shopping cart.
>
> I never implemented a shopping application and  what I suggest is very
> probably neither the most elegant nor the most efficient solution.
> But what is clear is, that you should use at least one table more.
>
> Example Suggestion:
>
> User: contains info about the user
>
> Product: info about a product and it's price (though price might be in a
> separate table)
>
> Order: Info about the order, which could be ForeignKey to a user, the
> order date, and perhaps payment status.
>
> And one table more, which would store one entry of a order:
> it would store a oeign Key to a Product, the selected amount and a
> ForeignKey to the order it belongs to.
>
> Hope this gave you some ideas of how to get started.

-- 
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 beginner question

2011-08-20 Thread Gelonida N
On 08/21/2011 12:56 AM, Christian Ramsey wrote:
> Hi I am a Django beginner and I am just getting into creating apps
> with it, my goal was to create a simple
> order application for practice. The app will be somewhat like this:
> 
> 1.A user will login or create an account.
> 2.A user will order from a list of items and depending on the item it
> may have size and/or type, some will have preset sizes and no type at
> all.
> 3. Upon purchase which for this demo will not have a monetary system
> integrated, so as a replacement it will email the admin email with the
> details and also display the order to them for printing once they are
> finished.
> 4. The user will be able to check his/her orders in which the admin
> will be able to set to pending or shipped to each order
> 5. The admin will also be able to view all orders from every user and
> delete, edit, mark the details of the order.
> 
> Pretty straightforward I thought but I can't seem to wrap my head
> around the models mostly and especially the product table.
> 
> For the products would I be creating an array of different orders and
> a separate array of sizes in the controller and assigning that to the
> form?
> 
> My 3 classes in my model are currently Users, Products, Orders
> I am not sure how a order from the products is assigned to a user in
> the database,
> does the Users class need to have both products and orders inside of
> it as a one to many for both?
> 
> So when I create the form that submits this information how does it
> assign that order to that product to that user?
> 

I guess you could already start with the products and the users.
This is what yuou need in any case and which allows you already to learn
qutie some django.
- Create the User and product Models and create either your own views or
admin views such, that you can populate the Users and Product database.

Then you could work on the view allowing a logged in user to select
products to be put in the shopping cart.

Only then you had to care about how to implement the shopping cart.

I never implemented a shopping application and  what I suggest is very
probably neither the most elegant nor the most efficient solution.
But what is clear is, that you should use at least one table more.


Example Suggestion:

User: contains info about the user

Product: info about a product and it's price (though price might be in a
separate table)

Order: Info about the order, which could be ForeignKey to a user, the
order date, and perhaps payment status.

And one table more, which would store one entry of a order:
it would store a oeign Key to a Product, the selected amount and a
ForeignKey to the order it belongs to.

Hope this gave you some ideas of how to get started.







-- 
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 beginner question

2011-08-20 Thread Christian Ramsey
Thank you Shawn, 

Thank you for your response, I was trying to explain it in detail, I believe I 
get the greater whole of the project which I've specified by explaining the 
project but the parts I don't I've asked a question about. Maybe my approach is 
incorrect, I did not mean that my informative parts were suppose to be answered 
but again merely a poke at trying not to be short, but thank you, I will read 
the Prepare the question section and see if I can recreate my collection of 
queries in a refined way in which I hope you and everyone else would consider 
"industrious" and possibly feel the ability to help rather than to lecture.

Cheers.
On 20 Aug 2011, at 16:39, Shawn Milochik wrote:

> Christian,
> 
> We understand that you're a beginner, and there are a lot of people that are 
> willing to help people new to Django on this list. However, you've basically 
> laid out an assignment here and asked how to go about it.
> 
> That comes across as asking others to do your work for you. You won't find 
> much assistance when you give the appearance of being either incompetent or 
> lazy, which is how this comes across.
> 
> The best way to learn is by doing, so go start your project. Get as far as 
> you can, and when you have a specific question explain how you got stuck and 
> what you tried to fix it. Then I'm sure you'll get useful replies.
> 
> Please read the "Prepare the question" section here:
> https://code.djangoproject.com/wiki/UsingTheMailingList
> 
> Your initial e-mail violates nearly every tip listed. That list was compiled 
> specifically to allow people who want help to get the most out of this list, 
> and for those who enjoy helping others to avoid wasting their time.
> 
> Shawn
> 
> -- 
> 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.
> 

-- 
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 beginner question

2011-08-20 Thread Shawn Milochik

Christian,

We understand that you're a beginner, and there are a lot of people that 
are willing to help people new to Django on this list. However, you've 
basically laid out an assignment here and asked how to go about it.


That comes across as asking others to do your work for you. You won't 
find much assistance when you give the appearance of being either 
incompetent or lazy, which is how this comes across.


The best way to learn is by doing, so go start your project. Get as far 
as you can, and when you have a specific question explain how you got 
stuck and what you tried to fix it. Then I'm sure you'll get useful replies.


Please read the "Prepare the question" section here:
https://code.djangoproject.com/wiki/UsingTheMailingList

Your initial e-mail violates nearly every tip listed. That list was 
compiled specifically to allow people who want help to get the most out 
of this list, and for those who enjoy helping others to avoid wasting 
their time.


Shawn

--
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 beginner question

2011-08-20 Thread Christian Ramsey
Hi I am a Django beginner and I am just getting into creating apps
with it, my goal was to create a simple
order application for practice. The app will be somewhat like this:

1.A user will login or create an account.
2.A user will order from a list of items and depending on the item it
may have size and/or type, some will have preset sizes and no type at
all.
3. Upon purchase which for this demo will not have a monetary system
integrated, so as a replacement it will email the admin email with the
details and also display the order to them for printing once they are
finished.
4. The user will be able to check his/her orders in which the admin
will be able to set to pending or shipped to each order
5. The admin will also be able to view all orders from every user and
delete, edit, mark the details of the order.

Pretty straightforward I thought but I can't seem to wrap my head
around the models mostly and especially the product table.

For the products would I be creating an array of different orders and
a separate array of sizes in the controller and assigning that to the
form?

My 3 classes in my model are currently Users, Products, Orders
I am not sure how a order from the products is assigned to a user in
the database,
does the Users class need to have both products and orders inside of
it as a one to many for both?

So when I create the form that submits this information how does it
assign that order to that product to that user?

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



Admin TabularInline collapsed fieldset missing expand button

2011-08-20 Thread Lee
I need to display TabularInlines for multiple related tables and have
them all initially collapsed. I overrided admin/edit_line/tabular.html
and added the "collapsed" class to the  element. This
collapses the fieldset alright, but there is no button/control to
expand it. I've googled for hours and see related posts but no
solution.

Thanks for any help.

Lee

-- 
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: What I am missing is this Django "logout"?

2011-08-20 Thread Subhranath Chunder
> Welcome {{ request.user.username }}. Logout

This part of your code is generating a logout URL like this in your
template: "/logout/directorio"
Now, your urls.py has the pattern:
url(r'^logout/(?P.*)/$',
'django.contrib.auth.views.logout', name='auth_logout_next'),

This makes, the variable 'next_page' assign the value after the slash
'login/' section. i.e. next_page = 'directorio'
Now, the logout view is invoked and it's code gets executed. But since you
provided a relative url value to this view, a http 302 is issued to the
client to fetch the new url. Formed as a result of joining you current url
and the relative path. i.e. '/login/directorio/directorio'. Which is
basically again matching with the last url pattern. So, this whole thing
keeps on going in a loop where:
'/logout/directorio' is requested the first time. In response, the client is
requested to fetch url,
'/logout/directorio/directorio' the second time...
'/logout/directorio/directorio/directorio/directorio' the third time...
and so on and on in a loop.

This is why you never see the expected output in the page. The actual logout
is done in the first request only.

So, when you refresh the page, you are basically pre-empting your browser
client to break the initial loop, and manually requesting for the new fetch
request.

I hope I was able to clear the reason behind the outcome you were
experiencing.



On Sat, Aug 20, 2011 at 2:39 PM, Andre Lopes  wrote:

> I am new to Django, and I am trying to put the logout to work...
>
> I have installed the an App called, Django-Registration.
>
> My problem is that I can do the logout, but the page does not get
> refreshed, I must to press F5 after the logout to see the page for not
> logged users.
>
> What I have done is the following:
>
> urls.py, added to urlpatterns:
> [code]
> url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page':
> '/'}, name='auth_logout'),
> url(r'^logout/(?P.*)/$',
> 'django.contrib.auth.views.logout', name='auth_logout_next'),
> [/code]
>
> In the template I have this code:
> [code]
> {% if request.user.is_authenticated %}
>Welcome {{ request.user.username }}. Logout
> {% else %}
>Welcome. Please login or  href="/accounts/register/">register
> {% endif %}
> [/code]
>
> When I click Logout I dont see this in the screen:
> [code]
> Welcome. Please login or  href="/accounts/register/">register
> [/code]
>
> I only see this text if I use F5 to refresh the page.
>
> What I am missing here?
>
> Please give me a clue.
>
> Best Regards,
>
> --
> 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.
>
>


-- 
Thanks,
Subhranath Chunder.
www.subhranath.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: extending the User profile - which way to go?

2011-08-20 Thread Subhranath Chunder
My suggestion, do it the Django way. In any case, even if you use the
inheritance model, the additional data would be stored in a separate
database table, and the data belonging to the super-class would be stored in
the main user's database table.


On Sun, Aug 21, 2011 at 1:26 AM, Axel Bock
wrote:

> Hi again,
>
> I will need to add some properties to a user in the future. Now I found two
> ways of doing it. First, the Django-way (as described in the Django 
> docs).
> Then I found some other posts from other people, all doing an inheritance of
> the original User-class and using this one. That seems rather elegant, cause
> there is one database lookup less necessary per user lookup. Now I want to
> go a way which is most "Djangonic" - cause I don't want to be stuck
> somewhere in the future with something that breaks on Django 1.4 or
> whatever.
>
> Any recommendations from the users here?
>
>
> Thanks in advance!
> Axel.
>
> --
> 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.
>



-- 
Thanks,
Subhranath Chunder.
www.subhranath.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.



extending the User profile - which way to go?

2011-08-20 Thread Axel Bock
Hi again,

I will need to add some properties to a user in the future. Now I found two 
ways of doing it. First, the Django-way (as described in the Django docs). Then 
I found some other posts from other people, all doing an inheritance of the 
original User-class and using this one. That seems rather elegant, cause there 
is one database lookup less necessary per user lookup. Now I want to go a way 
which is most "Djangonic" - cause I don't want to be stuck somewhere in the 
future with something that breaks on Django 1.4 or whatever.

Any recommendations from the users here? 


Thanks in advance!
Axel.

-- 
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: Port of Django Template Language to PHP

2011-08-20 Thread Masklinn
On 2011-08-20, at 20:30 , Rune Kaagaard wrote:
> Dear Django Users
> 
> Those of you moonlighting in PHP, might be interested in a pure PHP
> port of the Django Template Language that I've just released. It's
> called Chano and has doc pages at http://chano.readthedocs.org and a
> github account at https://github.com/runekaagaard/php-chano .
This sounds like a huge duplication of effort: there's already Twig[0],
a port of Jinja2[1] which is basically a reimplementation and extension
of Django's own templating language.

So, basically, if people want Django's templates in PHP they can
already use Twig.

[0] http://www.twig-project.org/
[1] http://jinja.pocoo.org/docs/

-- 
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: I need help with reverse and url patterns

2011-08-20 Thread Daniel Roseman
On Saturday, 20 August 2011 20:20:12 UTC+1, Joshua Russo wrote:
>
> I setup this patter in url.py
>
> url(r'^events/(?P\d{4})/(?P\d{2})/$', events, 
> name="eventsMonth")
>
> in my template I have this tag
>
> {% url eventsMonth year=month.prev.year month=month.prev.month %}
>
> but I keep getting 
>
> Caught NoReverseMatch while rendering: Reverse for 'eventsMonth' with 
> arguments '()' and keyword arguments '{'month': 7, 'year': 2011}' not found.
>
> I traced the problem into the reverse() code and the logic goes all the way 
> to the end, when the following statement from line 325 of 
> core/urlresolvers.py fails and I can't figure out why
>
> if re.search(u'^%s' % pattern, candidate, re.UNICODE):
>
> The pattern is 
> 'events/(?P\\d{4})/(?P\\d{2})/$'
> and the candidate is 
> u'events/2011/7/'
>
> Why doesn't that regular expression match? What am I doing wrong?
>


Because there's only one digit in the month (7), and it's expecting two. 

Either change your code to pad the month to two digits, or change the regex 
to /(?P\d{1,2})/$

--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/588gFtIFPKUJ.
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: I need help with reverse and url patterns

2011-08-20 Thread Joshua Russo
Never mind I got it. I changed my url patter to 

url(r'^events/(?P\d{4})/(?P\d{1,2})/$', events, 
name="eventsMonth")

I'm still not very sharp on my regex skills. I realized that {2} required a 
2 digit number

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



I need help with reverse and url patterns

2011-08-20 Thread Joshua Russo
I setup this patter in url.py

url(r'^events/(?P\d{4})/(?P\d{2})/$', events, 
name="eventsMonth")

in my template I have this tag

{% url eventsMonth year=month.prev.year month=month.prev.month %}

but I keep getting 

Caught NoReverseMatch while rendering: Reverse for 'eventsMonth' with 
arguments '()' and keyword arguments '{'month': 7, 'year': 2011}' not found.

I traced the problem into the reverse() code and the logic goes all the way 
to the end, when the following statement from line 325 of 
core/urlresolvers.py fails and I can't figure out why

if re.search(u'^%s' % pattern, candidate, re.UNICODE):

The pattern is 
'events/(?P\\d{4})/(?P\\d{2})/$'
and the candidate is 
u'events/2011/7/'

Why doesn't that regular expression match? What am I doing wrong?

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

2011-08-20 Thread Yaşar Arabacı
Wow, this is definitely going into my blog :) Keep up the good work!

2011/8/20 Rune Kaagaard 

> Dear Django Users
>
> Those of you moonlighting in PHP, might be interested in a pure PHP
> port of the Django Template Language that I've just released. It's
> called Chano and has doc pages at http://chano.readthedocs.org and a
> github account at https://github.com/runekaagaard/php-chano .
>
> Thanks for your time!
> Rune Kaagaard
>
> --
> 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.
>
>

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



Port of Django Template Language to PHP

2011-08-20 Thread Rune Kaagaard
Dear Django Users

Those of you moonlighting in PHP, might be interested in a pure PHP
port of the Django Template Language that I've just released. It's
called Chano and has doc pages at http://chano.readthedocs.org and a
github account at https://github.com/runekaagaard/php-chano .

Thanks for your time!
Rune Kaagaard

-- 
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: Random File Path

2011-08-20 Thread Ulisses Dias
Hey Shawn,

   Thanks, it is working like charm.

Best regards,
Ulisses Dias

2011/8/20 Shawn Milochik 

> The reason it's generating the same one every time is that the code as
> written executes when Django starts and that name is kept until you restart
> your Django process.
>
> You can use a lambda to fix that in general
>
> Example:
>
>wrong:
>#all records get the datetime the Django process was launched
>created_date = models.DateTimeField(default = datetime.now())
>
>right (ignoring the auto_now_add shortcut):
>#datetime.now() will be executed each time an instance is created
>#you can also forgo the lambda and the parentheses, and just use
> datetime.now,
>#because it's callable
>created_date = models.DateTimeField(default = lambda:
> datetime.now())
>
> According to the Django docs you can do this with upload_to as well:
> https://docs.djangoproject.**com/en/1.3/ref/models/fields/#**filefield
>"This may also be a callable, such as a function, which will be called
> to obtain the upload path, including the filename"
>
> Rather than using random, I recommend using the tempfile module in Python's
> standard library:
> http://docs.python.org/**library/tempfile
>
> You can use mkdtemp to create a unique directory and mkstemp to create a
> filename if you want that to be unique as well. That will ensure your random
> path doesn't accidentally overwrite any other.
> Don't be fooled by the 'temp' part; you're free to provide a starting path
> for all "temp" directories (including in your 'uploads' folder), and they're
> not deleted automatically, so you can keep them permanently or prune them as
> needed. If you don't care you can use gettempdir and it'll put the file in
> your OS's default temp folder (probably /tmp) and it'll be removed on reboot
> (or by you manually).
>
>
>
>
>
> --
> 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+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

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



Suspicious mail from django-users mail group

2011-08-20 Thread Yaşar Arabacı
Hi,

I got a mail, which I suspect that might be some kind of personal
information stealing thingy. It askes me enable images or click some links.
Does anyone else got similiar mails? I am attaching original mail. I tried
to locate the sender, but, couldn't find the exact location.

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




   
Delivered-To: yasar11...@gmail.com
Received: by 10.231.42.197 with SMTP id t5cs29774ibe;
Sat, 20 Aug 2011 10:50:05 -0700 (PDT)
Received: by 10.101.132.12 with SMTP id j12mr641579ann.157.1313862604374;
Sat, 20 Aug 2011 10:50:04 -0700 (PDT)
Return-Path: 
Received: from www29.interneet.com (www29.interneet.com [64.124.221.251])
by mx.google.com with ESMTP id s29si5958100anh.1.2011.08.20.10.50.04;
Sat, 20 Aug 2011 10:50:04 -0700 (PDT)
Received-SPF: neutral (google.com: 64.124.221.251 is neither permitted nor 
denied by domain of django-users@googlegroups.com) client-ip=64.124.221.251;
Authentication-Results: mx.google.com; spf=neutral (google.com: 64.124.221.251 
is neither permitted nor denied by domain of django-users@googlegroups.com) 
smtp.mail=django-users@googlegroups.com
Date: Sat, 20 Aug 2011 10:50:04 -0700 (PDT)
Message-Id: <4e4ff3cc.1df5640a.772c.997fsmtpin_ad...@mx.google.com>
Received: from localhost (unknown [192.168.30.184])
by www29.interneet.com (Postfix) with ESMTP id A86C6A84008
for ; Sat, 20 Aug 2011 10:50:03 -0700 (PDT)
From: django-users@googlegroups.com
To: =?ISO-8859-9?Q?Ya=FEar_Arabac=FD?= 
Subject: Re: 
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8

I am out of office right now on a short vacation and will get back 
to you when I return. If you don't hear from me, my assistant should contact 
you shortly.  You should check this site to see how I scored the best travel 
deal for my trip..Click
 HereEnable images or click
 hereLet me know what you think after you have a chance to 
review.Cheers!
 If you no longer wish to receive emails, please unsubscribe866-288-18805150 yarmouth ave, 
Encino, CA 91316On , =?ISO-8859-9?Q?Ya=FEar_Arabac=FD?= 
 wrote:

Re: Missing datepicker in Django 1.3 admin

2011-08-20 Thread Yaşar Arabacı
Did you copy admin static files to your static path? They are stored in
{DJANGO_ROOT_DIR}/contrib/admin/media . You need to copy all of them to
{YOUR_STATIC_ROOT}/admin

2011/8/20 George 

> Yep, that's what I did .. ADMIN_MEDIA_PREFIX = '/static/admin/'  ...
> was there by default. It does't show even with a new Project!
>
> On Aug 20, 9:39 pm, Yaşar Arabacı  wrote:
> > If that is what kenneth says, I might suggest creating a new project and
> see
> > default settings for static files. it might help you figure out what is
> > going on.
> >
> > 2011/8/20 George 
> >
> >
> >
> >
> >
> >
> >
> > > Thanks Kenneth
> >
> > > I commented that out .. I'm still not seeing the datepicker icons in
> > > admin!
> >
> > > On Aug 20, 2:51 pm, kenneth gonsalves  wrote:
> > > > On Sat, 2011-08-20 at 01:53 -0700, George wrote:
> > > > > ADMIN_MEDIA_PREFIX = '/static/admin/'
> >
> > > > this does not exist in 1.3 - please read the docs on
> > > > django.contrib.staticfiles
> > > > --
> > > > regards
> > > > Kenneth Gonsalves
> >
> > > --
> > > 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.
>
> --
> 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.
>
>

-- 
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: Missing datepicker in Django 1.3 admin

2011-08-20 Thread George
Yep, that's what I did .. ADMIN_MEDIA_PREFIX = '/static/admin/'  ...
was there by default. It does't show even with a new Project!

On Aug 20, 9:39 pm, Yaşar Arabacı  wrote:
> If that is what kenneth says, I might suggest creating a new project and see
> default settings for static files. it might help you figure out what is
> going on.
>
> 2011/8/20 George 
>
>
>
>
>
>
>
> > Thanks Kenneth
>
> > I commented that out .. I'm still not seeing the datepicker icons in
> > admin!
>
> > On Aug 20, 2:51 pm, kenneth gonsalves  wrote:
> > > On Sat, 2011-08-20 at 01:53 -0700, George wrote:
> > > > ADMIN_MEDIA_PREFIX = '/static/admin/'
>
> > > this does not exist in 1.3 - please read the docs on
> > > django.contrib.staticfiles
> > > --
> > > regards
> > > Kenneth Gonsalves
>
> > --
> > 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.

-- 
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: Specific models without a database table

2011-08-20 Thread sedl...@gmail.com
Hi,
you may use custom model manager (responsible for retrieving objects
from DB) and custom save method (which would not call Model.save),
together with managed=True.

You may still face some issues, however I think this should be
possible.

Cheers,
Filip

On 20 srp, 12:51, Malcolm Box  wrote:
> On 20 August 2011 02:33, Kristofer Pettijohn wrote:
>
> > Hello,
>
> > Is it possible to create specific models without a database table?
>
> Yes, it's possible. You want the "managed" attribute on the model - 
> seehttps://docs.djangoproject.com/en/1.3/ref/models/options/#managed
>
> This will prevent Django from creating or modifying the db table
>
> > Basically what I would like to do is create an email account management
> > application that ties into my existing mail server and its API.  I would
> > like Django to have a Users model and keep track of users, a Domains model
> > to keep track of the email domains for the user, but I don't want it to
> > actually keep track of email addresses.  Once the user is in the
> > application, they will go into the "EmailAccount" model and I simply want
> > the model to query my mail server via its SOAP API.  So when they
> > create/delete/edit email accounts, there will be form pages and simple
> > validation done by Django, but the actual work will be done by connecting to
> > the mail servers API and not a database.
>
> Is this possible?
>
> That is substantially harder, but could be possible. The main problem is
> that the Django ORM will want to write SQL queries when there's a link to
> the EmailAccount model.
>
> Your best bet is probably a proxy model that contains a reference to the
> relevant API record (e.g. the email address identifier or whatever the API
> uses), and then a custom save() method that writes the values out to the DB.
> You can use the Django form logic etc without it needing to be backed by a
> model.
>
> It will largely depend on how you want the EmailAccount to look - the closer
> you want it to work to a standard ORM model, the more work you'll have to do
> to trick things. If it's a simple field that isn't used for queries, then
> you could look at creating a custom field type that knows how to read/write
> the values to the API.
>
> All the above advice is worth exactly what you paid for it!
>
> Malcolm

-- 
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: Missing datepicker in Django 1.3 admin

2011-08-20 Thread Yaşar Arabacı
If that is what kenneth says, I might suggest creating a new project and see
default settings for static files. it might help you figure out what is
going on.

2011/8/20 George 

> Thanks Kenneth
>
> I commented that out .. I'm still not seeing the datepicker icons in
> admin!
>
> On Aug 20, 2:51 pm, kenneth gonsalves  wrote:
> > On Sat, 2011-08-20 at 01:53 -0700, George wrote:
> > > ADMIN_MEDIA_PREFIX = '/static/admin/'
> >
> > this does not exist in 1.3 - please read the docs on
> > django.contrib.staticfiles
> > --
> > regards
> > Kenneth Gonsalves
>
> --
> 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.
>
>

-- 
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: View-Voodoo: Calling functions in a view does weird things

2011-08-20 Thread Axel Bock

I am _*SO*_ stupid. and equally embarrassed right now. 
oh boy. 
thank you so much.





Am 20.08.2011 um 18:07 schrieb Yaşar Arabacı:

> Do it like this:
> 
> def myview(request):
>if request.method =="POST":
>return call_my_other_func(request)
>else: rtr("index.html")
> 
> def call_my_other_func(request):
># do something with the data
>messages.info(request, "hello world")
>return rtr("index.html", context_instance=RequestContext())
> 
> 2011/8/20 dm03514 
> I think you're 'call_my_other_function' is returning to the 'myview'
> function
> 
> --
> 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.
> 
> 
> 
> -- 
> 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.

-- 
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: View-Voodoo: Calling functions in a view does weird things

2011-08-20 Thread Yaşar Arabacı
Do it like this:

def myview(request):
   if request.method =="POST":
   return call_my_other_func(request)
   else: rtr("index.html")

def call_my_other_func(request):
   # do something with the data
   messages.info(request, "hello world")
   return rtr("index.html", context_instance=RequestContext())

2011/8/20 dm03514 

> I think you're 'call_my_other_function' is returning to the 'myview'
> function
>
> --
> 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.
>
>

-- 
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: Best approach to handling different types of Users

2011-08-20 Thread Cameron

> I hear this a lot that "things will break" if you subclass User. However, I
> haven't seen anyone share a concrete example of *how* things go wrong.
>
> Anyone got a good example to scare the children with?
>
> Malcolm

Yeh, I've heard this quite a bit as well. An example of a scenario
this really catchs you out would be great.

-- 
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 Admin - relationship between different models

2011-08-20 Thread Petey
Hi,

I have two models:
- Publisher - my main model
- Images - additional model for images
http://pastebin.com/VUNCzDye

In images model I have a link generator which displays absolute path for 
uploaded images.

I use inline to add images for messages. I want to display admin_tumbnail 
function as readonly_field and list_display in my news.

How I can do it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/SvPVo0eF4T0J.
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: View-Voodoo: Calling functions in a view does weird things

2011-08-20 Thread dm03514
I think you're 'call_my_other_function' is returning to the 'myview'
function

-- 
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: login auth issue - beginner

2011-08-20 Thread dm03514
Hi, Your traceback is from a 'login' function buy you're posting to
base '/'
Could that be an issue??
The traceback clearly explains what the problem is, no data is
arriving at your login function

-- 
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: login auth issue - beginner

2011-08-20 Thread Phil
Thanks for reply. 

Yes my form is using POST. Here is my template file...

{% block content %}

  {% if form.errors %}
Sorry, that's not a valid username or password
  {% endif %}

  
User name:

Password:




  

{% endblock %}

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



View-Voodoo: Calling functions in a view does weird things

2011-08-20 Thread Axel Bock
Hi all,

I am new to this list (hello btw :), a beginner of Django, and I have
discovered a _very_ strange thing. Basicall I have a view handling a
file upload (see shortened code below). Depending on a select field a
function gets called handling the stuff, and returning. (rtr =
render_to_response). Now. The handler function sets a message.

That does not work.

But. If I copy-and-paste the code of the function
"call_my_other_function" into the if-block in myview, it does.

I don't get it - at all. Can someone please explain?

Thanks in advance & greetings,
Axel.


def myview(request):
if request.method =="POST":
call_my_other_func(request)
else: rtr("index.html")

def call_my_other_func(request):
# do something with the data
messages.info(request, "hello world")
return rtr("index.html", context_instance=RequestContext())

-- 
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: Missing datepicker in Django 1.3 admin

2011-08-20 Thread George
Thanks Kenneth

I commented that out .. I'm still not seeing the datepicker icons in
admin!

On Aug 20, 2:51 pm, kenneth gonsalves  wrote:
> On Sat, 2011-08-20 at 01:53 -0700, George wrote:
> > ADMIN_MEDIA_PREFIX = '/static/admin/'
>
> this does not exist in 1.3 - please read the docs on
> django.contrib.staticfiles
> --
> regards
> Kenneth Gonsalves

-- 
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: login auth issue - beginner

2011-08-20 Thread Scott Danzig
It reports you're missing the key "username" from your POST... so the first 
thing I'd check for is ... do you have a line like this in your login 
template page?:

 

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

2011-08-20 Thread Phang Mulianto
hi.. your request is  GET, and you try get the query data with POST .

this the errror cause
16. username = request.POST['username']

Exception Value: "Key 'username' not found in "

check your login form to use POST..

HTH,

Mulianto


On Sat, Aug 20, 2011 at 9:59 PM, Phil  wrote:

> Hi,
>
> I am new to Django and am trying to use the built in auth features for the
> first time. I have been following the steps on the djangobook website
> here...
>
> http://www.djangobook.com/en/1.0/chapter12/
>
> However I am getting the following error on my login page. Anyone know
> where I am going wrong?...
>
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://127.0.0.1:8080/login/
>
> Django Version: 1.3
> Python Version: 2.7.1
> Installed Applications:
> ['django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'django.contrib.admin',
> 'django.contrib.admindocs',
> 'healthapp',
> 'healthapp.myhealth']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
> in get_response
> 111. response = callback(request, *callback_args, **callback_kwargs)
> File "/home/phil/mydev/projects/healthapp/../healthapp/views.py" in login
> 16. username = request.POST['username']
> File
> "/usr/local/lib/python2.7/dist-packages/django/utils/datastructures.py" in
> __getitem__
> 256. raise MultiValueDictKeyError("Key %r not found in %r" % (key, self))
>
> Exception Type: MultiValueDictKeyError at /login/
> Exception Value: "Key 'username' not found in "
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/9zw1FCvQ33kJ.
> 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.
>

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



Model Inheritance and methods

2011-08-20 Thread CrabbyPete
I have the following models:

class Deal(models.Model):
"""
Deal is a deal for  Interest. There should only be one
deal for each Interest pair
"""
interest = models.ForeignKey( Interest )
max_sell = models.IntegerField(default = 1)

def terms(self):
return self.term_set.all()

class Term( models.Model ):
"""
A Term are the terms of a Deal. There can be many Terms for each
Deal
"""
deal  = models.ForeignKey( Deal )
canceled  = models.BooleanField(default = False)
cost  = models.CharField( max_length = 10, blank = True, null
= True )
buyer = models.ForeignKey( User, blank = True, null = True )

def execute(self, **kwargs):
pass

class Expire( Term ):
"""
Subclass of Term that is good until an expiration date
"""
date= models.DateField()

def execute(self):
if self.buyer == None or self.canceled:
return False

delta = self.date - date.today()
if delta.days >= 0:
return True
return False

def __unicode__(self, **kwargs):
return ''

class Cancel( Term ):
"""
Subclass of Term that the Term is good until canceled
"""
def execute(self):
if self.buyer == None or self.canceled:
return False
return True

def __unicode__(self):
return ''


I want to do the following:
for term in deal.terms()
 if term.execute():
do something


My thought was the term.execute method would be overridden and the
type of term, either cancel's or expire's execute method would occur,
but it only executes the term.execute()

I can get around it by having the following as the term execute, but
its ugly
def execute(self):
try:
   term.cancel.execute()
except:
   pass
try:
  term.expire.execute()
except:
   pass

Any suggestions?

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



login auth issue - beginner

2011-08-20 Thread Phil
Hi, 

I am new to Django and am trying to use the built in auth features for the 
first time. I have been following the steps on the djangobook website 
here... 

http://www.djangobook.com/en/1.0/chapter12/ 

However I am getting the following error on my login page. Anyone know where 
I am going wrong?... 


Environment: 


Request Method: GET 
Request URL: http://127.0.0.1:8080/login/ 

Django Version: 1.3 
Python Version: 2.7.1 
Installed Applications: 
['django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.sites', 
'django.contrib.messages', 
'django.contrib.staticfiles', 
'django.contrib.admin', 
'django.contrib.admindocs', 
'healthapp', 
'healthapp.myhealth'] 
Installed Middleware: 
('django.middleware.common.CommonMiddleware', 
'django.contrib.sessions.middleware.SessionMiddleware', 
'django.middleware.csrf.CsrfViewMiddleware', 
'django.contrib.auth.middleware.AuthenticationMiddleware', 
'django.contrib.messages.middleware.MessageMiddleware') 


Traceback: 
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
in get_response 
111. response = callback(request, *callback_args, **callback_kwargs) 
File "/home/phil/mydev/projects/healthapp/../healthapp/views.py" in login 
16. username = request.POST['username'] 
File "/usr/local/lib/python2.7/dist-packages/django/utils/datastructures.py" 
in __getitem__ 
256. raise MultiValueDictKeyError("Key %r not found in %r" % (key, self)) 

Exception Type: MultiValueDictKeyError at /login/ 
Exception Value: "Key 'username' not found in " 

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



unique_together constraint on a ForeignKey field in MySQL

2011-08-20 Thread Alex
I asked this originally on StackOverflow, but I realized you guys
might have more experience with these gnarly edge cases:

http://stackoverflow.com/questions/7131639/how-can-i-have-a-unique-together-constraint-involving-a-foreignkey-field-in-mysql

Thanks for your consideration,
-- Alex Ogier

-- 
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: Best approach to handling different types of Users

2011-08-20 Thread Malcolm Box
On 19 August 2011 03:37, Andre Terra  wrote:

> Until you install some third party app that accesses
> User.objects.all() and then suddenly nothing works as it's supposed
> to.
>
>
I hear this a lot that "things will break" if you subclass User. However, I
haven't seen anyone share a concrete example of *how* things go wrong.

Anyone got a good example to scare the children with?

Malcolm

-- 
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 Test Corrupted Test Data

2011-08-20 Thread Malcolm Box
According to the SO post, you're seeing TestObject.objects.all().count()
return two different values on successive calls.

That is basically impossible unless there's something else getting in there
and doing stuff to your db.

Alternatively, does your subclass of TestCase correctly call
super(MyTestCase, self).setUp() and other superclass methods to get the DB
setup right?

Malcolm

On 19 August 2011 22:05, patjenk  wrote:

> As I understand it, the database should be reset between each test. To
> me this means that unless the variable being examined is an attribute
> of self, the tests shouldn't affect each other.
>
> Could it be possible that there is a sqllite subtly that delays the
> reset of the table count and it affects the outcome of the test in
> this instance?
>
> On Aug 19, 3:43 pm, bik...@gmail.com wrote:
> > Could it be that the tests affect each other (when ran in a series)?
> >
> > Sent from my BlackBerry® from Vodafone
> >
> > -Original Message-
> > From: dm03514 
> >
> > Sender: django-users@googlegroups.com
> > Date: Fri, 19 Aug 2011 12:13:24
> > To: Django users
> > Reply-To: django-users@googlegroups.com
> > Subject: Django Test Corrupted Test Data
> >
> > I have a test class that subclasses django.test.TestCase which has
> > about 5 different tests in it. When I run my full test suite (using
> > nose, and specifying sqlite as backend) there are a series of
> > failures. When I go to debug the tests, running them individually,
> > they pass fine.
> >
> > http://stackoverflow.com/questions/7126172/django-testrunner-incorrec...
> >
> > --
> > 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 athttp://
> groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-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.
>
>


-- 
Malcolm Box
malcolm@gmail.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: how to invalidate per-view cache?

2011-08-20 Thread Malcolm Box
On 19 August 2011 23:32, galgal  wrote:

> I want to use per-view 
> cache.
> I know how it's working, but where's the problem? How can I invalidate that
> cache? I must do it each time database records are changed. There is no info
> about how to do that:/


You'll need to use the low-level cache API to invalidate the individual
cache entries. Hook up a post_save handler to your model, figure out the
key(s) for the views affected and use cache.delete() to remove the entry.

Malcolm


-- 
Malcolm Box
malcolm@gmail.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: Specific models without a database table

2011-08-20 Thread Malcolm Box
On 20 August 2011 02:33, Kristofer Pettijohn wrote:

> Hello,
>
> Is it possible to create specific models without a database table?
>
>
Yes, it's possible. You want the "managed" attribute on the model - see
https://docs.djangoproject.com/en/1.3/ref/models/options/#managed

This will prevent Django from creating or modifying the db table


> Basically what I would like to do is create an email account management
> application that ties into my existing mail server and its API.  I would
> like Django to have a Users model and keep track of users, a Domains model
> to keep track of the email domains for the user, but I don't want it to
> actually keep track of email addresses.  Once the user is in the
> application, they will go into the "EmailAccount" model and I simply want
> the model to query my mail server via its SOAP API.  So when they
> create/delete/edit email accounts, there will be form pages and simple
> validation done by Django, but the actual work will be done by connecting to
> the mail servers API and not a database.
>
>
Is this possible?
>
>
That is substantially harder, but could be possible. The main problem is
that the Django ORM will want to write SQL queries when there's a link to
the EmailAccount model.

Your best bet is probably a proxy model that contains a reference to the
relevant API record (e.g. the email address identifier or whatever the API
uses), and then a custom save() method that writes the values out to the DB.
You can use the Django form logic etc without it needing to be backed by a
model.

It will largely depend on how you want the EmailAccount to look - the closer
you want it to work to a standard ORM model, the more work you'll have to do
to trick things. If it's a simple field that isn't used for queries, then
you could look at creating a custom field type that knows how to read/write
the values to the API.

All the above advice is worth exactly what you paid for it!

Malcolm

-- 
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: Regarding postgresql

2011-08-20 Thread Harjot Gill
Yes, i have installed it to the python that django is using. Yes i
have import it successfully.

-- 
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: Regarding postgresql

2011-08-20 Thread william ratcliff
Are you sure that you've installed it to the same python that django is
using?   Can you import it successfully?

On Sat, Aug 20, 2011 at 5:57 AM, Harjot Gill  wrote:

> >
> > the backend should be postgresql_psycopg2 and you should install
> > python-psycopg2.
> I have done this but error remains same.
> It shows me the same error after the installation of the python-psycopg2.
>
> --
> 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.
>
>

-- 
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: Regarding postgresql

2011-08-20 Thread kenneth gonsalves
On Sat, 2011-08-20 at 15:27 +0530, Harjot Gill wrote:
> > the backend should be postgresql_psycopg2 and you should install
> > python-psycopg2.
> I have done this but error remains same.
> It shows me the same error after the installation of the
> python-psycopg2. 

what distro are you running?
-- 
regards
Kenneth Gonsalves

-- 
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: Regarding postgresql

2011-08-20 Thread Harjot Gill
>
> the backend should be postgresql_psycopg2 and you should install
> python-psycopg2.
I have done this but error remains same.
It shows me the same error after the installation of the python-psycopg2.

-- 
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: Regarding postgresql

2011-08-20 Thread kenneth gonsalves
On Sat, 2011-08-20 at 14:31 +0530, Harjot Gill wrote:
> We have tried to make database of TCC software in postgresql instead
> of mysql. But we are facing a problem after creating the database for
> TCC when we are trying to make the tables by using command "python
> manage.py syncdb" then the following error will occur :
> no module named psycopg 

the backend should be postgresql_psycopg2 and you should install
python-psycopg2.
-- 
regards
Kenneth Gonsalves

-- 
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: Missing datepicker in Django 1.3 admin

2011-08-20 Thread kenneth gonsalves
On Sat, 2011-08-20 at 01:53 -0700, George wrote:
> ADMIN_MEDIA_PREFIX = '/static/admin/'

this does not exist in 1.3 - please read the docs on
django.contrib.staticfiles
-- 
regards
Kenneth Gonsalves

-- 
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_index.html" = i want to be in admin...

2011-08-20 Thread doniyor
thanks but these links are not for overriding the app_index.html in
order to show the APP in adminsite. i know how to override a template
but dont know how to override APP_INDEX.html which is supposed to show
my app in adminsite.

thanks for help in advance..



On 20 Aug., 04:31, Nan  wrote:
> > where should i change
>
> https://docs.djangoproject.com/en/dev/topics/templates/#template-inhe...
>
> > and where to put this file..?
>
> https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types

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



What I am missing is this Django "logout"?

2011-08-20 Thread Andre Lopes
I am new to Django, and I am trying to put the logout to work...

I have installed the an App called, Django-Registration.

My problem is that I can do the logout, but the page does not get
refreshed, I must to press F5 after the logout to see the page for not
logged users.

What I have done is the following:

urls.py, added to urlpatterns:
[code]
url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page':
'/'}, name='auth_logout'),
url(r'^logout/(?P.*)/$',
'django.contrib.auth.views.logout', name='auth_logout_next'),
[/code]

In the template I have this code:
[code]
{% if request.user.is_authenticated %}
Welcome {{ request.user.username }}. Logout
{% else %}
Welcome. Please login or register
{% endif %}
[/code]

When I click Logout I dont see this in the screen:
[code]
Welcome. Please login or register
[/code]

I only see this text if I use F5 to refresh the page.

What I am missing here?

Please give me a clue.

Best Regards,

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



Regarding postgresql

2011-08-20 Thread Harjot Gill
@ All
We have tried to make database of TCC software in postgresql instead
of mysql. But we are facing a problem after creating the database for
TCC when we are trying to make the tables by using command "python
manage.py syncdb" then the following error will occur :
no module named psycopg

Even we have installed this package but it shows the same error.

Anybody knows about it please 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.