Re: Access to data via many-to-many while in save()

2013-02-06 Thread Mike Dewhirst

On 7/02/2013 5:04pm, Derek wrote:

I am trying to access the field(s) of a Child table while still inside
the save method of the Parent table.

Assuming that the many-to-many field in the Parent table is called
`m2m_field`, and the field I need to access in the Child table is
called `child_field`, what I have tried is this:


What I think you need in the Parent model is access to the "through" 
table - say Parent_Child - which has a foreign key to both Parent and 
Child called Parent_Child.parent and Parent_Child.child respectively.


Like this ...

class Parent(models.Model):
child = models.ManyToManyField('Child',  through='Parent_Child')
#
..
def save(self, *args, **kwargs):
obj_qs = Parent_Child.objects.filter(parent=self)
# which gives you a query set to play with and extract obj
# or if you know the child object
# obj = Parent_Child.objects.get(parent=self, child=whatever)
# which gives you obj
# then ...
data_I_need = obj.thingummy
super(Parent, self).save(*args, **kwargs)

This is not necessarily the correct way to do things. I think there 
might be Django shortcut but I'm not immediately familiar with it. I'd 
have to read the query docs.


Mike



def save_model(self, request, obj, form, change):
 # save object and the many-to-many data
 obj.save()
 # this does not work:
 data_I_need = obj.m2m.all()[0].child_field
 # nor does this:
 data_I_need = Parent.objects.get(pk=obj.pk).m2m.all()[0].child_field
 # in fact, length is 0, so no data in the set...
 print len(Parent.objects.get(pk=obj.pk).m2m.all())

I know I am not grasping some key aspect of the problem; but I cannot
see what it is, and would appreciate any help with this problem!

Thanks
Derek



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




Re: Object level permissions implementation

2013-02-06 Thread Jani Tiainen

That's something I had in mind also.

And I think that is quite a best thing to do.

6.2.2013 18:09, bobhaugen kirjoitti:

I'm not sure this is the best way to do it, but for what I think is a
similar situation, I created a template tag and a model instance method.

The template tag asks the model instance method whether the user has
permission.

Here's the template tag:
https://github.com/bhaugen/localecon/blob/master/clusters/templatetags/permissions.py

Here's the instance method:
https://github.com/bhaugen/localecon/blob/master/clusters/models.py#L176

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




--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

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




Access to data via many-to-many while in save()

2013-02-06 Thread Derek
I am trying to access the field(s) of a Child table while still inside
the save method of the Parent table.

Assuming that the many-to-many field in the Parent table is called
`m2m_field`, and the field I need to access in the Child table is
called `child_field`, what I have tried is this:

def save_model(self, request, obj, form, change):
# save object and the many-to-many data
obj.save()
# this does not work:
data_I_need = obj.m2m.all()[0].child_field
# nor does this:
data_I_need = Parent.objects.get(pk=obj.pk).m2m.all()[0].child_field
# in fact, length is 0, so no data in the set...
print len(Parent.objects.get(pk=obj.pk).m2m.all())

I know I am not grasping some key aspect of the problem; but I cannot
see what it is, and would appreciate any help with this problem!

Thanks
Derek

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




Re: No module named models again

2013-02-06 Thread frocco
I found the answer.
in my app directory called checkout, I also have a checkout.py file.
from checkout.models import Order in views.py had to be changed to from 
models import Order

On Wednesday, February 6, 2013 3:02:57 PM UTC-5, Brad Pitcher wrote:
>
> On Wed, 2013-02-06 at 11:49 -0800, frocco wrote: 
> > Line 22 does not make any sense to me as to why it is failing. 
> > If I remove receipt, it runs fine 
>
> It can be surprising sometimes what code can cause other code to get 
> imported and run. My guess is, in trying to find your url route there, 
> Django looks through ntw.urls. When it sees 'receipts' it imports 
> ntw.checkout.views to see if that view is there. Suffice it to say, 
> Django is trying to run the code in ntw\checkout\views.py and it would 
> be a good idea to make it work. 
>
>

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




Re: Automating deployments

2013-02-06 Thread Barry Morrison
I've got SaltStack setup to deploy Ubuntu+Nginx+uWSGI+Postgresql+memcache 
pretty easily.  Pulls Django projects from Git, pip installs from 
requirements file. 

It is a lot less complicated than Puppet/Chef in my opinion. 

Just my $.03 cents


On Friday, February 1, 2013 4:28:45 PM UTC-8, Marc Aymerich wrote:
>
> Hi, 
> I'm thinking about the best way to provide automatic deployment for 
> the Django project I'm working on. Its a pretty big one and has lots 
> of dependencies, lots of SO packages, Celeryd and other daemons, SO 
> tweaks... and also several people will need to have installed it on 
> their servers (they are sysadmins, not Django developers), Therefore I 
> want to automate as much as possible the installation and updating 
> processes, to minimize their pain and also because of having 
> homogeneity. 
>
> As I've been a sysadmin myself for many years I've already written 
> some bash scripts that automates all the deployment. But in order to 
> make it more 'natural' I'm planning to integrate those scripts within 
> the Django project as management commands. 
>
> To illustrate my ultimate goal this is how I imagine the workflow: 
>
> sudo pip install django-my_project 
> my_project-admin.sh clone project_name path 
>
> sudo python manage.py installrequirements 
> sudo python manage.py setuppostgres 
> python manage.py syncdb 
> python manage.py migrate 
> python manage.py createsuperuser 
>
> sudo python manage.py setupapache 
> python manage.py collectstatic 
> sudo python manage.py setupceleryd 
> sudo python manage.py createtincserver 
> python manage.py updatetincd 
> sudo python manage.py setupfirmware 
> python manage.py loaddata firmwareconfig 
>
> sudo python manage.py restartservices 
>
>
> Any thought on this? How do you automate your deployments? I heard 
> about fabric lots of times but never used it. Will fabric be helpful 
> in my case? Does it has any advantage for writing my own scripts? Or 
> maybe there are already some existing tools for automating deployment 
> of most common services like Apache, celeryd ..,? 
>
> Many thanks! 
> br 
> -- 
> Marc 
>

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




Re: Why doesn't form_valid() in FormView take a request argument?

2013-02-06 Thread Rainy


On Wednesday, February 6, 2013 3:09:39 PM UTC-5, Some Developer wrote:
>
> Why doesn't the form_valid() (and for that matter the form_invalid()) 
> method in the FormView generic class based view take a request argument? 
>
> I've found that if you have a form which requires you to override the 
> form_valid() method because you need to do custom logic before you save 
> the model and you need to save the user ID of the person who posted the 
> form you need to also override the post() method in order to pass on the 
> correct data by manually adding it to the post argument of the 
> form_valid() method by using request.user. 
>
> Am I missing something here? Is there any easier way to achieve what I 
> want to achieve? 
>


How about using self.request attribute?  -rainy

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




Re: Need guidance on static website conversion to Django

2013-02-06 Thread Harry Houdini

Maintaining that many static files has really got to suck, this is where 
Django is going to help you a lot. First step for you because you are just 
starting out it to play around with Django, build some base templates and 
try extending them until you get your templates looking how you want. Then 
go ahead and design the DB in a way that makes sense for making it easy to 
edit and display your site content (and to add whatever features on top of 
that you want- e.g the voting thing you wanted to add). 

