Re: Best ways and common practices to lock the Database before a new deploy

2013-02-21 Thread Jani Tiainen

21.2.2013 18:02, Santiago Basulto kirjoitti:

Hello guys,

we've our app that's working awesome. We do a new release each week.
We've set up a nice deployment process using fabric and everything
works great.

The problem is that, as the application grows, it takes some time to
perform the deploy. And we're using South, so sometimes we need to
migrate some big tables.

So, the questions are:

* How should I lock my DB in the moment of the deployment? Should I
use different DB users at that moment?

* What other strategies do you use at the moment of the deployment you
can recommend?

Thank you very much!



You can't "lock" your database in that sense.

Simplest thing and what you usually do is to just bloock all unwanted 
access to your database like shutdown all running deployments for a 
upgrade period.


For downtime period you can setup static page to state that "maintenance 
in progress" or some other meanful information.


--
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: ask : Make a second-level auth

2013-02-21 Thread Bino Oetomo

Respond to my own post

Password encryption is fix,

But authentication result different between sheel and we.
I Post the problem at 
https://groups.google.com/group/django-users/browse_thread/thread/d3c508ce2a0f2dec

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




dual AUTHENTICATION_BACKENDS

2013-02-21 Thread Bino Oetomo
Dear All

Background: at 
https://groups.google.com/group/django-users/browse_thread/thread/df70d373f3285e97#

Now, the password encyption problem is fixed

i put this line on my setting
---START--
AUTHENTICATION_BACKENDS = ('l2auth.backends.L2Backend',
'django.contrib.auth.backends.ModelBackend',
)
STOP--

But I got different auth result test between using web and django-
shell
test data ==> company=binonet, username=dodol4, password=
results screen shoot ==> http://oi45.tinypic.com/262pp4n.jpg

Looks like my django didn't call 'l2auth.backends.L2Backend' when
authenticating via web

Please any body give me enlightment on what to check or what to do to
fix this problem

sincerely
-bino-

-- 
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: can someone rewrite this line please

2013-02-21 Thread Mark Furbee
No worries, Mike. Any time!


On Thu, Feb 21, 2013 at 3:17 AM, MikeKJ  wrote:

> Thank you Mark spot on!
>
> Really appreciate it
>
>
>
>
>
> On Wednesday, February 20, 2013 3:58:28 PM UTC, Mark wrote:
>
>> Not sure if you need the json.large to be compiled or if that should be
>> part of the string. The biggest issue was you had a single-quote before
>> onmouseover. After that, you have to escape the single-quote before > src and either escape the + json.large + or leave it so that Type will
>> compile it. Give this a try, I think it is what you want:
>>
>> large = '> src="'+json.large+'"/>\',LEFT, true, OFFSETY, -250, OFFSETX, 0, WIDTH,
>> 800)\" target=\"_blank\">';
>>
>> FYI: if you use an IDE like Eclipse, it will show you what is and isn't
>> escaped to some degree, using colored text to denote quoted strings versus
>> compiled commands.
>>
>> Cheers,
>>
>> Mark
>>
>> On Wed, Feb 20, 2013 at 6:25 AM, MikeKJ  wrote:
>>
>>> large = '>> src='+json.large+'/>',LEFT, true, OFFSETY, -250, OFFSETX, 0, WIDTH, 800)\"
>>> target=\"_blank\">';
>>>
>>> so that is comes out of the jquery call as proper html, it needs more
>>> escaping somewhere but damned if I can see it.
>>>
>>>  --
>>> 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.
>
>
>

-- 
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: Easiest Way to Deploy Django?

2013-02-21 Thread Russell Keith-Magee
On Fri, Feb 22, 2013 at 5:58 AM, Peter  wrote:

> I've a new Django user who went through the tutorial and built a few very
> simple apps (e.g. a Craigslist app) using SqlLite for my database.
>
> Can someone advise on what's the best way to deploy a simple Django app?
>  I'm aware of Heroku's Django tutorial but am not yet familiar with how to
> use Postgres.  Should I learn how to work with a real database first?
>

Long term, learning how to use PostgreSQL in depth will certainly be worth
your time. However, if you're just starting out with database-backed web
development, there's isn't much you need to know. One of the benefits of
using a tool like Django's ORM is that you don't need to know about the
details of your data store. Your SQLite code should work exactly the same
on PostgreSQL. User.objects.all() works the same regardless of the database
you're using.

At some point you'll definitely need to learn more about PostgreSQL --
especially if you start looking at going into production and you need to do
some performance tuning. However, if you just want to get your site up and
running on Heroku, I'd suggest just following the Heroku tutorials and
taking the PostgreSQL-specific bits as boiler plate.

Yours,
Russ Magee %-)

-- 
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: HTML5 Offline apps with Django 1.4

2013-02-21 Thread Russell Keith-Magee
On Thu, Feb 21, 2013 at 3:38 PM, Ranjith Chaz  wrote:

> Trying to implement *offline** *feature of *HTML5*.  Deployed in *
> apache2.2* with mod_wsgi plugin.
> It works as expected (i.e., loads the cached page when offline) in chrome,
> Opera (using window.openDatabase) and other desktop browsers. However it
> doesn't work in Android 2.x, iPhone default browsers. Strangely, it works
> with Android 4.0 browser!!
> Here is the code:
>
> *views.py:*
>
> def offlineApp(request):
> t = get_template('index.html')
> html = t.render(Context({'MEDIA_URL':'http://myDomain.com/site_media/'}))
> return HttpResponse(html)
>
>
> *Is it required to use any specific module/middleware to handle text/manifest 
> in django ?*
>
> No - you just have to return a response that sets the content type:

