Re: pyodbc utf-8

2012-12-03 Thread Nebros
Can that be, that my computer have the problem and not python itself?

Am Dienstag, 27. November 2012 09:49:37 UTC+1 schrieb Nebros:

> Hello community
>  
> i have a next problem. i have connected with pyodbc to a mssql db. i read 
> values out of it, all works, but i have problems with "ä" "ö" and "ü".
> on my html.page i made this into the header:
>  
> 
>  
> on all my pages this umlauts works, but not the values of the pyodbc...
> when i only give out the row, i become something like this: Hansj\xf6rg 
> ,but it have to be this: Hansjörg
> when i print this value out into a table, the field keeps empty.
>  
> it must be a problem of pyodbc, but i dont know how to fix it. i tryed 
> something like this:
>  
> views.py 
> def kundendaten(request):
> ret = request.POST
> form = ret['kunde']
> conn = pyodbc.connect('DRIVER={SQL 
> Server};SERVER=MAURITIUS;DATABASE=baan5c;UID=portal;PWD=P0rtalReader')
> cursor = conn.cursor()
> cursor.execute("SELECT x.t_name, x.t_user, y.t_mail FROM tttaad20 
> as x, tttcmf20 as y WHERE (x.t_name = y.t_name) AND (x.t_user = 
> '%s')"%form)
> rows = unicode(cursor.fetchall(), 'utf-8')
> now = datetime.datetime.now()
> return render_to_response("kundendaten.html", { 'rows': rows, 
> 'current_date': now, 'form': form}, 
> context_instance=RequestContext(request))
> -
> but the page gave this error:
> TypeError at /kundendaten/
>
> coercing to Unicode: need string or buffer, list found
>
>  
> i dont know how i can fix my problem... what i use:
> win7 32bit
> python 2.7
> django 1.4.1
> pyodbc 3.0.6
>  
> can someone halp me to fix this problem?
>

-- 
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/-/S8otKqKqLccJ.
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: pyodbc utf-8

2012-12-03 Thread Nebros
I use win7 32bit... dont know what you need to know aswell. ^^

Am Montag, 3. Dezember 2012 11:01:53 UTC+1 schrieb Nebros:

> Can that be, that my computer have the problem and not python itself?
>  
>

-- 
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/-/2aVh5Hm416YJ.
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 throws ImproperlyConfigured error when loading URLconf on startup

2012-12-03 Thread Garth Cumming
I've noticed this same behaviour as well but only with a higher loaded 
production server and using the gunicorn gevent class, i've never seen this 
happen with a sync class.

I'll take a wild guess that gevent worker class is handling requests before 
django has had a chance to initialize. Perhaps django does some sort of 
blocking on startup and the gevent monkey patching prevents this blocking 
behaviour on startup. Just a wild guess.

On Wednesday, November 28, 2012 3:03:10 PM UTC-8, Michael Dippery wrote:
>
> I have a Django app running on a production server. It is handled with 
> gunicorn 0.14.2 behind nginx. When I reload the app (by reloading the 
> gunicorn workers), I get this error: 
>
> --- 
> Traceback (most recent call last): 
>
>  File 
> "/opt/app/venv/myapp/lib/python2.6/site-packages/django/core/handlers/base.py",
>  
> line 101, in get_response 
>request.path_info) 
>
>  File 
> "/opt/app/venv/myapp/lib/python2.6/site-packages/django/core/urlresolvers.py",
>  
> line 250, in resolve 
>for pattern in self.url_patterns: 
>
>  File 
> "/opt/app/venv/myapp/lib/python2.6/site-packages/django/core/urlresolvers.py",
>  
> line 283, in _get_url_patterns 
>raise ImproperlyConfigured("The included urlconf %s doesn't have any 
> patterns in it" % self.urlconf_name) 
>
> ImproperlyConfigured: The included urlconf myapp.urls doesn't have any 
> patterns in it 
> --- 
>
> Others with this problem have commonly noted that it occurs while using 
> reverse in a URLconf, but I am not using reverse in any URLconfs (nor are 
> they used in any third-party apps). Also, this error only occurs in 
> production -- never in development (using the Django dev server) or on my 
> staging server (also using gunicorn 0.14.2 behind nginx). It also doesn't 
> seem to cause trouble with the site at any other time then during reloads. 
> And it only happens for the first 10-20 requests on the website (which 
> makes me wonder if it's some sort of race condition, perhaps). 
>
> Any ideas what's causing the problem?

-- 
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/-/KhaMhHaubnEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread Loai Ghoraba
Hi

I have this in my urls.py

url(r'^accounts/login/$', login,name="accounts-login")

and in a template base.html
 login

And when I try to open the site, this error is raised: Template syntax 
error: Could not parse the remainder: '-login' from 'accounts-login'

But when I change the name of the url in both urls.py and base.html to 
something without the score '-', it works: like :accountslogin.

So are scores banned in named urls ? I have seen scored-named-urls in the 
documentation !

Thanks in advance.


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



Re: Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread Nikhil Verma
Try Sign in

On Mon, Dec 3, 2012 at 6:01 PM, Loai Ghoraba  wrote:

> Hi
>
> I have this in my urls.py
>
> url(r'^accounts/login/$', login,name="accounts-login")
>
> and in a template base.html
>  login
>
> And when I try to open the site, this error is raised: Template syntax
> error: Could not parse the remainder: '-login' from 'accounts-login'
>
> But when I change the name of the url in both urls.py and base.html to
> something without the score '-', it works: like :accountslogin.
>
> So are scores banned in named urls ? I have seen scored-named-urls in the
> documentation !
>
> Thanks in advance.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/g19mRQ4vHd4J.
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Re: Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread Loai Ghoraba
not working, giving: Reverse for '' with arguments '()' and keyword
arguments '{}' not found.

also I want to know about this dash (sorry for using the term score in the
previous post ) thing

On Mon, Dec 3, 2012 at 2:34 PM, Nikhil Verma wrote:

> {% url auth_login %}

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



Re: Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread Loai Ghoraba
okay I found it:

it should be  login
with quotes. Thanks.

On Mon, Dec 3, 2012 at 2:50 PM, Loai Ghoraba  wrote:

> not working, giving: Reverse for '' with arguments '()' and keyword
> arguments '{}' not found.
>
> also I want to know about this dash (sorry for using the term score in the
> previous post ) thing
>
> On Mon, Dec 3, 2012 at 2:34 PM, Nikhil Verma wrote:
>
>> {% url auth_login %}
>
>
>
>

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



Re: Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread Larry Martell
On Mon, Dec 3, 2012 at 7:31 AM, Loai Ghoraba  wrote:
> Hi
>
> I have this in my urls.py
>
> url(r'^accounts/login/$', login,name="accounts-login")
>
> and in a template base.html
>  login
>
> And when I try to open the site, this error is raised: Template syntax
> error: Could not parse the remainder: '-login' from 'accounts-login'
>
> But when I change the name of the url in both urls.py and base.html to
> something without the score '-', it works: like :accountslogin.
>
> So are scores banned in named urls ? I have seen scored-named-urls in the
> documentation !

Hyphens are valid in urls, but not in python. A hyphen is an operator
in python (subtraction operator), so you cannot use it in django.

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



Re: Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread donarb
Except, the Django documentation states that url names with dashes are 
acceptable and the examples show url tags using unquoted names. It even 
says you can use any character you want:

*The string used for the URL name can contain any characters you like. You 
are not restricted to valid Python names.*

https://docs.djangoproject.com/en/1.4/topics/http/urls/#id2

On Monday, December 3, 2012 4:54:19 AM UTC-8, Loai Ghoraba wrote:
>
> okay I found it:
>
> it should be  login 
> with quotes. Thanks.
>
> On Mon, Dec 3, 2012 at 2:50 PM, Loai Ghoraba 
> > wrote:
>
>> not working, giving: Reverse for '' with arguments '()' and keyword 
>> arguments '{}' not found.
>>
>> also I want to know about this dash (sorry for using the term score in 
>> the previous post ) thing
>>
>> On Mon, Dec 3, 2012 at 2:34 PM, Nikhil Verma 
>> 
>> > wrote:
>>
>>> {% url auth_login %}
>>
>>
>>
>>
>

-- 
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/-/2FM_hakKP1QJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread donarb
Correction, the syntax has changed between 1.4 and 1.5. You are now 
required to quote the name in the url tag.

-- 
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/-/ijeFeRNw0aMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help with manage.py sql

2012-12-03 Thread David Brotman
Thanks for the response. To answer your questions:

1. Have you set up a DB and put the details into your settings.py? If not, 
this is the problem.

*Yes, all the details of my db are in the settings. I am convinced that the 
syncdb works since when I ran it the first time, a few tables were created;*

auth_group,auth_group_permissions,auth_permission,auth_user, etc.

2. If you have done that, then the next step is to try another python 
manage syncdb 

*Yep, ran it again and rechecked the database. Nothing new.*

3. Are you running python manage.py sql polls from the directory with 
manage.py in it? 

*Yep, running it the same directory as manage.py*

4. What is your OS and which version of Django? 

*I am on a shared hosting. I am not sure of the version of Linux but it 
does list kernel version of 2.6.32-20120131.55.1.bh6.x86_*

*Django version is the most recent: 1.4.2*

On Sunday, December 2, 2012 5:54:21 PM UTC-8, Lachlan Musicman wrote:
>
> On Mon, Dec 3, 2012 at 1:43 PM, David Brotman 
> > wrote: 
> > Hi: 
> > 
> > I am really new to django and I am going thru the online tutorial 
> (polls) 
> > app and I got to the point in the tutorial where I enter the command: 
> > 
> > python manage.py sql polls 
> > 
> > Nothing happens. No error message or anything else displayed. It just 
> goes 
> > to a prompt. I included 'polls' in the installed apps section of the 
> > settings.py file as instructed. Anyone have any ideas on how to 
> troubleshoot 
> > this issue? 
>
> 1. Have you set up a DB and put the details into your settings.py? If 
> not, this is the problem 
> 2. If you have done that, then the next step is to try another 
>
> python manage syncdb 
>
> Which you should have run a little earlier, when registering the 
> django necessary tables, and this second run should create the tables 
> for the polls app. 
>
> Are you running python manage.py sql polls from the directory with 
> manage.py in it? 
>
> What is you OS and which version of Django? 
>
> Cheers 
> L. 
>
>
> > 
> > -- 
> > 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/-/BkUr0V1xy2AJ. 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > django-users...@googlegroups.com . 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>
>
>
> -- 
> ...we look at the present day through a rear-view mirror. This is 
> something Marshall McLuhan said back in the Sixties, when the world 
> was in the grip of authentic-seeming future narratives. He said, “We 
> look at the present through a rear-view mirror. We march backwards 
> into the future.” 
>
> http://www.warrenellis.com/?p=14314 
>

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



Email makes it to Gmail, but not Squirrelmail

2012-12-03 Thread Paco de Kumite
Hi.  I have a little view that sends an email.  I looks like this

msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send()

where text_content is a simple text message and html_content is, well, some 
html content.

The html message gets sent to Gmail without any problems, and I can see 
from there (In the "Show Original" thing) that the text version went 
through ok too.  But when I send it to my other domain email, and check my 
inbox via Squirrelmail, I don't get the email at all.

I'm just wondering, this probably isn't Django's fault is it?  I'm thinking 
it has something to do with my mail server not being properly configured 
(e.g. no SPF yet and some other stuff I overlooked just to get it going), 
and maybe Gmail is just smart enough to sort it all out, where as my other 
domain server (i.e. the one using squirrelmail) just rejects the mail 
outright.  I'm just looking for some feedback.  Thanks.

-- 
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/-/jsd2cjKC1fgJ.
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: Email makes it to Gmail, but not Squirrelmail

2012-12-03 Thread Andreas Pritschet
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Paco,
as the mail makes it to your Gmail account, but not to your
self-hosted server runnig squirrelmail I indeed would assume that the
problem lies with the mail server.
To check this I would take a look at the mail log of the server
running your Django view and the mail log of the server running
squirrelmail.

At least one of the logs should show some clues about the whereabouts
of the mail.

CU andi

Andreas Pritschet
Phone:   +49 151 11728439
Homepage:http://www.pritschet.me
GPG Pub Key: http://goo.gl/4mOsM

Am 03.12.2012 21:47, schrieb Paco de Kumite:
> Hi.  I have a little view that sends an email.  I looks like this
> 
> msg = EmailMultiAlternatives(subject, text_content, from_email,
> [to]) msg.attach_alternative(html_content, "text/html") msg.send()
> 
> where text_content is a simple text message and html_content is,
> well, some html content.
> 
> The html message gets sent to Gmail without any problems, and I can
> see from there (In the "Show Original" thing) that the text version
> went through ok too.  But when I send it to my other domain email,
> and check my inbox via Squirrelmail, I don't get the email at all.
> 
> I'm just wondering, this probably isn't Django's fault is it?  I'm 
> thinking it has something to do with my mail server not being
> properly configured (e.g. no SPF yet and some other stuff I
> overlooked just to get it going), and maybe Gmail is just smart
> enough to sort it all out, where as my other domain server (i.e.
> the one using squirrelmail) just rejects the mail outright.  I'm
> just looking for some feedback.  Thanks.
> 
> -- 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/-/jsd2cjKC1fgJ. 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.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJQvRFQAAoJEMMdfJo8Sd0M5JMH/RgpuZmrC+z8PbAa85XWkf7o
6lrhP/meUZhNwOqxUzhQgOqDCVoCMXFVO4czROMQSKy/7Qdoiqx3VSIQwgVQVApO
Uo3bo/NDLR8UH7zzPxKJiKDUha6QXISit4S++g3whlPdXvvoRMJ2Jna38VEOJUzU
CvaUn6TWYfqju0OgmN3aQkOdEw972vMSfSmmCJtzDtEDwxee/iP5ZcmOoCdyyLk7
1H7/KCg9BE5hj6HGomHuBCalsEcztQvL1FZ7z8dumO1CuKaFS5+Y7kctnJLRTznt
l6ISN3C3W5/2qSG3HhNMDH+7M7xdWQO0WUA7N0yf4ROaXHWlGftI3WKTABPFXGg=
=2vq6
-END PGP SIGNATURE-

-- 
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 goes enterprise- your stories/numbers/setups

2012-12-03 Thread Frank Bieniek

Hi Django Users,

I do need to do some recommendations related to
django in the enterprise environment. Thats why I do need a bigger picture,
larger than my teams expirience.

So I do as YOU about YOUR experiences
with django and larger audiences.

What are your recommended infrastructure setups/concurrent User numbers etc.
when you are scaling/starting a django project beyond django-cms?

What are your setups? Components? Expirienced Limits?
What have you done in the past to scale to what kind of concurrent Users?
What are your expiriences/ bottlenecks / pains?

I know these are broad questions,
but your input is welcome to get a bigger picture.

Thanks
Frank

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



Help with registration backend

2012-12-03 Thread Jason Pythonic
Hi All,

First time poster here, so apologies if this question has been covered - 
believe me, I've searched, but I might be too far off base to know what to 
search for.

Here's my issue. I'm working on a site that is currently setup to enroll 
users via the django-registration user registration backend.

User accounts are created by navigating to my_site/accounts/register/, 
entering a username, an e-mail address, and a password. Once this form is 
filled out, an activatation link is e-mailed to the new user by clicking on 
a button. When the user receives this email, they simply follow the link to 
activate their account. That all works. The problem I have is that 
absolutely anyone can come along and create their own account simply by 
going to my_site/accounts/register/ and sending themselves an activation 
e-mail. I need a way to ensure that only my website's user is authorized to 
create users, and I'm really just not sure of how to go about tackling this.

I'd sure appreciate it if someone could provide direction how to do this.

Just to summarize, I only want *my *site's user to be allowed to create new 
users. How do I accomplish this?


Thanks,
Jason

-- 
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/-/KX89LoeJdz4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help with registration backend

2012-12-03 Thread Chris Cogdon
modify the urlconf so that the function to send out registration keys can 
only be executed if someone is already logged in and/or has the right kind 
of permission.

eg, instead of

 url(  some-re   some_function )

you can use

 url ( some-re, login_required(some_function) )

or has_perm, or a myriad of other decorators/wrappers.



On Monday, December 3, 2012 1:40:02 PM UTC-8, Jason Pythonic wrote:
>
> Hi All,
>
> First time poster here, so apologies if this question has been covered - 
> believe me, I've searched, but I might be too far off base to know what to 
> search for.
>
> Here's my issue. I'm working on a site that is currently setup to enroll 
> users via the django-registration user registration backend.
>
> User accounts are created by navigating to my_site/accounts/register/, 
> entering a username, an e-mail address, and a password. Once this form is 
> filled out, an activatation link is e-mailed to the new user by clicking on 
> a button. When the user receives this email, they simply follow the link to 
> activate their account. That all works. The problem I have is that 
> absolutely anyone can come along and create their own account simply by 
> going to my_site/accounts/register/ and sending themselves an activation 
> e-mail. I need a way to ensure that only my website's user is authorized to 
> create users, and I'm really just not sure of how to go about tackling this.
>
> I'd sure appreciate it if someone could provide direction how to do this.
>
> Just to summarize, I only want *my *site's user to be allowed to create 
> new users. How do I accomplish this?
>
>
> Thanks,
> Jason
>

-- 
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/-/UnRhc8RDsiMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help with manage.py sql

2012-12-03 Thread Sam Solomon
I'm guessing that for some reason the classes in your app/models.py are not 
set up correctly, are you sure you inherit from models.Model in your 
class(es).

Example:

from django.db import models
class MyModel(models.Model):

rather instead of :

class MyModel():

If it doesn't inherit models.Model Django will not recognize it as being a 
model.

On Monday, December 3, 2012 11:03:11 AM UTC-8, David Brotman wrote:
>
> Thanks for the response. To answer your questions:
>
> 1. Have you set up a DB and put the details into your settings.py? If not, 
> this is the problem.
>
> *Yes, all the details of my db are in the settings. I am convinced that 
> the syncdb works since when I ran it the first time, a few tables were 
> created;*
>
> auth_group,auth_group_permissions,auth_permission,auth_user, etc.
>
> 2. If you have done that, then the next step is to try another python 
> manage syncdb 
>
> *Yep, ran it again and rechecked the database. Nothing new.*
>
> 3. Are you running python manage.py sql polls from the directory with 
> manage.py in it? 
>
> *Yep, running it the same directory as manage.py*
>
> 4. What is your OS and which version of Django? 
>
> *I am on a shared hosting. I am not sure of the version of Linux but it 
> does list kernel version of 2.6.32-20120131.55.1.bh6.x86_*
>
> *Django version is the most recent: 1.4.2*
>
> On Sunday, December 2, 2012 5:54:21 PM UTC-8, Lachlan Musicman wrote:
>>
>> On Mon, Dec 3, 2012 at 1:43 PM, David Brotman 
>>  wrote: 
>> > Hi: 
>> > 
>> > I am really new to django and I am going thru the online tutorial 
>> (polls) 
>> > app and I got to the point in the tutorial where I enter the command: 
>> > 
>> > python manage.py sql polls 
>> > 
>> > Nothing happens. No error message or anything else displayed. It just 
>> goes 
>> > to a prompt. I included 'polls' in the installed apps section of the 
>> > settings.py file as instructed. Anyone have any ideas on how to 
>> troubleshoot 
>> > this issue? 
>>
>> 1. Have you set up a DB and put the details into your settings.py? If 
>> not, this is the problem 
>> 2. If you have done that, then the next step is to try another 
>>
>> python manage syncdb 
>>
>> Which you should have run a little earlier, when registering the 
>> django necessary tables, and this second run should create the tables 
>> for the polls app. 
>>
>> Are you running python manage.py sql polls from the directory with 
>> manage.py in it? 
>>
>> What is you OS and which version of Django? 
>>
>> Cheers 
>> L. 
>>
>>
>> > 
>> > -- 
>> > 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/-/BkUr0V1xy2AJ. 
>> > To post to this group, send email to django...@googlegroups.com. 
>> > To unsubscribe from this group, send email to 
>> > django-users...@googlegroups.com. 
>> > For more options, visit this group at 
>> > http://groups.google.com/group/django-users?hl=en. 
>>
>>
>>
>> -- 
>> ...we look at the present day through a rear-view mirror. This is 
>> something Marshall McLuhan said back in the Sixties, when the world 
>> was in the grip of authentic-seeming future narratives. He said, “We 
>> look at the present through a rear-view mirror. We march backwards 
>> into the future.” 
>>
>> http://www.warrenellis.com/?p=14314 
>>
>

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



python.el + django = python-django.el

2012-12-03 Thread Fabian Ezequiel Gallina
I just pushed to github an Emacs package to work with Django
projects.

It follows the magit-status buffer filosophy a bit. I has a tight
integration with management commands and simple/intuitive
bindings to do stuff you'd normally use (like grep an app's
directory, open the directory with dired, open settings file, etc).

The most interesting feature from my point of view is the ability
to launch management commands and focus them with just a couple
of bindings. It's worth to say that if you have runserver running
and get to a set_trace, either from pdb or ipdb, Emacs will start
following such files automatically (directly from python.el's
pdbtracking feature).

The package also provides a nice way to define quick management
commands (ways to run management commands with nice defaults a
cool prompts with intelligent completion). By default it has
defined a bunch of these quick commands, many from built-in
Django commands, and others popular from django-extensions and
south.

For anybody interested: https://github.com/fgallina/python-django.el


Happy hacking,
-- 
Fabián E. Gallina
http://www.from-the-cloud.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.



Limiting the entry that loaded in django admin.

2012-12-03 Thread bolang

Hi all,
need some input here.

I have a site with > 15000 images, using django photologue.

When we create a Post (that has Images field in it) from django admin,
all of the images will be loaded in a dropdown.

Before this, it was not create any problem.
Now, after the number of images getting bigger,  big chance we got 
timeout when try

to create/edit Post.

I think it is possible to limit the loaded images (although i don't know 
how to do it).

But, which images that should be loaded?

Any advice?


Thanks before.

--
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: Limiting the entry that loaded in django admin.

2012-12-03 Thread Andrew Macgregor

On 04/12/2012, at 12:13 PM, bolang wrote:

> Hi all,
> need some input here.
> 
> I have a site with > 15000 images, using django photologue.
> 
> When we create a Post (that has Images field in it) from django admin,
> all of the images will be loaded in a dropdown.
> 
> Before this, it was not create any problem.
> Now, after the number of images getting bigger,  big chance we got timeout 
> when try
> to create/edit Post.
> 
> I think it is possible to limit the loaded images (although i don't know how 
> to do it).
> But, which images that should be loaded?
> 
> Any advice?
> 


Try using raw_id_fields:

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields

Cheers, Andrew.

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



Bulk db insert with a file through admin form

2012-12-03 Thread MNG1138
Say I've got a model like this:

class Product(models.Model):

name = models.CharField(max_length=200)

class ProductItem(models.Model):
 product = models.ForeignKey(Product)
 serialnumber = models.charField()
 sold = models.BooleanField(default=False)

ProductItem represents physical products in the store.  I have a file with 
thousands of serial #'s for the product.  In the product form in the admin, 
I'd like to upload this file, parse the serial #'s and create rows in 
ProductItem.  I could add a FileField to Product and create a custom 
storage that parses the file and creates ProductITems.  Or I could override 
save for the Product model.  Both of these solutions are non-optimal, as I 
will have a FileField in Product and db that I don't need.

Is there any way to add a 'dummy' FileField just for the form that doesn't 
result in a DB row?  Or is the answer to create a custom admin form?  Any 
good tutorials or examples for doing creating a custom admin form?

Thanks,
Mark



-- 
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/-/efDj8ZO4QXIJ.
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 1.5 b1 django-admin.py error

2012-12-03 Thread Aapo Rista
keskiviikko, 28. marraskuuta 2012 16.53.15 UTC+2 Sultan Imanhodjaev 
kirjoitti:

> I use OSX Lion, virtualenv version 1.7.2, python 2.7.1. I just created a 
> new virtualenv, downloaded and install Django 1.5 b1.
>

I had the same problem: Mac OS X 10.8.2, Python 2.7.3 is installed with 
MacPorts, just downloaded Django-1.5b1.tar.gz, created virtualenv with 
command

virtualenv ~/Documents/workspace/virtualenv/myproject-1.5

activated it:

source ~/Documents/workspace/virtualenv/myproject-1.5/bin/activate

and then tried to run django-admin.py help. This produced ImportError: 
Could not import settings blaa blaa blaa.

However, when I unset env variable DJANGO_SETTINGS_MODULE with command:

export DJANGO_SETTINGS_MODULE=

django-admin runs without complaints. You can verify if this variable is 
set by issuing command:

env | grep DJANGO_SETTINGS_MODULE


-- 
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/-/toDCpyxc7_MJ.
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: Limiting the entry that loaded in django admin.

2012-12-03 Thread Chris Cogdon
raw_id_fields is the first step.

also look at django-ajax-selects, which gives you a lot of interesting 
abilities.

On Monday, December 3, 2012 8:13:02 PM UTC-8, Bo Lang wrote:
>
> Hi all, 
> need some input here. 
>
> I have a site with > 15000 images, using django photologue. 
>
> When we create a Post (that has Images field in it) from django admin, 
> all of the images will be loaded in a dropdown. 
>
> Before this, it was not create any problem. 
> Now, after the number of images getting bigger,  big chance we got 
> timeout when try 
> to create/edit Post. 
>
> I think it is possible to limit the loaded images (although i don't know 
> how to do it). 
> But, which images that should be loaded? 
>
> Any advice? 
>
>
> Thanks before. 
>

-- 
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/-/R9y_b6rbt3wJ.
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: Limiting the entry that loaded in django admin.

2012-12-03 Thread bolang

On 12/04/2012 11:24 AM, Andrew Macgregor wrote:

Try using raw_id_fields: 
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields 
Cheers, Andrew. 


It works!
Thanks Andrew,

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