And overall think it would make more sense to start with a vanilla Django 
install and get a feel for it before you jump to Mezzanine. I looked at 
Mezzanine for a project and spent a few days messing around with it and 
building up a site and I have to say that it adds a ton of functionality on 
top of Django but has a learning curve when it comes to customization. They 
modified django a lot compared to something like DjangoCMS I would say 
(which is more of a plugin). Mezzanine is also pretty new and under very 
active development (I follow their repo on Github, its pretty active) but 
you can usually talk to people on their IRC channel about it if you get 
stuck (its on freenode). 

You might find you can build it fast enough with vanilla Django and a few 
unobtrusive plugins and that you dont need the CMS stuff (django.admin does 
a lot actually but has some limits).



On Tuesday, February 5, 2013 1:37:06 PM UTC-5, Steve Metivier wrote:
>
>
>- Project: Convert an essentially static HTML website and its attached 
>WordPress blog, to Django, to improve on its currently slow load time, and 
>to enable its functionality to be extended. (It’s currently implemented on 
>a platform that I believe introduces significant overhead at runtime, and 
>is very restrictive in extensibility. It’s on one of those “build your own 
>website with no technical expertise” platforms.) 
>I should note that I do have technical expertise, having been a 
>professional developer in C for many years, and I now have a decent handle 
>on HTML and CSS, but am a beginner with both Python and Django.
>- The website is a famous quotes site. (It’s 
> www.InspirationalSpark.com, 
>if you want to take a look.) Each page focuses on a specific subject 
> (which 
>its URL indicates), and is comprised of some introductory text, including 
>meta tags, followed by 12-20 famous quote entries, each made up of the 
>quote itself, it’s author, and a short description. Finally, there are 
>related page links at the bottom, and AdSense in several places. The 
>navigation consists of topic links in the left column, and there is also a 
>right column containing various elements that are shared on all pages.
>- I envision each quote becoming a standalone object, so it can be 
>shared socially and, eventually, rated/voted. I intend for each quote to 
> be 
>associated with a single topic page, for the most part.
>- The purpose of the *blog* is to allow daily additions of new quotes, 
>which are scheduled as a “quote of the day”, go out to a feed, and are 
>posted to an associated Facebook page and to Twitter, and then listed on 
>one of the topic pages. I don’t actually want the individual posts to be 
>visible to the search engines, due to the thin content issue. They should 
>only be visible within one of the topic pages, and on the home page.
>- It’s critical that the page URLs remain unchanged, due to the number 
>of inbound links that already exist, and current traffic (around 10,000 
>views/day).
>- I think what I’m looking for is a CMS, with a twist, to enable 
>multiple objects per page. 
>Here’s the long-term plan:
>- Phase 1 – re-implement the website (separate from the blog), as is, 
>in Django, to hopefully improve its currently poor load time. High 
> priority 
>is given to maintaining the current URLs completely, for SEO reasons, and 
>to time to production launch.
>- Phase 2 – migrate the current WordPress blog to Django.
>- Phase 3 – add social media buttons to each quote on the page – for 
>Facebook and twitter.
>- Phase 4 – add user-created pages, where they can store and display 
>their favorite quotes, with accounts and registration.
>- Phase 5 – add voting on individual quotes within a page.
>- Getting to phase 1 completion is a high priority, even if it means 
>reworking components later to do so.
>- The admin interface would need to provide for adding new quotes, and 
>assigning them to topic pages, plus adding new topic pages. In the current 
>Wordpress blog implementation, it’s very handy to be able to specify each 
>of the fields for a quote entry via a form, then pick the category from a 
>list. It would be nice to keep this type of interface.
>- The scheduling of new “posts” feature is also d

Re: Problen with Custom command and Bash Script

2013-02-06 Thread Jesús Lucas Flores
Hi guys,

Thanks everybody for all the answers, really helped me.

I *SOLVED the problem.*

The problem was I was calling custom enviroment variables into my 
settings.py . So that enviroments variables exists on bash (thanks to 
.bashrc) but not in cron  ( thanks Branko Majic ) so manage.py failed  to 
load and no load at all .

I fixed calling my env variables in cron like this:

2 * * * * * root  . $HOME/.basrc; /root/env/project/script.sh

Thank you  to everybody
And sorry about my english.

Jesús Lucas


El miércoles, 6 de febrero de 2013 14:39:55 UTC+1, Jesús Lucas Flores 
escribió:
>
> Hey guys,
>
> I need a little bit help with a custom manage.py command called *test*
>
>
>  I am using it in a virtualenv on a shell script  *script.sh*,
>
> The script.sh works well out of the cron and Wihiout activate the 
> virtualenv also works well.
>
> but if the script is on the crontab give a *Unknown command: 'test'* .
>
>  Here is the code:  http://dpaste.org/hjaVi/ , 
>
> Any help ? 
>
> Thank you
>

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




Re: Problen with Custom command and Bash Script

2013-02-06 Thread Mike Dewhirst

On 7/02/2013 12:39am, Jesús Lucas Flores wrote:

Hey guys,

I need a little bit help with a custom manage.py command called *test*


There is already a manage.py subcommand called test. Might be an idea to 
rename your custom command and try again.


Just a thought ...





  I am using it in a virtualenv on a shell script *script.sh*,

The script.sh works well out of the cron and Wihiout activate the
virtualenv also works well.

but if the script is on the crontab give a *Unknown command: 'test'* .

  Here is the code: http://dpaste.org/hjaVi/ ,

Any help ?

Thank you

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




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




Re: Maintenance on djangoproject.com tomorrow

2013-02-06 Thread Sergei V
Hi, 

is it a smell of next RC in the air? :)

regards,
Sergei

On Wednesday, February 6, 2013 8:43:38 PM UTC+2, Aymeric Augustin wrote:
>
> Hi folks,
>
> We've scheduled maintenance operations on djangoproject.com tomorrow, 
> starting at 09:00 UTC.
>
> The website and the docs may be temporarily unavailable.
>
> Please use the mirror of the docs at Read The Docs in the meantime: 
> http://django.readthedocs.org/
>
> Thanks,
>
> -- 
> Aymeric.
>
>
>  
>

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




Why doesn't form_valid() in FormView take a request argument?

2013-02-06 Thread Some Developer
Why doesn't the form_valid() (and for that matter the form_invalid()) 
method in the FormView generic class based view take a request argument?


I've found that if you have a form which requires you to override the 
form_valid() method because you need to do custom logic before you save 
the model and you need to save the user ID of the person who posted the 
form you need to also override the post() method in order to pass on the 
correct data by manually adding it to the post argument of the 
form_valid() method by using request.user.


Am I missing something here? Is there any easier way to achieve what I 
want to achieve?


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




Django and mod_wsgi serving different apps from separate virtual hosts on the same server

2013-02-06 Thread robertlnewman
Hi fellow Django devs,

I have been going around and around trying to figure this out for 2 days, 
without success. I am trying to serve two Django sites from one webserver using 
Apache's virtual hosts. The first works, the second doesn't. (Note that I have 
been happily serving Django content via mod_wsgi on Apache for one virtual host 
for the better part of a year already, so I am not a newbie.)