return HttpResponse(html, content_type='text/cache-manifest')

Yours,
Russ Magee %-)

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




Easiest Way to Deploy Django?

2013-02-21 Thread Peter
I've a new Django user who went through the tutorial and built a few very 
simple apps (e.g. a Craigslist app) using SqlLite for my database.

Can someone advise on what's the best way to deploy a simple Django app? 
 I'm aware of Heroku's Django tutorial but am not yet familiar with how to 
use Postgres.  Should I learn how to work with a real database first?

Thanks!
Peter

-- 
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: Manually added foreign key not working.

2013-02-21 Thread Josh Cartmell
Can you look at the database in some way and see if FK_Formats_id
actually exists in the table?

If you added that to the model after you had already synced it then
running another syncdb will not create the new field.  I would suggest
looking into South which will handle database migrations for you:
http://south.readthedocs.org/en/latest/tutorial/part1.html#converting-existing-apps

On Feb 20, 4:53 am, laxmikant ratnaparkhi  wrote:
> Hello all,
>
> I just run a command to Add foreign key to the existing table. and the
> command was like this:
>
> *ALTER TABLE acfs_subscriptionmaster ADD CONSTRAINT FK_Formats FOREIGN KEY
> (id) REFERENCES acfs_formats (id) MATCH FULL;*
>
> It has got executed. but giving error on the interface
>
> column acfs_subscriptionmaster.FK_Formats_id does not exist
> LINE 1: ...ccountmaster"."id") INNER JOIN "acfs_formats" ON ("acfs_subs...
>
> *What could be the reason, What Should I do to solve this. I can't DROP
> Table. ?*
>
> *my models.py looks like this :*
>
> class SubscriptionMaster(models.Model):
>     """
>     """
>     uid = models.TextField(blank=True, null=True)
>     FK_SubsType = models.ForeignKey(SubscriptionType)
>     FK_Product = models.ForeignKey(ProductMaster)
> *    FK_Formats = models.ForeignKey(Formats)
> <<--            Added this field in
> models.py
> *    ccs_minimum_price = models.TextField(blank=True, null=True)
>     ccs_maximum_price = models.TextField(blank=True, null=True)
>     ccs_Increment_type = models.TextField(blank=True, null=True)
>     ccs_minimum_increment = models.TextField(blank=True, null=True)
>     ccs_maximum_increment = models.TextField(blank=True, null=True)
>     ccs_default_offer = models.TextField(blank=True, null=True)
>
> Checked SQL Got created by *python manage.py sqlall* acfs
>
> This is my table :
>
> CREATE TABLE "acfs_subscriptionmaster" (
>     "id" serial NOT NULL PRIMARY KEY,
>     "uid" text,
>     "FK_SubsType_id" integer NOT NULL REFERENCES "acfs_subscriptiontype"
> ("id") DEFERRABLE INITIALLY DEFERRED,
>     "FK_Product_id" integer NOT NULL REFERENCES "acfs_productmaster" ("id")
> DEFERRABLE INITIALLY DEFERRED,
> *    "FK_Formats_id" integer NOT NULL REFERENCES "acfs_formats" ("id")
> DEFERRABLE INITIALLY DEFERRED, <--This field has got created
> here *
>     "ccs_minimum_price" text,
>     "ccs_maximum_price" text,
>     "ccs_Increment_type" text,
>     "ccs_minimum_increment" text,
>     "ccs_maximum_increment" text,
>     "ccs_default_offer" text,
> );
>
> Also its howing indexes like this :
>
> CREATE INDEX "acfs_subscriptionformats_FK_Format_id" ON
> "acfs_subscriptionformats" ("FK_Format_id");
> CREATE INDEX "acfs_subscriptionmaster_FK_SubsType_id" ON
> "acfs_subscriptionmaster" ("FK_SubsType_id");
> CREATE INDEX "acfs_subscriptionmaster_FK_Product_id" ON
> "acfs_subscriptionmaster" ("FK_Product_id");
> CREATE INDEX "acfs_subscriptionmaster_FK_Formats_id" ON
> "acfs_subscriptionmaster" ("FK_Formats_id");
>
> Looks like error is field has not got created in actual database :
> *python manage.py dbshell*
> *acfsdb1=# SELECT * FROM acfs_subscriptionmaster;*
>  id | uid | FK_SubsType_id | FK_Product_id | ccs_minimum_price |
> ccs_maximum_price | ccs_Increment_type | ccs_minimum_increment |
> ccs_maximum_increment | ccs_default_of
> fer | fix_startdatetime | fix_expiydatetime | fix_price | dur_period |
> wd_field_01 | wd_field_02 | wd_field_03 | wd_field_04 | wd_field_05 |
> flag_field_01 | created_dat
> e_time | modified_date_time
> +-++---+---+---++---+---+---
> +---+---+---++-+-+-+-+-+---+
> ---+
> (0 rows)
>
> This is my DJANGO - Python versions
>
> Django Version: 1.2.7  Exception Type: DatabaseError  Exception Value:
>
> column acfs_subscriptionmaster.FK_Format_id does not exist
> LINE 1: ...ccountmaster"."id") INNER JOIN "acfs_formats" ON ("acfs_subs...
>                                                              ^
>
>  Exception Location:
> /usr/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py
> in execute, line 44  Python Executable: /usr/bin/python  Python Version:
> 2.6.6*postgres 9.1*
>
> Traceback Variables (see at the bottom for the error)
> ▼ Local vars 
>   args
> ()
>  e
> ProgrammingError('column acfs_subscriptionmaster.FK_Format_id does not
> exist\nLINE 1: ...ccountmaster"."id") INNER JOIN "acfs_formats" ON
> ("acfs_subs...\n ^\n',)
>  query
> 'SELECT "acfs_subscriptionmaster"."id", "acfs_subscriptionmaster"."uid",
> "acfs_subscriptionmaster"."FK_SubsType_id",
> "acfs_subscriptionmaster"."FK_Product_id",
> 

Re: url pattern correct but not working

2013-02-21 Thread Arnold Krille
On Thu, 21 Feb 2013 15:41:12 -0500 Bill Freeman 
wrote:
> Not quite right either, even if it didn't have the non matched open
> parenthesis after the carat, since it would match
> "foo-bar--1234.html".
> 
> Perhaps '^(?:[a-zA-Z0-9]+-)+(?P\d+).html$'
> 
> (?:...) is a non-capturing group, if you're not familiar with it.

Right, thats better. But this pattern is actually matching one
non-capture-group for each - in the url? Not that this would be a
problem though.

I never yet had the need to regex a part of the
url and then not use it as argument for the view...

Have fun,

Arnold


signature.asc
Description: PGP signature


Re: url pattern correct but not working

2013-02-21 Thread Bill Freeman
Not quite right either, even if it didn't have the non matched open
parenthesis after the carat, since it would match "foo-bar--1234.html".

Perhaps '^(?:[a-zA-Z0-9]+-)+(?P\d+).html$'

(?:...) is a non-capturing group, if you're not familiar with it.

Bill

On Thu, Feb 21, 2013 at 3:05 PM, Arnold Krille  wrote:

> On Thu, 21 Feb 2013 10:46:05 -0800 (PST) Aswani Kumar
>  wrote:
> > my url pattern
> >
> > [a-zA-Z0-9]-(?P\d+).html
> >
> > urls will be like
> >
> > news-in-finland-yesterday-festival-3456.html
> >
> > i want 3456 which is news id.
> >
> > the regex is correct but not working if i keep it in urls.
> > url('^[a-zA-Z0-9]-(?P\d+).html$', 'tempa'),
>
> Whether your pattern is correct or depends on what you want to achieve:
>  - if you want to match a single digit or letter followed by a dash and
>a  number uf digits for the id, then your pattern is correct.
>  - if you want your pattern to macht the url you have given, then its
>not correct.
>
> You want something like this (untested):
>
> url(r'^([a-zA-Z0-9\-]+-(?P\d+).html$', 'tempa')
>
> And that only matches lower- and upper-case letters, numbers and
> dashes. If you want to allow any non-ascii characters you might want
> something different in that first parantheses.
>
> Have fun,
>
> Arnold
>

-- 
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: url pattern correct but not working

2013-02-21 Thread Arnold Krille
On Thu, 21 Feb 2013 10:46:05 -0800 (PST) Aswani Kumar
 wrote:
> my url pattern 
> 
> [a-zA-Z0-9]-(?P\d+).html
> 
> urls will be like 
> 
> news-in-finland-yesterday-festival-3456.html
> 
> i want 3456 which is news id.
> 
> the regex is correct but not working if i keep it in urls.
> url('^[a-zA-Z0-9]-(?P\d+).html$', 'tempa'),

Whether your pattern is correct or depends on what you want to achieve:
 - if you want to match a single digit or letter followed by a dash and
   a  number uf digits for the id, then your pattern is correct.
 - if you want your pattern to macht the url you have given, then its
   not correct.

You want something like this (untested):

url(r'^([a-zA-Z0-9\-]+-(?P\d+).html$', 'tempa')

And that only matches lower- and upper-case letters, numbers and
dashes. If you want to allow any non-ascii characters you might want
something different in that first parantheses.

Have fun,

Arnold


signature.asc
Description: PGP signature


Re: url pattern correct but not working

2013-02-21 Thread James Schneider
The regex you are using will only match a SINGLE letter or number, followed
by a dash, and then the nid.

I'm betting it will work if you have a url like a-2355.html.

Check out this SO post, it's pretty much identical to what you are looking
for:
http://stackoverflow.com/questions/2525327/regex-for-a-za-z0-9-with-dashes-allowed-in-between-but-not-at-the-start-or-e


-James




On Thu, Feb 21, 2013 at 10:46 AM, Aswani Kumar  wrote:

> my url pattern
>
> [a-zA-Z0-9]-(?P\d+).html
>
> urls will be like
>
> news-in-finland-yesterday-festival-3456.html
>
> i want 3456 which is news id.
>
> the regex is correct but not working if i keep it in urls.
> url('^[a-zA-Z0-9]-(?P\d+).html$', 'tempa'),
>
> please help...
>
> --
> 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: url pattern correct but not working

2013-02-21 Thread Joel Goldstick
On Thu, Feb 21, 2013 at 1:46 PM, Aswani Kumar  wrote:

> my url pattern
>
> [a-zA-Z0-9]-(?P\d+).html
>
> urls will be like
>
> news-in-finland-yesterday-festival-3456.html
>
> i want 3456 which is news id.
>
> the regex is correct but not working if i keep it in urls.
> url('^[a-zA-Z0-9]-(?P\d+).html$', 'tempa'),
>
> please help...
>

why use regex when you can split on - then take the second string and split
on .
>>> url = 'news-in-finland-yesterday-festival-3456.html'
>>> id = url.rsplit('-', 1)[1].split('.')[0]
>>> id
'3456'

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



-- 
Joel Goldstick
http://joelgoldstick.com

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




url pattern correct but not working

2013-02-21 Thread Aswani Kumar
my url pattern 

[a-zA-Z0-9]-(?P\d+).html

urls will be like 

news-in-finland-yesterday-festival-3456.html

i want 3456 which is news id.

the regex is correct but not working if i keep it in urls.
url('^[a-zA-Z0-9]-(?P\d+).html$', 'tempa'),

please help...

-- 
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: IRC freenode channel

2013-02-21 Thread yati sagade
Hi Ankit
It looks like #django requires your nick to be identified with freenode.
Type this command in your IRC client to get started: "/msg NickServ help
register" (without the quotes, of course)

Regards


On Thu, Feb 21, 2013 at 5:57 PM, ANKIT BAGARIA wrote:

> Why is it that when ever I am not able to open django's channel on
> irc.freenode.net.. Please help. Thankyou.
>
> --
> 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.
>
>
>



-- 
Yati Sagade

Software Engineer at mquotient 


Twitter: @yati_itay  | Github:
yati-sagade

Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869

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




tornado server in production

2013-02-21 Thread kase
now whit django 1.4 is beary easy to run tornado server.

import os
import tornado.httpserver
import tornado.ioloop
import tornado.wsgi
import sys
import django.core.handlers.wsgi
#sys.path.append('/home/lawgon/') # path to your project ( if you have it 
in another dir).

def main():
os.environ['DJANGO_SETTINGS_MODULE'] = 'revista.settings' # path to 
your settings module
application = django.core.handlers.wsgi.WSGIHandler()
container = tornado.wsgi.WSGIContainer(application)
http_server = tornado.httpserver.HTTPServer(container)
http_server.listen()
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()

so... i whis try tornado in VPS production becouse is more simple to 
configure ;)  


the only probles is i need ever up, and i dont know who to check if tornado 
runs whit crontab  and restart if dont run..

Sujestions? 

this vps is for thest little proyects whit 100 visits/day so i dont have a 
problem for tornado performance

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




Best ways and common practices to lock the Database before a new deploy

2013-02-21 Thread Santiago Basulto
Hello guys,

we've our app that's working awesome. We do a new release each week.
We've set up a nice deployment process using fabric and everything
works great.

The problem is that, as the application grows, it takes some time to
perform the deploy. And we're using South, so sometimes we need to
migrate some big tables.

So, the questions are:

* How should I lock my DB in the moment of the deployment? Should I
use different DB users at that moment?

* What other strategies do you use at the moment of the deployment you
can recommend?

Thank you very much!

-- 
Santiago Basulto.-

-- 
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 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread Martin J. Laubach

>
> return getpass.getuser().decode(locale.getdefaultlocale()[1])
> TypeError: decode() argument 1 must be string, not None
>

  It needs a valid locale to be set in the environment. Try setting 
LC_ALL=en_US before running syncdb.

mjl

-- 
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: How to install Django 1.4.5 in python 3.2.3?

2013-02-21 Thread Karen Tracey
You don't. Python 3 support comes with Django 1.5, it's not available with
1.4.x.