For background we are running Django 1.4.2 within a virtualenv and serving via 
Apache 2.2.

We have one project directory '/path/to/django/www' where all our apps live. I 
have all my settings and wsgi files for each site in:

/path/to/django/www/site1/settings
/path/to/django/www/site1/apache

and

/path/to/django/www/site2/settings
/path/to/django/www/site2/apache

I have my apps in '/path/to/django/www' called (for example) Foo, Bar and Baz

I want to serve apps Foo and Bar from port 8787 and app Baz from port 8788. I 
want them all to have their content updated via one admin interface on port 
8787.

I suspect it has to do with https://code.djangoproject.com/ticket/18518 so I 
have configured Django to run in mod_wsgi daemon mode. I followed the 
instructions here and here and also read Graham Dumpleton's blog post on the 
topic here but it still doesn't work. I am turning to this discussion group as 
a last resort.

Here are my Apache virtual host containers:

###
# Start Python WSGI configurations

Listen 8787
NameVirtualHost *:8787


  DocumentRoot  /path/to/django/www/site1
  ErrorLog "/path/to/django-8787-error_log"
  LogLevel info
  WSGIDaemonProcess  django-site1
  WSGIScriptAlias / /path/to/django/www/site1/apache/django.wsgi


Listen 8788
NameVirtualHost *:8788


  DocumentRoot  /path/to/django/www/site2
  ErrorLog "/path/to/django-8788-error_log"
  LogLevel info
  WSGIDaemonProcess  django-site2
  WSGIScriptAlias / /path/to/django/www/site2/apache/django.wsgi


# End Python WSGI configurations
###

We don't run Apache from the root user (we run it as user apache) so I don't 
AFAIK need to define anything other than a name for the WSGIDaemonProcess to 
live under (i.e. I don't have to define the name or group options).

Here are the contents of my django.wsgi files. You can see some of my 
experiments in trying to get this to work (lines commented out) based on the 
tickets and documentation linked above:

site1 (site1/apache/django.wsgi)

import os, sys
sys.path.append('/path/to/django/www/site1')

# Quick fix, but not great
# os.environ['DJANGO_SETTINGS_MODULE'] = 'site1.settings'

# Original setting - use Apache mod_wsgi settings to control
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'site1.settings')

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

site2 (site2/apache/django.wsgi)

import os, sys
sys.path.append('/path/to/django/www/site2')

# Quick fix, but not great
# os.environ['DJANGO_SETTINGS_MODULE'] = 'site2.settings'

# Original setting - use Apache mod_wsgi settings to control
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'site2.settings')

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()


Interestingly, when I deploy these files and restart Apache I only get relevant 
output in the custom error log for site1 (in /path/to/django-8787-error_log) 
(Note also that this shows a complete shutdown and startup series of notices):

[Wed Feb 06 11:42:38 2013] [info] mod_wsgi (pid=18991): Shutdown requested 
'django-site1'.
[Wed Feb 06 11:42:38 2013] [info] mod_wsgi (pid=18991): Stopping process 
'django-site1'.
[Wed Feb 06 11:42:38 2013] [info] mod_wsgi (pid=18991): Destroying interpreters.
[Wed Feb 06 11:42:38 2013] [info] mod_wsgi (pid=18991): Cleanup interpreter ''.
[Wed Feb 06 11:42:38 2013] [info] mod_wsgi (pid=18991): Terminating Python.
[Wed Feb 06 11:42:38 2013] [error] Exception KeyError: 
KeyError(139823767517152,) in  ignored
[Wed Feb 06 11:42:38 2013] [info] mod_wsgi (pid=18991): Python has shutdown.
[Wed Feb 06 09:33:07 2013] [info] mod_wsgi (pid=15411): Attach interpreter ''.
[Wed Feb 06 09:33:07 2013] [info] mod_wsgi (pid=15411): Adding 
'/path/to/django/www/site1' to path.
[Wed Feb 06 09:33:07 2013] [info] mod_wsgi (pid=15411): Adding 
'/path/to/virtualenv/lib/python2.6/site-packages' to path.
[Wed Feb 06 09:34:48 2013] [info] mod_wsgi (pid=15411): Create interpreter 
'www.example.com:8787|'.
[Wed Feb 06 09:34:48 2013] [info] mod_wsgi (pid=15411): Adding 
'/path/to/django/www/site1' to path.
[Wed Feb 06 09:34:48 2013] [info] mod_wsgi (pid=15411): Adding 
'/path/to/virtualenv/lib/python2.6/site-packages' to path.
[Wed Feb 06 09:34:48 2013] [info] [client 127.0.0.1] mod_wsgi (pid=15411, 
process='django-site1', application='www.example.com:8787|'): Loading WSGI 
script '/path/to/django/www/site1/apache/django.wsgi'.

All I see in the error log for the site2 (in /path/to/django-8788-error_log) 
(Note also that this shows a co

Re: No module named models again

2013-02-06 Thread Brad
On Wed, 2013-02-06 at 11:49 -0800, frocco wrote:
> Line 22 does not make any sense to me as to why it is failing.
> If I remove receipt, it runs fine

It can be surprising sometimes what code can cause other code to get
imported and run. My guess is, in trying to find your url route there,
Django looks through ntw.urls. When it sees 'receipts' it imports
ntw.checkout.views to see if that view is there. Suffice it to say,
Django is trying to run the code in ntw\checkout\views.py and it would
be a good idea to make it work.

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




Re: No module named models again

2013-02-06 Thread frocco
Line 22 does not make any sense to me as to why it is failing.
If I remove receipt, it runs fine

On Wednesday, February 6, 2013 1:31:59 PM UTC-5, frocco wrote:
>
> Hello,
>
> What is the best way to track down these types of errors?
>
> in ntw.urls I have: (r'^checkout/', include('checkout.urls')),
>
> in checkout I have:
> urlpatterns = patterns('checkout.views',
> #(r'^$', 'show_checkout', {'template_name': 'checkout/checkout.html' 
> }, 'checkout'),
> (r'^receipt/$', 'receipt', {'template_name': 'checkout/receipt.html' 
> },'checkout'),
> )
>
> if I comment out receipt, the error goes away.
>
> in checkout.views
> def receipt(request, template_name='checkout/receipt.html'):
> """ page displayed with order information after an order has been 
> placed successfully """
> order_number = request.session.get('order_number','')
> if order_number:
> order = Order.objects.filter(id=order_number)[0]
> order_items = OrderItem.objects.filter(order=order)
> else:
> pass
> #cart_url = urlresolvers.reverse('show_cart')
># return HttpResponseRedirect(cart_url)
> return render_to_response(template_name, locals(), 
> context_instance=RequestContext(request))
>
>
>
> ImportError at /
>
> No module named models
>
> Request Method:GETRequest URL:http://127.0.0.1:8000/Django 
> Version:1.4.3Exception 
> Type:ImportErrorException Value:
>
> No module named models
>
> Exception 
> Location:C:\ndsutil\Menus\CTD-NDSUser\PycharmProjects\ntw\checkout\views.py 
> in , line 5Python Executable:C:\Python27\python.exePython Version:
> 2.7.3Python Path:
>
> ['C:\\ndsutil\\Menus\\CTD-NDSUser\\PycharmProjects\\ntw',
>  'C:\\Python27\\lib\\site-packages\\pip-1.2.1-py2.7.egg',
>  'C:\\Python27\\lib\\site-packages\\django_tinymce-1.5.1b4-py2.7.egg',
>  'C:\\Python27\\lib\\site-packages\\django_ckeditor-3.6.2.1-py2.7.egg',
>  'C:\\Python27\\lib\\site-packages\\pillow-1.7.8-py2.7-win32.egg',
>  'C:\\Windows\\system32\\python27.zip',
>  'C:\\Python27\\DLLs',
>  'C:\\Python27\\lib',
>  'C:\\Python27\\lib\\plat-win',
>  'C:\\Python27\\lib\\lib-tk',
>  'C:\\Python27',
>  'C:\\Python27\\lib\\site-packages']
>
> Server time:Wed, 6 Feb 2013 13:30:58 -0500
> Error during template rendering
>
> In template 
> C:\ndsutil\Menus\CTD-NDSUser\PycharmProjects\ntw\templates\index.html, 
> error at line *22*
> No module named models12{% endblock %} 13 14{% block shopping_cart %} 15 src="/static/img/shopping_cart.png"/> 16 src="/static/img/basket.png"/> 17{% endblock %} 18 19{% block 
> non_tire_categories %} 20 Categories 21{% for row in 
> active_categories %} 22 {{ row.name}} 
>  
> 23{% endfor %}
>
>

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