Karen

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




How to install Django 1.4.5 in python 3.2.3?

2013-02-21 Thread rilou007


-- 
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 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread lucien
Hi,

I have done that:

 python ./manage.py shell
 >>> from django.contrib.auth.models import User
 >>> user = User.objects.create_user(username='foo', email="",  
password="")
 >>> user.is_superuser=True
 >>> user.save
 >>> user.get_all_permissions()

Thanks,
Lucien


Le jeudi 21 février 2013 15:45:18 UTC+1, ke1g a écrit :
>
> One workaround would be to forgo creation at syncdb time and use the 
> manage.py shell to create a user, set its superuser boolean, and save it.
>
> On Thu, Feb 21, 2013 at 9:40 AM, lucien  > wrote:
>
>> Hi,
>>
>> Thanks for your quick answer, I removed the 1.4.4 version and it works 
>> but when I answer yes to define sperusers I got an error,
>> is there any workaround to create a superuser ?
>>
>> You just installed Django's auth system, which means you don't have any 
>> superusers defined.
>> Would you like to create one now? (yes/no): yes
>> Traceback (most recent call last):
>>   File "manage.py", line 10, in 
>> execute_from_command_line(sys.argv)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", 
>> line 443, in execute_from_command_line
>> utility.execute()
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", 
>> line 382, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
>> line 196, in run_from_argv
>> self.execute(*args, **options.__dict__)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
>> line 232, in execute
>> output = self.handle(*args, **options)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
>> line 371, in handle
>> return self.handle_noargs(**options)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/syncdb.py",
>>  
>> line 110, in handle_noargs
>> emit_post_sync_signal(created_models, verbosity, interactive, db)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/sql.py", 
>> line 189, in emit_post_sync_signal
>> interactive=interactive, db=db)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/dispatch/dispatcher.py", 
>> line 172, in send
>> response = receiver(signal=self, sender=sender, **named)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py",
>>  
>> line 73, in create_superuser
>> call_command("createsuperuser", interactive=True, database=db)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", 
>> line 150, in call_command
>> return klass.execute(*args, **defaults)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
>> line 232, in execute
>> output = self.handle(*args, **options)
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/commands/createsuperuser.py",
>>  
>> line 70, in handle
>> default_username = get_default_username()
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py",
>>  
>> line 105, in get_default_username
>> default_username = get_system_username()
>>   File 
>> "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py",
>>  
>> line 85, in get_system_username
>> return getpass.getuser().decode(locale.getdefaultlocale()[1])
>> TypeError: decode() argument 1 must be string, not None
>>
>>
>>
>>
>>
>> Le jeudi 21 février 2013 15:20:01 UTC+1, Karen Tracey a écrit :
>>>
>>> On Thu, Feb 21, 2013 at 9:09 AM, lucien  wrote:
>>>
 Hi,

 I tried the 1.4.5 because I got the same error with ubuntu and postgres
 Do you have any idea? 