Re: No module named models again

2013-02-06 Thread Brad
On Wed, 2013-02-06 at 10:31 -0800, frocco wrote:
> Exception Location:C:\ndsutil\Menus\CTD-NDSUser\PycharmProjects\ntw
> \checkout\views.py in , line 5

Django gives you the line in the file where the error occurs so you
don't need to track it down ;-)
It's probably failing when you try to import something in views.py.

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




Maintenance on djangoproject.com tomorrow

2013-02-06 Thread Aymeric Augustin
Hi folks,

We've scheduled maintenance operations on djangoproject.com tomorrow, starting 
at 09:00 UTC.

The website and the docs may be temporarily unavailable.

Please use the mirror of the docs at Read The Docs in the meantime: 
http://django.readthedocs.org/

Thanks,

-- 
Aymeric.



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




No module named models again

2013-02-06 Thread frocco
Hello,

What is the best way to track down these types of errors?

in ntw.urls I have: (r'^checkout/', include('checkout.urls')),

in checkout I have:
urlpatterns = patterns('checkout.views',
#(r'^$', 'show_checkout', {'template_name': 'checkout/checkout.html' }, 
'checkout'),
(r'^receipt/$', 'receipt', {'template_name': 'checkout/receipt.html' 
},'checkout'),
)

if I comment out receipt, the error goes away.

in checkout.views
def receipt(request, template_name='checkout/receipt.html'):
""" page displayed with order information after an order has been 
placed successfully """
order_number = request.session.get('order_number','')
if order_number:
order = Order.objects.filter(id=order_number)[0]
order_items = OrderItem.objects.filter(order=order)
else:
pass
#cart_url = urlresolvers.reverse('show_cart')
   # return HttpResponseRedirect(cart_url)
return render_to_response(template_name, locals(), 
context_instance=RequestContext(request))



ImportError at /

No module named models

Request Method:GETRequest URL:http://127.0.0.1:8000/Django 
Version:1.4.3Exception 
Type:ImportErrorException Value:

No module named models

Exception 
Location:C:\ndsutil\Menus\CTD-NDSUser\PycharmProjects\ntw\checkout\views.py 
in , line 5Python Executable:C:\Python27\python.exePython Version:
2.7.3Python Path:

['C:\\ndsutil\\Menus\\CTD-NDSUser\\PycharmProjects\\ntw',
 'C:\\Python27\\lib\\site-packages\\pip-1.2.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_tinymce-1.5.1b4-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_ckeditor-3.6.2.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\pillow-1.7.8-py2.7-win32.egg',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27',
 'C:\\Python27\\lib\\site-packages']

Server time:Wed, 6 Feb 2013 13:30:58 -0500
Error during template rendering

In template 
C:\ndsutil\Menus\CTD-NDSUser\PycharmProjects\ntw\templates\index.html, 
error at line *22*
No module named models12{% endblock %} 13 14{% block shopping_cart %} 15 16 
17{% endblock %} 18 19{% block non_tire_categories %} 20Categories 
21{% for row in active_categories %} 22 {{ 
row.name }}  23{% endfor %}

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




Re: Problen with Custom command and Bash Script

2013-02-06 Thread Ali
I think this has to do with not mentioning the proper settings file. 
manage.py goes to the settings and checks all the installed apps for any 
custom commands, but if you haven't set proper settings file then it would 
not recognize those commands. You can either set the environment variable 
to DJANGO_SETTINGS_MODULE=your_settings_file 
or mention it in the command
python manage.py test --settings=YOUR_SETTINGS_FILE_NAME (dont have to 
mention .py)


On Wednesday, February 6, 2013 8:39:55 AM UTC-5, Jesús Lucas Flores wrote:
>
> Hey guys,
>
> I need a little bit help with a custom manage.py command called *test*
>
>
>  I am using it in a virtualenv on a shell script  *script.sh*,
>
> The script.sh works well out of the cron and Wihiout activate the 
> virtualenv also works well.
>
> but if the script is on the crontab give a *Unknown command: 'test'* .
>
>  Here is the code:  http://dpaste.org/hjaVi/ , 
>
> Any help ? 
>
> Thank you
>

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




Re: Problen with Custom command and Bash Script

2013-02-06 Thread Branko Majic
On Wed, 6 Feb 2013 05:39:55 -0800 (PST)
Jesús Lucas Flores  wrote:

> Hey guys,
> 
> I need a little bit help with a custom manage.py command called *test*
> 
> 
>  I am using it in a virtualenv on a shell script  *script.sh*,
> 
> The script.sh works well out of the cron and Wihiout activate the 
> virtualenv also works well.
> 
> but if the script is on the crontab give a *Unknown command: 'test'* .
> 
>  Here is the code:  http://dpaste.org/hjaVi/ , 
> 
> Any help ? 
> 
> Thank you
> 

Are you sure the script functions even without activating the virtual
environment?

Have you perhaps set some environment variables in your regular account
that are not available during the cron execution?

Keep in mind that cron executes jobs with bare minimum of environment
variables set. You could check the environment variables set by cron by
adding a line to your script that goes something like:

/usr/bin/printenv > /tmp/cronjob_envvars

You could then compare output from that file to the output of the
printenv command that you run by hand.

Best regards

-- 
Branko Majic
Jabber: bra...@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.


signature.asc
Description: PGP signature


Re: plz help me i have checked many time but i could not find error place.....

2013-02-06 Thread Yussi

Does manage.py dbshell shows the tables?
are you sure syncdb worked? what output did it give?
settings.py have the database configured properly?

sorry, I'm a django newb too.

On 06/02/13 15:42, Black9design.com wrote:

Depending on your project structure You may want to try adding the
project name before polls_poll such as. Project_name_polls_poll.

I hope that helps.

Parker

On Feb 6, 2013, at 5:22 AM, Avnesh Shakya mailto:avnesh.n...@gmail.com>> wrote:



I have checked many time, even i have deleted my project n i have
created new project again and create new model but error is occurred
again n again.. i m beginner so plz help me

C:\mysite>python manage.py shell
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from polls.models import Poll,Choice
>>> Poll.objects.all()
Traceback (most recent call last):
File "", line 1, in 
File "C:\Python27\lib\site-packages\django\db\models\query.py", line
72, in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "C:\Python27\lib\site-packages\django\db\models\query.py", line
87, in __len__
self._result_cache.extend(self._iter)
File "C:\Python27\lib\site-packages\django\db\models\query.py", line
291, in iterator
for row in compiler.results_iter():
File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
line 763, in results_iter
for rows in self.execute_sql(MULTI):
File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
line 818, in execute_sql
cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django\db\backends\util.py", line
40, in execute
return self.cursor.execute(sql, params)
File
"C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py",
line 344, in execute
return Database.Cursor.execute(self, query, params)
DatabaseError: no such table: polls_poll
>>>

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



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




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




Re: Object level permissions implementation

2013-02-06 Thread bobhaugen
I'm not sure this is the best way to do it, but for what I think is a 
similar situation, I created a template tag and a model instance method.

The template tag asks the model instance method whether the user has 
permission.

Here's the template tag:
https://github.com/bhaugen/localecon/blob/master/clusters/templatetags/permissions.py

Here's the instance method:
https://github.com/bhaugen/localecon/blob/master/clusters/models.py#L176

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




Re: plz help me i have checked many time but i could not find error place.....

2013-02-06 Thread Black9design.com
Depending on your project structure You may want to try adding the project name 
before polls_poll such as.  Project_name_polls_poll.

I hope that helps.

Parker

On Feb 6, 2013, at 5:22 AM, Avnesh Shakya  wrote:

> 
> I have checked many time, even i have deleted my project n i have created new 
> project again and create new model but error is occurred again n again.. i m 
> beginner so plz help me
> 
> C:\mysite>python manage.py shell
> Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on 
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> from polls.models import Poll,Choice
> >>> Poll.objects.all()
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 72, in 
> __repr__
> data = list(self[:REPR_OUTPUT_SIZE + 1])
>   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 87, in 
> __len__
> self._result_cache.extend(self._iter)
>   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 291, 
> in iterator
> for row in compiler.results_iter():
>   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line 
> 763, in results_iter
> for rows in self.execute_sql(MULTI):
>   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line 
> 818, in execute_sql
> cursor.execute(sql, params)
>   File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 40, 
> in execute
> return self.cursor.execute(sql, params)
>   File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py", 
> line 344, in execute
> return Database.Cursor.execute(self, query, params)
> DatabaseError: no such table: polls_poll
> >>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

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




Re: plz help me i have checked many time but i could not find error place.....

2013-02-06 Thread Jaimin Patel
Do you see polls_poll table in your database? How does your db settings 
looks?

On Wednesday, February 6, 2013 9:02:53 AM UTC-5, Avnesh Shakya wrote:
>
> ya i have executed python manage.py syncdb...but still it's giving 
> error...
>
> On Wed, Feb 6, 2013 at 7:01 PM, Thomas Weholt 
> 
> > wrote:
>
>> Have you executed python manage.py syncdb?
>>
>> Thomas
>>
>> On Wed, Feb 6, 2013 at 2:22 PM, Avnesh Shakya 
>> > 
>> wrote:
>> >
>> > I have checked many time, even i have deleted my project n i have 
>> created
>> > new project again and create new model but error is occurred again n 
>> again..
>> > i m beginner so plz help me
>> >
>> > C:\mysite>python manage.py shell
>> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit 
>> (Intel)] on
>> > win32
>> > Type "help", "copyright", "credits" or "license" for more information.
>> > (InteractiveConsole)
>>  from polls.models import Poll,Choice
>>  Poll.objects.all()
>> > Traceback (most recent call last):
>> >   File "", line 1, in 
>> >   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 
>> 72,
>> > in __repr__
>> > data = list(self[:REPR_OUTPUT_SIZE + 1])
>> >   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 
>> 87,
>> > in __len__
>> > self._result_cache.extend(self._iter)
>> >   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 
>> 291,
>> > in iterator
>> > for row in compiler.results_iter():
>> >   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
>> > line 763, in results_iter
>> > for rows in self.execute_sql(MULTI):
>> >   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
>> > line 818, in execute_sql
>> > cursor.execute(sql, params)
>> >   File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 
>> 40,
>> > in execute
>> > return self.cursor.execute(sql, params)
>> >   File 
>> "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py",
>> > line 344, in execute
>> > return Database.Cursor.execute(self, query, params)
>> > DatabaseError: no such table: polls_poll
>> 
>> >
>> > --
>> > You received this message because you are subscribed to the Google 
>> Groups
>> > "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an
>> > email to django-users...@googlegroups.com .
>> > To post to this group, send email to 
>> > django...@googlegroups.com
>> .
>> > Visit this group at http://groups.google.com/group/django-users?hl=en.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>>
>>
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>

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




Local Flavor - PhoneNumberField (KeyError: Invalid)

2013-02-06 Thread Derrick Jackson
Hi all,

I am working on implementing the US PhoneNumberField and currently as long 
as I pass in the expected phone number length (10 digits) the number is 
formatting numbers just as I expect.  However, if I dont put enough numbers 
in the form field, I get a Key Error.  

I can't for the life of me figure out how to override the validation of 
this form field prior to the PhoneNumberField trying to format the number. 
 Any advice would be appreciated.

Thanks

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




Re: admin - see detail inline

2013-02-06 Thread Victor Rocha
I see more than one problem with your code. StackedInline is only used for 
models that have a one to many relationship and not the otherway around, in 
other words, you can have Docs stacked in line on the Client page but not 
the other way around, because only ONE client owns the document. You will 
see who owns it unless you have editable=False in your foreignkey.  The 
code should look like this:

#Model
class Client(models.Model):
name= models.CharField(max_length=25)
...

class Docs(models.Model):
name= models.CharField(max_length=25)
...
client  = models.ForeignKey(Client)

#Admin
class Detail_Doc(admin.StackedInline):
model = Docs

class DocAdmin(admin.ModelAdmin):
pass

class ClientAdmin(admin.ModelAdmin):
inlines = [Detail_Doc,]

admin.site.register(Doc, DocAdmin)
admin.site.register(Client, ClientAdmin)


Thank you,
Victor Rocha
www.rochapps.com

On Wednesday, February 6, 2013 8:02:53 AM UTC-5, grat wrote:
>
> Hi,
>
> i have this code:
>
> #Model
> class Client(models.Model):
> name= models.CharField(max_length=25)
> ...
>
> class Docs(models.Model):
> name= models.CharField(max_length=25)
> ...
> client  = models.ForeignKey(Client)
>
> #Admin
> class Detail_Doc(admin.StackedInline):
> model = Docs
>
> class Detail_Client(admin.StackedInline):
> model = Client
>
> class DocAdmin(admin.ModelAdmin):
> inlines = [Detail_Client,]
>
> class ClientAdmin(admin.ModelAdmin):
> inlines = [Detail_Docs,]
>
> admin.site.register(Doc,DocAdmin)
> admin.site.register(Client,ClientAdmin)
>
> what i want:
> a) in pages where is DOC i need see owner this Doc
> b) in pages in client i want to see DOC owned 
>
> Sorry for simple QA, but i only starting learn Django
>
> Milan
>

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