>>>
>>> Did you remove the 1.4.4 install before installing 1.4.5? 
>>>
>>>
>>>  -- 
>> 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.




Re: session is not expiring

2013-02-21 Thread Jani Tiainen
I'm not sure but I think if you have background processes on and running 
in Chrome it doesn't actually ever close browser.


Excerpt from 
:


"Under advanced settings I unchecked 'Continue running background apps 
when Google Chrome is closed' and my session cookies started working as 
they should."



21.2.2013 16:15, Aswani Kumar kirjoitti:

i set file based sessions and the sessions are not expiring even after
closing browser. its the issues in chrome but firefox is good. how can i
fix it.

here is my config

MIDDLEWARE_CLASSES = (
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
)


SESSION_ENGINE = 'django.contrib.sessions.backends.file'

SESSION_EXPIRE_AT_BROWSER_CLOSE = True

SESSION_FILE_PATH = os.getenv("HOME") + '/sessions'

INSTALLED_APPS = (
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
..

--
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: django 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread Bill Freeman
One workaround would be to forgo creation at syncdb time and use the
manage.py shell to create a user, set its superuser boolean, and save it.

On Thu, Feb 21, 2013 at 9:40 AM, lucien  wrote:

> Hi,
>
> Thanks for your quick answer, I removed the 1.4.4 version and it works
> but when I answer yes to define sperusers I got an error,
> is there any workaround to create a superuser ?
>
> You just installed Django's auth system, which means you don't have any
> superusers defined.
> Would you like to create one now? (yes/no): yes
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
> line 443, in execute_from_command_line
> utility.execute()
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
> line 382, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
> line 196, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
> line 232, in execute
> output = self.handle(*args, **options)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
> line 371, in handle
> return self.handle_noargs(**options)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/syncdb.py",
> line 110, in handle_noargs
> emit_post_sync_signal(created_models, verbosity, interactive, db)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/sql.py",
> line 189, in emit_post_sync_signal
> interactive=interactive, db=db)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/dispatch/dispatcher.py",
> line 172, in send
> response = receiver(signal=self, sender=sender, **named)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py",
> line 73, in create_superuser
> call_command("createsuperuser", interactive=True, database=db)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
> line 150, in call_command
> return klass.execute(*args, **defaults)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
> line 232, in execute
> output = self.handle(*args, **options)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/commands/createsuperuser.py",
> line 70, in handle
> default_username = get_default_username()
>   File
> "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py",
> line 105, in get_default_username
> default_username = get_system_username()
>   File
> "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py",
> line 85, in get_system_username
> return getpass.getuser().decode(locale.getdefaultlocale()[1])
> TypeError: decode() argument 1 must be string, not None
>
>
>
>
>
> Le jeudi 21 février 2013 15:20:01 UTC+1, Karen Tracey a écrit :
>>
>> On Thu, Feb 21, 2013 at 9:09 AM, lucien  wrote:
>>
>>> Hi,
>>>
>>> I tried the 1.4.5 because I got the same error with ubuntu and postgres
>>> Do you have any idea?
>>>
>>
>> Did you remove the 1.4.4 install before installing 1.4.5?
>>
>>
>>  --
> 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: django 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread lucien
Hi,

Thanks for your quick answer, I removed the 1.4.4 version and it works 
but when I answer yes to define sperusers I got an error,
is there any workaround to create a superuser ?

You just installed Django's auth system, which means you don't have any 
superusers defined.
Would you like to create one now? (yes/no): yes
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", 
line 443, in execute_from_command_line
utility.execute()
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", 
line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
line 196, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
line 232, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
line 371, in handle
return self.handle_noargs(**options)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/commands/syncdb.py",
 
line 110, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/sql.py", 
line 189, in emit_post_sync_signal
interactive=interactive, db=db)
  File 
"/usr/local/lib/python2.6/dist-packages/django/dispatch/dispatcher.py", 
line 172, in send
response = receiver(signal=self, sender=sender, **named)
  File 
"/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py",
 
line 73, in create_superuser
call_command("createsuperuser", interactive=True, database=db)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", 
line 150, in call_command
return klass.execute(*args, **defaults)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
line 232, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/commands/createsuperuser.py",
 
line 70, in handle
default_username = get_default_username()
  File 
"/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py",
 
line 105, in get_default_username
default_username = get_system_username()
  File 
"/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py",
 
line 85, in get_system_username
return getpass.getuser().decode(locale.getdefaultlocale()[1])
TypeError: decode() argument 1 must be string, not None





Le jeudi 21 février 2013 15:20:01 UTC+1, Karen Tracey a écrit :
>
> On Thu, Feb 21, 2013 at 9:09 AM, lucien  > wrote:
>
>> Hi,
>>
>> I tried the 1.4.5 because I got the same error with ubuntu and postgres
>> Do you have any idea? 
>>
>
> Did you remove the 1.4.4 install before installing 1.4.5? 
>
>
>

-- 
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 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread Karen Tracey
On Thu, Feb 21, 2013 at 9:09 AM, lucien  wrote:

> Hi,
>
> I tried the 1.4.5 because I got the same error with ubuntu and postgres
> Do you have any idea?
>

Did you remove the 1.4.4 install before installing 1.4.5?

-- 
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 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread lucien
Hi,