Re: plz help me i have checked many time but i could not find error place.....

2013-02-06 Thread Avnesh Shakya
ya i have executed python manage.py syncdb...but still it's giving
error...

On Wed, Feb 6, 2013 at 7:01 PM, Thomas Weholt wrote:

> Have you executed python manage.py syncdb?
>
> Thomas
>
> On Wed, Feb 6, 2013 at 2:22 PM, Avnesh Shakya 
> wrote:
> >
> > I have checked many time, even i have deleted my project n i have created
> > new project again and create new model but error is occurred again n
> again..
> > i m beginner so plz help me
> >
> > C:\mysite>python manage.py shell
> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
> (Intel)] on
> > win32
> > Type "help", "copyright", "credits" or "license" for more information.
> > (InteractiveConsole)
>  from polls.models import Poll,Choice
>  Poll.objects.all()
> > Traceback (most recent call last):
> >   File "", line 1, in 
> >   File "C:\Python27\lib\site-packages\django\db\models\query.py", line
> 72,
> > in __repr__
> > data = list(self[:REPR_OUTPUT_SIZE + 1])
> >   File "C:\Python27\lib\site-packages\django\db\models\query.py", line
> 87,
> > in __len__
> > self._result_cache.extend(self._iter)
> >   File "C:\Python27\lib\site-packages\django\db\models\query.py", line
> 291,
> > in iterator
> > for row in compiler.results_iter():
> >   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
> > line 763, in results_iter
> > for rows in self.execute_sql(MULTI):
> >   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
> > line 818, in execute_sql
> > cursor.execute(sql, params)
> >   File "C:\Python27\lib\site-packages\django\db\backends\util.py", line
> 40,
> > in execute
> > return self.cursor.execute(sql, params)
> >   File
> "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py",
> > line 344, in execute
> > return Database.Cursor.execute(self, query, params)
> > DatabaseError: no such table: polls_poll
> 
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
>
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Problen with Custom command and Bash Script

2013-02-06 Thread Jesús Lucas Flores
Hey guys,

I need a little bit help with a custom manage.py command called *test*


 I am using it in a virtualenv on a shell script  *script.sh*,

The script.sh works well out of the cron and Wihiout activate the 
virtualenv also works well.

but if the script is on the crontab give a *Unknown command: 'test'* .

 Here is the code:  http://dpaste.org/hjaVi/ , 

Any help ? 

Thank you

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




Re: plz help me i have checked many time but i could not find error place.....

2013-02-06 Thread Thomas Weholt
Have you executed python manage.py syncdb?

Thomas

On Wed, Feb 6, 2013 at 2:22 PM, Avnesh Shakya  wrote:
>
> I have checked many time, even i have deleted my project n i have created
> new project again and create new model but error is occurred again n again..
> i m beginner so plz help me
>
> C:\mysite>python manage.py shell
> Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
 from polls.models import Poll,Choice
 Poll.objects.all()
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 72,
> in __repr__
> data = list(self[:REPR_OUTPUT_SIZE + 1])
>   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 87,
> in __len__
> self._result_cache.extend(self._iter)
>   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 291,
> in iterator
> for row in compiler.results_iter():
>   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
> line 763, in results_iter
> for rows in self.execute_sql(MULTI):
>   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
> line 818, in execute_sql
> cursor.execute(sql, params)
>   File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 40,
> in execute
> return self.cursor.execute(sql, params)
>   File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py",
> line 344, in execute
> return Database.Cursor.execute(self, query, params)
> DatabaseError: no such table: polls_poll

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



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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




plz help me i have checked many time but i could not find error place.....

2013-02-06 Thread Avnesh Shakya

I have checked many time, even i have deleted my project n i have created 
new project again and create new model but error is occurred again n 
again.. i m beginner so plz help me

C:\mysite>python manage.py shell
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] 
on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from polls.models import Poll,Choice
>>> Poll.objects.all()
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 72, 
in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 87, 
in __len__
self._result_cache.extend(self._iter)
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 291, 
in iterator
for row in compiler.results_iter():
  File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", 
line 763, in results_iter
for rows in self.execute_sql(MULTI):
  File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", 
line 818, in execute_sql
cursor.execute(sql, params)
  File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 40, 
in execute
return self.cursor.execute(sql, params)
  File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py", 
line 344, in execute
return Database.Cursor.execute(self, query, params)
DatabaseError: no such table: polls_poll
>>>

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




Re: Django ForeignKey versus ManyToManyField

2013-02-06 Thread Adam Mesha
On Wed, Feb 6, 2013 at 8:48 AM, Daniel Roseman wrote:

> On Tuesday, 5 February 2013 22:39:30 UTC-8, vijay shanker wrote:
>
>> Hi
>> I have two models, a Customer model and a WishListItem model (which
>> stores products). I have option of either having a ManyToManyField in
>> Customer to WishListItem, or I can have a customer ForeignKey to customer
>> for each WishListItem.
>> Which one will be more efficient ?
>> Thanks
>>
>
> What a strange question. The choice of ManyToMany vs ForeignKey has
> nothing at all to do with efficiency, but with which is correct for your
> data structure. In your case, ManyToMany makes no sense at all, because an
> item can't have many customers - so ForeignKey is the only logical choice.
>

That would probably depend on whether we're talking about specific physical
items in the WishListItem model, in which case each can obviously belong to
only one customer, or catalog items, each of which can be bought by
multiple customers. Since this is a wishlist, my guess is that they're not
physical items and more than one customer can have the same item on their
wish list, so a ManyToManyField would work.

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




admin - see detail inline

2013-02-06 Thread grat
Hi,

i have this code:

#Model
class Client(models.Model):
name= models.CharField(max_length=25)
...

class Docs(models.Model):
name= models.CharField(max_length=25)
...
client  = models.ForeignKey(Client)

#Admin
class Detail_Doc(admin.StackedInline):
model = Docs

class Detail_Client(admin.StackedInline):
model = Client

class DocAdmin(admin.ModelAdmin):
inlines = [Detail_Client,]

class ClientAdmin(admin.ModelAdmin):
inlines = [Detail_Docs,]

admin.site.register(Doc,DocAdmin)
admin.site.register(Client,ClientAdmin)

what i want:
a) in pages where is DOC i need see owner this Doc
b) in pages in client i want to see DOC owned 

Sorry for simple QA, but i only starting learn Django

Milan

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




Re: plz help me for error in python for django.....

2013-02-06 Thread Jani Tiainen

Django doesn't touch tables that already exists in database.

So if you had model Poll run syncdb and then change, add or remove 
fields Django doesn't modify underlying table.


There is few options that resolves your problem:
- Manually migrate your database using plain SQL.
- Recreate table or whole database.
- Use south for database migrations.

6.2.2013 12:08, Avnesh Shakya kirjoitti:

thanks alot... but i have set it but again it's showing new
error.. like...

C:\mysite>python manage.py shell
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
 >>> from polls.models import Poll,Choice
 >>> Poll.objects.all()
Traceback (most recent call last):
   File "", line 1, in 
   File "C:\Python27\lib\site-packages\django\db\models\query.py", line
72, in __repr__
 data = list(self[:REPR_OUTPUT_SIZE + 1])
   File "C:\Python27\lib\site-packages\django\db\models\query.py", line
87, in __len__
 self._result_cache.extend(self._iter)
   File "C:\Python27\lib\site-packages\django\db\models\query.py", line
291, in iterator
 for row in compiler.results_iter():
   File
"C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line
763, in results_iter
 for rows in self.execute_sql(MULTI):
   File
"C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line
818, in execute_sql
 cursor.execute(sql, params)
   File "C:\Python27\lib\site-packages\django\db\backends\util.py", line
40, in execute
 return self.cursor.execute(sql, params)
   File
"C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py", line
344, in execute
 return Database.Cursor.execute(self, query, params)
DatabaseError: no such column: polls_poll.pub_date
 >>>






On Wed, Feb 6, 2013 at 2:49 PM, Jani Tiainen mailto:rede...@gmail.com>> wrote:

Now look your Poll model and try to find field "pub_date" there...

:)

6.2.2013 11:03, Avnesh Shakya kirjoitti:

thanks.. i have added my polls.models file

On Wed, Feb 6, 2013 at 2:20 PM, Sergiy Khohlov
mailto:skhoh...@gmail.com>
>> wrote:

 1) please provide your model Poll
 2) are you run syncdb ?
 Many thanks,

 Serge


 +380 636150445
 skype: skhohlov


 2013/2/6 Avnesh Shakya mailto:avnesh.n...@gmail.com>
 >__>:

  >
  > Here i want to explore database API but it's generating
 error..
  > C:\mysite>python manage.py shell
  > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC
v.1500 32 bit
 (Intel)] on
  > win32
  > Type "help", "copyright", "credits" or "license" for more
 information.
  > (InteractiveConsole)
   from polls.models import Poll,Choice
   Poll.objects.all()
  > []
   import django
   from django.utils import timezone
   p= Poll(question="what's new?",pub_date= timezone.now())
  > Traceback (most recent call last):
  >   File "", line 1, in 
  >   File
"C:\Python27\lib\site-__packages\django\db\models\__base.py",
 line 367,
  > in __init__
  > raise TypeError("'%s' is an invalid keyword argument
for this
 function"
  > % kwargs.keys()[0])
  > TypeError: 'pub_date' is an invalid keyword argument for
this
 function
  
  >
  > --
  > You received this message because you are subscribed to the
 Google Groups
  > "Django users" group.
  > To unsubscribe from this group and stop receiving emails
from it,
 send an
  > email to django-users+unsubscribe@__googlegroups.com

 __>.

  > To post to this group, send email to
django-users@googlegroups.com

>.

  > Visit this group at
http://groups.google.com/__group/django-users?hl=en
.
  > For more options, visit
https://groups.google.com/__groups/opt_out
.
  >
  >

 --
 You received this message bec

Re: get_initial on a ForeignKey on ModelForm not working properly

2013-02-06 Thread Michele Mattioni
Hi Timster,

thanks for pointing to the right method. Now it works like a charm.

Cheers,
Michele


On Mon, Feb 4, 2013 at 3:56 PM, Timster  wrote:

> By setting "initial" on a field, you are not changing the list of
> available options. Setting the initial like this determines which of all
> the locations are selected when the form is shown for the first time. The
> default would be to select the location for the event, but you are
> overriding that by setting it to all the locations assigned to a user.
>
> If you want the location dropdown to ONLY include the options related to
> the user, you'd need to override the "queryset" for the field, not the
> initial data.
>
> One way is to do this in the get_form method like so...
>
> def get_form(self, form_class):
> form = super(EventCreate, self).get_form(form_class)
> form.fields['location'].queryset = Location.objects.filter(user=**
> self.request.user)
> return form
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Michele Mattioni, PhD
http://michelemattioni.me

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




Re: plz help me for error in python for django.....

2013-02-06 Thread Avnesh Shakya
thanks alot... but i have set it but again it's showing new error..
like...

C:\mysite>python manage.py shell
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from polls.models import Poll,Choice
>>> Poll.objects.all()
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 72,
in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 87,
in __len__
self._result_cache.extend(self._iter)
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 291,
in iterator
for row in compiler.results_iter():
  File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
line 763, in results_iter
for rows in self.execute_sql(MULTI):
  File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
line 818, in execute_sql
cursor.execute(sql, params)
  File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 40,
in execute
return self.cursor.execute(sql, params)
  File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py",
line 344, in execute
return Database.Cursor.execute(self, query, params)
DatabaseError: no such column: polls_poll.pub_date
>>>






On Wed, Feb 6, 2013 at 2:49 PM, Jani Tiainen  wrote:

> Now look your Poll model and try to find field "pub_date" there...
>
> :)
>
> 6.2.2013 11:03, Avnesh Shakya kirjoitti:
>
>> thanks.. i have added my polls.models file
>>
>> On Wed, Feb 6, 2013 at 2:20 PM, Sergiy Khohlov > > wrote:
>>
>> 1) please provide your model Poll
>> 2) are you run syncdb ?
>> Many thanks,
>>
>> Serge
>>
>>
>> +380 636150445
>> skype: skhohlov
>>
>>
>> 2013/2/6 Avnesh Shakya > **>:
>>
>>  >
>>  > Here i want to explore database API but it's generating
>> error..
>>  > C:\mysite>python manage.py shell
>>  > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
>> (Intel)] on
>>  > win32
>>  > Type "help", "copyright", "credits" or "license" for more
>> information.
>>  > (InteractiveConsole)
>>   from polls.models import Poll,Choice
>>   Poll.objects.all()
>>  > []
>>   import django
>>   from django.utils import timezone
>>   p= Poll(question="what's new?",pub_date= timezone.now())
>>  > Traceback (most recent call last):
>>  >   File "", line 1, in 
>>  >   File "C:\Python27\lib\site-**packages\django\db\models\**
>> base.py",
>> line 367,
>>  > in __init__
>>  > raise TypeError("'%s' is an invalid keyword argument for this
>> function"
>>  > % kwargs.keys()[0])
>>  > TypeError: 'pub_date' is an invalid keyword argument for this
>> function
>>  
>>  >
>>  > --
>>  > You received this message because you are subscribed to the
>> Google Groups
>>  > "Django users" group.
>>  > To unsubscribe from this group and stop receiving emails from it,
>> send an
>>  > email to 
>> django-users+unsubscribe@**googlegroups.com
>> 
>> > **>.
>>
>>  > To post to this group, send email to
>> django-users@googlegroups.com 
>> > >.
>>
>>  > Visit this group at
>> 
>> http://groups.google.com/**group/django-users?hl=en
>> .
>>  > For more options, visit 
>> https://groups.google.com/**groups/opt_out
>> .
>>  >
>>  >
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to 
>> django-users+unsubscribe@**googlegroups.com
>> 
>> > **>.
>>
>> To post to this group, send email to django-users@googlegroups.com
>> > >.
>>
>> Visit this group at http://groups.google.com/**
>> group/django-users?hl=en
>> .
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out
>> .
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to 
>> django-users+unsubscribe@**googlegroups.com
>> .
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at 
>> http://groups.google.com/**group/django-users?hl=en