I tried the 1.4.5 because I got the same error with ubuntu and postgres
Do you have any idea? 

Regards,
Lucien


python -c "import django; print(django.get_version())"
1.4.5

 python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", 
line 443, in execute_from_command_line
utility.execute()
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", 
line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
line 196, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
line 232, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", 
line 371, in handle
return self.handle_noargs(**options)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/commands/syncdb.py",
 
line 40, in handle_noargs
import_module('.management', app_name)
  File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", 
line 35, in import_module
__import__(name)
ImportError: Bad magic number in 
/usr/local/lib/python2.6/dist-packages/django/contrib/sessions/management/__init__.pyc

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




session is not expiring

2013-02-21 Thread Aswani Kumar
i set file based sessions and the sessions are not expiring even after 
closing browser. its the issues in chrome but firefox is good. how can i 
fix it.

here is my config

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)


SESSION_ENGINE = 'django.contrib.sessions.backends.file'

SESSION_EXPIRE_AT_BROWSER_CLOSE = True

SESSION_FILE_PATH = os.getenv("HOME") + '/sessions'

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
..

-- 
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: understand the run_validators function.

2013-02-21 Thread Sergiy Khohlov
form is valid if all field pass validator

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Thu, Feb 21, 2013 at 2:30 PM, ANKIT BAGARIA wrote:

> i am not able to understand the code of run_validators() function in
> fields.py file under forms folder. Someone please help.
>
> --
> 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.




HTML5 Offline apps with Django 1.4

2013-02-21 Thread Ranjith Chaz
Trying to implement *offline** *feature of *HTML5*.  Deployed in 
*apache2.2*with 
mod_wsgi plugin.
It works as expected (i.e., loads the cached page when offline) in chrome, 
Opera (using window.openDatabase) and other desktop browsers. However it 
doesn't work in Android 2.x, iPhone default browsers. Strangely, it works 
with Android 4.0 browser!!
Here is the code:

*HTML*



   

  MyHomeStuff  
  
  
   
   
 .
   



*Apache conf\mime.types**text/cache-manifest manifest*

*
*

*\Python27\Lib\mimetypes.py*
Added *'.manifest': 'text/cache-manifest'*, into *types_map *dict

(With the above addition to mimetypes.py, it started working for android 4.0)


*cache.manifest*CACHE MANIFEST
CACHE:index.htmlMyHomeStuff.js


*views.py:*

def offlineApp(request):
t = get_template('index.html')
html = t.render(Context({'MEDIA_URL':'http://myDomain.com/site_media/'}))
return HttpResponse(html)


*Is it required to use any specific module/middleware to handle text/manifest 
in django ?*

Any help is appreciated. Already spent a lot of time on this!


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




understand the run_validators function.

2013-02-21 Thread ANKIT BAGARIA
i am not able to understand the code of run_validators() function in 
fields.py file under forms folder. Someone please help.

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




IRC freenode channel

2013-02-21 Thread ANKIT BAGARIA
Why is it that when ever I am not able to open django's channel on 
irc.freenode.net.. Please help. Thankyou.

-- 
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: Defining a different name for the key field in ForeignKey

2013-02-21 Thread Daniel Roseman
On Thursday, 21 February 2013 10:20:01 UTC, Vittorio wrote:

> I'm working on a legacy mysql db (under Mac OS X with Django 1.4.3) whose 
> structure I cannot modify because other applications are already happily 
> referring to it (FileMaker pro, PHP,etc.). 
> After issuing the 'python manage.py inspectdb' I created the first 
>  tentative models.py that I'm now refining specifically to take into 
> account foreign keys. 
> Now, manage.py both syncdb and runserver don't signal anything abnormal 
> but when I browse the table articoli as admin the following two tables and 
> classes are arising a problem because 
>
> (1054, "Unknown column 'articoli.categoria_id_id' in 'field list'") 
>
>  
> ... 
> class Categorie(models.Model): 
> idCategoria = models.IntegerField(primary_key=True) 
> descrizione = models.CharField(max_length=150, 
> db_column='Descrizione') # Field name made lowercase. 
> def __unicode__(self): 
> return self.descrizione 
> class Meta: 
> db_table = u'Categorie' 
> verbose_name_plural='categorie' 
> ordering=['descrizione'] 
>
>
> class Articoli(models.Model): 
> id = models.IntegerField(primary_key=True) 
> categoria_id = models.ForeignKey(Categorie) 
> codice = models.CharField(max_length=90, unique=True, 
> db_column='Codice') 
> ... 
> ... 
>  
>
> How can I specify in categoria_id of class Articoli that the key field to 
> refer to is idCategoria of Categorie? 
>
> Ciao 
> Vittorio 
>
>
>
In exactly the same way you've done elsewhere, by using `db_column`.
I would definitely recommend calling the model field `categoria` without 
the `_id`  though, as it is not an id, it's a reference to the entire 
related model instance.
--
DR.

-- 
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: can someone rewrite this line please

2013-02-21 Thread MikeKJ
Thank you Mark spot on!

Really appreciate it




On Wednesday, February 20, 2013 3:58:28 PM UTC, Mark wrote:
>
> Not sure if you need the json.large to be compiled or if that should be 
> part of the string. The biggest issue was you had a single-quote before 
> onmouseover. After that, you have to escape the single-quote before  src and either escape the + json.large + or leave it so that Type will 
> compile it. Give this a try, I think it is what you want:
>
> large = ' src="'+json.large+'"/>\',LEFT, true, OFFSETY, -250, OFFSETX, 0, WIDTH, 
> 800)\" target=\"_blank\">';
>
> FYI: if you use an IDE like Eclipse, it will show you what is and isn't 
> escaped to some degree, using colored text to denote quoted strings versus 
> compiled commands.
>
> Cheers,
>
> Mark
>
> On Wed, Feb 20, 2013 at 6:25 AM, MikeKJ  > wrote:
>
>> large = '> src='+json.large+'/>',LEFT, true, OFFSETY, -250, OFFSETX, 0, WIDTH, 800)\" 
>> target=\"_blank\">';
>>
>> so that is comes out of the jquery call as proper html, it needs more 
>> escaping somewhere but damned if I can see it.
>>
>> -- 
>> 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.




Re: comment templates

2013-02-21 Thread Pankaj Singh
>
> so this means enabling the comment app will not render comments
> anywhere and developer needs to manually choose to include it in page
> templates

Yes.

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Thu, Feb 21, 2013 at 3:38 PM, yakoub abaya wrote:

>
> thank you, so this means enabling the comment app will not render comments
> anywhere
> and developer needs to manually choose to include it in page templates
>
>
> On Thursday, February 21, 2013 11:54:34 AM UTC+2, psjinx wrote:
>
>> Hey,
>>
>> From Django Docs (https://docs.djangoproject.**com/en/1.4/ref/contrib/**
>> comments/#quickly-rendering-a-**comment-list
>> )
>>
>> The easiest way to display a list of comments for some object is by using
>> render_comment_list
>> :
>>
>> {% render_comment_list for [object] %}
>>
>> For example:
>>
>> {% render_comment_list for event %}
>>
>> This will render comments using a template named comments/list.html, a
>> default version of which is included with Django.
>>
>> Sincerely,
>> Pankaj Singh
>> http://about.me/psjinx
>>
>>
>> On Thu, Feb 21, 2013 at 3:22 PM, yakoub abaya wrote:
>>
>>>  can someone please explain where and how this template :
>>> django/contrib/comments/**templates/comments/list.html
>>> gets rendered into the main page html template ?
>>>
>>> --
>>> 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.
>
>
>

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




ask : Make a second-level auth

2013-02-21 Thread Bino Oetomo
Dear All.

I try to write what I call as 'l2auth' or '2nd Level Auth'
it's :
1. because my application will be co-use by some 'company'
2. because I want to delegate user administration to each company
3. I want user login with username format as user@company (it is not
an email)
4. Basically a copy-paste-modify from django auth.

I made a pastebin of the  app's models at http://pastebin.com/6iqCXJY6
and this is what syncdb generate : http://oi50.tinypic.com/2rlz18p.jpg

This is How I 'register' the my backend in settings.py
---START--
AUTHENTICATION_BACKENDS = ('l2auth.backends.L2Backend',
'django.contrib.auth.backends.ModelBackend',
)
STOP--

And this is my backend.py at http://pastebin.com/u1WVPV8s


I try to login : http://oi47.tinypic.com/20hx1sj.jpg
and it's failed : http://oi48.tinypic.com/35kv89c.jpg

Next I do a test from django shell --> http://pastebin.com/C0Q7v0u5

Question :
1. Did I missed somethings ? what is it ?
2. Why the l2auth_l2user.password field did not hashed ?

I realy appreciate any enlightment, clue, etc etc.

Sincerely
-bino-

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




Defining a different name for the key field in ForeignKey

2013-02-21 Thread Vittorio
I'm working on a legacy mysql db (under Mac OS X with Django 1.4.3) whose 
structure I cannot modify because other applications are already happily 
referring to it (FileMaker pro, PHP,etc.).
After issuing the 'python manage.py inspectdb' I created the first  tentative 
models.py that I'm now refining specifically to take into account foreign keys. 
Now, manage.py both syncdb and runserver don't signal anything abnormal but 
when I browse the table articoli as admin the following two tables and classes 
are arising a problem because

(1054, "Unknown column 'articoli.categoria_id_id' in 'field list'")
  

...
class Categorie(models.Model):
idCategoria = models.IntegerField(primary_key=True)
descrizione = models.CharField(max_length=150, db_column='Descrizione') # 
Field name made lowercase.
def __unicode__(self):
return self.descrizione
class Meta:
db_table = u'Categorie'
verbose_name_plural='categorie'
ordering=['descrizione']


class Articoli(models.Model):
id = models.IntegerField(primary_key=True)
categoria_id = models.ForeignKey(Categorie)
codice = models.CharField(max_length=90, unique=True, db_column='Codice') 
...
...


How can I specify in categoria_id of class Articoli that the key field to refer 
to is idCategoria of Categorie?

Ciao
Vittorio


-- 
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: comment templates

2013-02-21 Thread yakoub abaya

thank you, so this means enabling the comment app will not render comments 
anywhere
and developer needs to manually choose to include it in page templates

On Thursday, February 21, 2013 11:54:34 AM UTC+2, psjinx wrote:
>
> Hey,
>
> From Django Docs (
> https://docs.djangoproject.com/en/1.4/ref/contrib/comments/#quickly-rendering-a-comment-list
> )
>
> The easiest way to display a list of comments for some object is by using 
> render_comment_list
> :
>  
> {% render_comment_list for [object] %}
>
> For example:
>
> {% render_comment_list for event %}
>
> This will render comments using a template named comments/list.html, a 
> default version of which is included with Django.
>
> Sincerely,
> Pankaj Singh
> http://about.me/psjinx
>
>
> On Thu, Feb 21, 2013 at 3:22 PM, yakoub abaya 
>  > wrote:
>
>> can someone please explain where and how this template :
>> django/contrib/comments/templates/comments/list.html
>> gets rendered into the main page html template ? 
>>
>> -- 
>> 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.




Re: comment templates

2013-02-21 Thread Pankaj Singh
Hey,

>From Django Docs (
https://docs.djangoproject.com/en/1.4/ref/contrib/comments/#quickly-rendering-a-comment-list
)

The easiest way to display a list of comments for some object is by using
render_comment_list
:

{% render_comment_list for [object] %}

For example:

{% render_comment_list for event %}

This will render comments using a template named comments/list.html, a
default version of which is included with Django.

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Thu, Feb 21, 2013 at 3:22 PM, yakoub abaya wrote:

> can someone please explain where and how this template :
> django/contrib/comments/templates/comments/list.html
> gets rendered into the main page html template ?
>
> --
> 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.




comment templates

2013-02-21 Thread yakoub abaya
can someone please explain where and how this template :
django/contrib/comments/templates/comments/list.html
gets rendered into the main page html template ?

-- 
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 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread Xavier Ordoquy
Hi,

You should consider upgrading to 1.4.5 which fixes that issue.

Best regards,
Xavier

Le 21 févr. 2013 à 09:00, Frank Bieniek  a 
écrit :

> Hi,
> we are using jenkins to build our django stack,
> we changed the django version from 1.4.3 to 1.4.4.
> this results in a
> 
> ImportError: Bad magic number in 
> /x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/contrib/sessions/management/__init__.pyc
> 
> Even deleting all pyc files does not solve the problem.
> We are using python 2.5 on solaris.
> 
> Any suggestion would help, digging the net has not shown fix, beside delete 
> pyc files.
> 
> The same problem appears on another project updating from 1.3.5 to 1.3.6
> 
> Thanks
> Frank
> 
> Traceback below
> 
> 
> Creating test database for alias 'default'...
> Traceback (most recent call last):
>  File "/x86build/dpp/opt/django-auth/authhub/manage.py", line 24, in 
>execute_manager(settings)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/__init__.py",
>  line 459, in execute_manager
>utility.execute()
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/__init__.py",
>  line 382, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
>  line 196, in run_from_argv
>self.execute(*args, **options.__dict__)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
>  line 232, in execute
>output = self.handle(*args, **options)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django_jenkins/management/commands/__init__.py",
>  line 81, in handle
>if test_runner.run_tests(test_labels):
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/test/simple.py",
>  line 381, in run_tests
>old_config = self.setup_databases()
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django_jenkins/runner.py",
>  line 260, in setup_databases
>return super(CITestSuiteRunner, self).setup_databases()
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/test/simple.py",
>  line 317, in setup_databases
>self.verbosity, autoclobber=not self.interactive)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/db/backends/creation.py",
>  line 271, in create_test_db
>load_initial_data=False)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/__init__.py",
>  line 150, in call_command
>return klass.execute(*args, **defaults)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
>  line 232, in execute
>output = self.handle(*args, **options)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
>  line 371, in handle
>return self.handle_noargs(**options)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/commands/syncdb.py",
>  line 40, in handle_noargs
>import_module('.management', app_name)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/utils/importlib.py",
>  line 35, in import_module
>__import__(name)
> ImportError: Bad magic number in 
> /x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/contrib/sessions/management/__init__.pyc
> 
> Fatal error: local() encountered an error (return code 1) while executing '. 
> /x86build/dpp/opt/django-auth-venv/bin/activate && python 
> /x86build/dpp/opt/django-auth/authhub/manage.py jenkins'
> 
> 
> 
> -- 
> 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.




django 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread Frank Bieniek

Hi,
we are using jenkins to build our django stack,
we changed the django version from 1.4.3 to 1.4.4.
this results in a

ImportError: Bad magic number in 
/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/contrib/sessions/management/__init__.pyc

Even deleting all pyc files does not solve the problem.
We are using python 2.5 on solaris.

Any suggestion would help, digging the net has not shown fix, beside delete pyc 
files.

The same problem appears on another project updating from 1.3.5 to 1.3.6

Thanks
Frank

Traceback below


Creating test database for alias 'default'...
Traceback (most recent call last):
  File "/x86build/dpp/opt/django-auth/authhub/manage.py", line 24, in 
execute_manager(settings)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/__init__.py",
 line 459, in execute_manager
utility.execute()
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/__init__.py",
 line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
 line 196, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
 line 232, in execute
output = self.handle(*args, **options)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django_jenkins/management/commands/__init__.py",
 line 81, in handle
if test_runner.run_tests(test_labels):
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/test/simple.py",
 line 381, in run_tests
old_config = self.setup_databases()
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django_jenkins/runner.py",
 line 260, in setup_databases
return super(CITestSuiteRunner, self).setup_databases()
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/test/simple.py",
 line 317, in setup_databases
self.verbosity, autoclobber=not self.interactive)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/db/backends/creation.py",
 line 271, in create_test_db
load_initial_data=False)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/__init__.py",
 line 150, in call_command
return klass.execute(*args, **defaults)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
 line 232, in execute
output = self.handle(*args, **options)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
 line 371, in handle
return self.handle_noargs(**options)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/commands/syncdb.py",
 line 40, in handle_noargs
import_module('.management', app_name)
  File 
"/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/utils/importlib.py",
 line 35, in import_module
__import__(name)
ImportError: Bad magic number in 
/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/contrib/sessions/management/__init__.pyc

Fatal error: local() encountered an error (return code 1) while executing '. 
/x86build/dpp/opt/django-auth-venv/bin/activate && python 
/x86build/dpp/opt/django-auth/authhub/manage.py jenkins'



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