Interesting error with django.simple.test.DjangoTestSuiteRunner

2013-02-06 Thread chris
Hi everyone,

We've been having this miscellaneous error with the default test runner in 
Django. We had a forms.py that was something like this:

class SomeForm(forms.ModelForm):
some_field = 
some_custom_fields.SomeCustomField(choices=get_some_queryset_and_evaluate_it())
# Actually, we're using django-chosen's ChosenGroupChoiceField, so 
choices is a specially-constructed 4-D list of objects

And our tests.py had:

from forms import SomeForm

Per the Django documentation, the tests are all imported before the test 
database and tables are created. This means our tests.py imports SomeForm, 
which in turn calls get_some_queryset_and_evaluate_it(), which in turn 
causes a DatabaseError: no such table: some_app_some_table, since the 
database hasn't been created yet.

So, a few questions.


   1. Should the test runner's behavior be changed?
   2. Even if it should be, what's the best way to avoid this right now? We 
   were thinking of either 
   subclassing django.simple.test.DjangoTestSuiteRunner and altering it to 
   create the database before importing tests (seems fragile), or simply 
   modifying the choices in SomeForm's __init__ method (seems hacky).

Thanks,
Chris

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




Re: plz help me for error in python for django.....

2013-02-06 Thread Jani Tiainen

Now look your Poll model and try to find field "pub_date" there...

:)

6.2.2013 11:03, Avnesh Shakya kirjoitti:

thanks.. i have added my polls.models file

On Wed, Feb 6, 2013 at 2:20 PM, Sergiy Khohlov mailto:skhoh...@gmail.com>> wrote:

1) please provide your model Poll
2) are you run syncdb ?
Many thanks,

Serge


+380 636150445
skype: skhohlov


2013/2/6 Avnesh Shakya mailto:avnesh.n...@gmail.com>>:
 >
 > Here i want to explore database API but it's generating
error..
 > C:\mysite>python manage.py shell
 > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
(Intel)] on
 > win32
 > Type "help", "copyright", "credits" or "license" for more
information.
 > (InteractiveConsole)
  from polls.models import Poll,Choice
  Poll.objects.all()
 > []
  import django
  from django.utils import timezone
  p= Poll(question="what's new?",pub_date= timezone.now())
 > Traceback (most recent call last):
 >   File "", line 1, in 
 >   File "C:\Python27\lib\site-packages\django\db\models\base.py",
line 367,
 > in __init__
 > raise TypeError("'%s' is an invalid keyword argument for this
function"
 > % kwargs.keys()[0])
 > TypeError: 'pub_date' is an invalid keyword argument for this
function
 
 >
 > --
 > You received this message because you are subscribed to the
Google Groups
 > "Django users" group.
 > To unsubscribe from this group and stop receiving emails from it,
send an
 > email to django-users+unsubscr...@googlegroups.com
.
 > To post to this group, send email to
django-users@googlegroups.com .
 > Visit this group at
http://groups.google.com/group/django-users?hl=en.
 > For more options, visit https://groups.google.com/groups/opt_out.
 >
 >

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



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





--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

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




Re: plz help me for error in python for django.....

2013-02-06 Thread Avnesh Shakya
thanks.. i have added my polls.models file

On Wed, Feb 6, 2013 at 2:20 PM, Sergiy Khohlov  wrote:

> 1) please provide your model Poll
> 2) are you run syncdb ?
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> 2013/2/6 Avnesh Shakya :
> >
> > Here i want to explore database API but it's generating error..
> > C:\mysite>python manage.py shell
> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
> (Intel)] on
> > win32
> > Type "help", "copyright", "credits" or "license" for more information.
> > (InteractiveConsole)
>  from polls.models import Poll,Choice
>  Poll.objects.all()
> > []
>  import django
>  from django.utils import timezone
>  p= Poll(question="what's new?",pub_date= timezone.now())
> > Traceback (most recent call last):
> >   File "", line 1, in 
> >   File "C:\Python27\lib\site-packages\django\db\models\base.py", line
> 367,
> > in __init__
> > raise TypeError("'%s' is an invalid keyword argument for this
> function"
> > % kwargs.keys()[0])
> > TypeError: 'pub_date' is an invalid keyword argument for this function
> 
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




models.py
Description: Binary data


Re: plz help me for error in python for django.....

2013-02-06 Thread Avnesh Shakya
thanks. i m adding my polls file...

On Wed, Feb 6, 2013 at 2:20 PM, Sergiy Khohlov  wrote:

> 1) please provide your model Poll
> 2) are you run syncdb ?
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> 2013/2/6 Avnesh Shakya :
> >
> > Here i want to explore database API but it's generating error..
> > C:\mysite>python manage.py shell
> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
> (Intel)] on
> > win32
> > Type "help", "copyright", "credits" or "license" for more information.
> > (InteractiveConsole)
>  from polls.models import Poll,Choice
>  Poll.objects.all()
> > []
>  import django
>  from django.utils import timezone
>  p= Poll(question="what's new?",pub_date= timezone.now())
> > Traceback (most recent call last):
> >   File "", line 1, in 
> >   File "C:\Python27\lib\site-packages\django\db\models\base.py", line
> 367,
> > in __init__
> > raise TypeError("'%s' is an invalid keyword argument for this
> function"
> > % kwargs.keys()[0])
> > TypeError: 'pub_date' is an invalid keyword argument for this function
> 
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




polls.rar
Description: application/rar


Re: plz help me for error in python for django.....

2013-02-06 Thread Sergiy Khohlov
1) please provide your model Poll
2) are you run syncdb ?
Many thanks,

Serge


+380 636150445
skype: skhohlov


2013/2/6 Avnesh Shakya :
>
> Here i want to explore database API but it's generating error..
> C:\mysite>python manage.py shell
> Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
 from polls.models import Poll,Choice
 Poll.objects.all()
> []
 import django
 from django.utils import timezone
 p= Poll(question="what's new?",pub_date= timezone.now())
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python27\lib\site-packages\django\db\models\base.py", line 367,
> in __init__
> raise TypeError("'%s' is an invalid keyword argument for this function"
> % kwargs.keys()[0])
> TypeError: 'pub_date' is an invalid keyword argument for this function

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

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




Re: template for "Pagination for admin inlines" snippet

2013-02-06 Thread Axel Rau

Am 05.02.2013 um 22:16 schrieb Conor Pollock:

> I'm currently trying to figure this out as well...  I can pass a page query 
> in the url and everything works as expected, but I can't figure out how to 
> render the pagination controls in my template file.
> 
> Did you ever get this to work?
No, I gave up with admin.
> 
> On Monday, 8 October 2012 10:37:09 UTC-4, axel...@chaos1.de wrote:
>> 
>> Hi, 
>> 
>> anybody got a template working for this 
>>https://gist.github.com/559911 
>> ? 
>> I have no idea how to fiddle it into the admin template system. 
>> 
>> Thanks, Axel 
Axel
---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius

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