Re: molecular formulae

2012-01-05 Thread Mike Dewhirst
I think I have found a workaround but it will probably blow up in my 
face due to encoding/decoding things I don't fully understand.


Can anyone comment on the robustness of calling the following method in 
a model's save() ...


"""
def subscript(self):
formula = u''
if self.formula:
for char in self.formula:
if char == '2':
char = u'\u2082'
elif char == '3':
char = u'\u2083'
elif char == '4':
char = u'\u2084'
elif char == '5':
char = u'\u2085'
elif char == '6':
char = u'\u2086'
elif char == '7':
char = u'\u2087'
elif char == '8':
char = u'\u2088'
elif char == '9':
char = u'\u2089'
elif char == '0':
char = u'\u2080'
elif char == '1':
char = u'\u2081'
else:
char = char.upper()
formula += char
return formula

"""

... which seems to work even when re-saving. The subscripts seem to be 
interpreted as numbers too.


Thanks

Mike


On 6/01/2012 3:08pm, Mike Dewhirst wrote:

Does anyone know of a Django widget for representing molecula formulae?

For example, entering h2o would display with the 2 subscripted and the h
and o both uppercased.

Thanks

Mike



--
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: Skip upload of existing S3 Object

2012-01-05 Thread Chris Hasenpflug
The reason I'm POSTing after the direct upload to S3 I need to create
the model with extra data. As far as I can tell S3's
success_action_redirect doesn't allow you to pass additional
information.

Additionally, since this is an ImageField, I can't set the key
directly. At the moment, I've resorted to Raw SQL :(  What have I
missed?

On Jan 1, 3:45 pm, Ivo Brodien  wrote:
> Hi,
>
> the form sends the picture to S3 and then S3 calls you on an URL which you 
> specify with “ success_action_redirect”. This should point to an URL on your 
> server where you then store the key/hash which will be provided in the URL.
>
> Your code uses POST data but S3 will put the metadata in the URL (=GET) 
> (bucket, key and etag)
>
> So just make sure that your forms posts to S3 and you define the 
> success_action_redirect URL.
>
> I think you actually don’t need the S3StorageBackend since you are not 
> storing anything or at least it does not actually pass your server.
>
> hope that helps!
>
> Cheers
> Ivo
>
> On Jan 1, 2012, at 12:25 , Chris Hasenpflug wrote:
>
>
>
>
>
>
>
> > I have a model with an ImageField and am using django-storages
> > S3BotoStorage backend. To reduce load on the server, I'm using
> > Amazon's S3 Browser Upload functionality[1] to send images directly to
> > S3. In order to create the model, my plan is have another view take
> > the uploaded key and save a model instance of my image.  Currently my
> > view code looks something like this:
>
> > def add_existing_image(request):
> >    ...
> >    image_key = request.POST.get('image_key', None)
> >    im = default_storage.open(image_key)
> >    i = Image(image=im, owner=user)
>
> > However, this seems to re-save the image on S3. I was hoping that
> > since I'm not directly reading the file it would not need to do so
> > behind the scenes, but it is. Since the goal is to not incur that
> > overhead, how should I go about creating model instances of these
> > files that already exist in my storage?
>
> > [1]http://aws.amazon.com/articles/1434
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

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



molecular formulae

2012-01-05 Thread Mike Dewhirst

Does anyone know of a Django widget for representing molecula formulae?

For example, entering h2o would display with the 2 subscripted and the h 
and o both uppercased.


Thanks

Mike

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



Re: how to avoid pk collisions at loaddata time

2012-01-05 Thread Russell Keith-Magee
On Thu, Jan 5, 2012 at 11:39 PM, Anshuman Aggarwal
 wrote:
> Russ,
>  Just wanted to pick up an old thread about loading fixtures without
> PK ...isn't this now a natural extension of the natural_key support
> that was included in Django 1.2? Anybody else for whom this is a big
> enough itch?

It's not completely related. Adding natural keys meant providing an
alternate way to find existing objects. Generating objects without a
PK is a different type of PK handling again.

Yes, it's an itch for me, but not a huge one. I've also got a lot of
non-Django related stuff on my plate at the moment, so unless
something is causing spontaneous combustion, I haven't really got the
cycles to look into it myself.

The good news is that I'm almost certain that there's a ticket for
this feature in Trac somewhere, and I'm not the only Django core dev
-- hunt down the ticket, and poke around on django-dev on IRC, and you
might be able to find someone to help you shepherd this into trunk for
1.4 (I think SmileyChris expressed some interest in the idea at one
point -- Chris... am I remembering correctly?)

Yours,
Russ Magee %-)

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



Re: django/Data Base Advice

2012-01-05 Thread Petite Abeille

On Jan 6, 2012, at 12:13 AM, Chris Kavanagh wrote:

> I believe, thanks to your (previous) post, I was confused as to the
> difference between SQL and Database in general. I had thought learning
> SQL was learning database design. When in actuality, it's just the
> language used to access databases. I need to study database concepts
> and design.

There are two main aspects to SQL:  Data Definition Language (DDL [1]) and Data 
Manipulation Language (DML [2]).

DDL is was you design database with (create table, etc). DML is what you 
interact database with (select, update, etc).

In the same way as it's rather helpful to understand HTTP itself to build a web 
application, it's rather essential to understand database design if you build a 
database, irrespectively of sugar coating (ORM [3], MVC, and other TLA).

Learn about normalization [3].

Take a look at SQLite to get started [4][5].

In the meantime:

Double-thinking in SQL
http://explainextended.com/2009/07/12/double-thinking-in-sql/

Also:
http://browsertoolkit.com/fault-tolerance.png

[1] http://en.wikipedia.org/wiki/Data_Definition_Language
[2] http://en.wikipedia.org/wiki/Data_Manipulation_Language
[3] http://en.wikipedia.org/wiki/Database_normalization
[4] http://www.sqlite.org/
[5] http://www.sqlite.org/lang.html

-- 
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: project root or its parent in pythonpath?

2012-01-05 Thread d.w. harks

On Thursday, January 05, 2012 2:21:30 PM, Demetrio Girardi wrote:


I have two apps which are inter-dependent and import stuff from one
another; if I decide to go for the project.app route, is there a way 
to import
things without a reference to the project name? otherwise the imports 
would

have to be rewritten when the apps are installed in another projcet.



If you have two apps that import from one another, then I'd suggest 
merging them into a single app -- it indicates that the features of the 
two are coupled and not useful without each other anyhow.


That said, I would vote that it's better to add to your PYTHONPATH in 
the IDE settings than it is to have the apps import stuff via an 'import 
project.app'.


--
David W. Harks

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



Re: django/Data Base Advice

2012-01-05 Thread Chris Kavanagh


On Jan 5, 2:54 pm, Lie Ryan  wrote:
> On 01/06/2012 02:35 AM, Dennis Lee Bieber wrote:
>
> > Django's models are just a means to define those independent of engine
> > specific notation.
>
> while introducing django-specific notation, which generally maps more
> neatly to the theoretical foundation than SQL (while SQL maps more
> neatly to the implementation of database system).
>
> In particular, in django the concept of primary keys is implemented as
> autoincrementing integers is well hidden from you, and django's foreign
> keys is a full-fledged objects instead of integers with a few restrictions.

I believe, thanks to your (previous) post, I was confused as to the
difference between SQL and Database in general. I had thought learning
SQL was learning database design. When in actuality, it's just the
language used to access databases. I need to study database concepts
and design.

And I think that probably concludes my question to this post. While
knowing SQL will be helpful, I believe I need to learn some about
general database concepts.

THANKS TO EVERYONE who helped me!!! It's very much appreciated, and I
do mean that sincerely. Thanks for taking your time to help a novice.

-- 
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: This Week In History

2012-01-05 Thread Thorsten Sanders

You dont mention the database you use if mysql you could do

SELECT * FROM  WHERE DATE_FORMAT(, "%u") = 
DATE_FORMAT(curdate(), "%u")


dont know if there is a django orm way to do it, but could always use a 
raw query.


Am 05.01.2012 21:14, schrieb Tim Sawyer:

Hi Folks,

Does anyone have a strategy for selecting from a database where the 
date is this week, but a random year in the past?


I have ~100 years of events in a database, each with a datefield - I 
would like to do a "this week in history" box that lists one or two on 
the homepage, randomly taken from the set.


Ideas/pointers appreciated.

Cheers,

Tim.



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



Re: django/Data Base Advice

2012-01-05 Thread Chris Kavanagh


On Jan 5, 10:35 am, Dennis Lee Bieber  wrote:
> On Wed, 4 Jan 2012 17:50:41 -0800 (PST), Chris Kavanagh

>
>         While my comment regarding MVC has been shot down by others, I'll
> still stand by the comment regarding relational database theory: the
> first three Codd Normal Forms and related concepts. These are
> independent of the actual database engine used in the end. Knowing what
> to put into a relation (in formal theory, what folks commonly call a
> "table" is the "relation" -- not the links from one table to another)...
> Django's models are just a means to define those independent of engine
> specific notation.
>
>         SQL, originally (when it was IBM's Sequel), was a pure query
> language sort of combining bits of relational algebra and relational
> calculus. It was supposed to be usable even with hierarchical or network
> database systems (though the backend code generator had to be fairly
> complex, compared to simple flat-file systems which many relational
> engines work as -- MySQL, dBase, Foxpro all use individual files for
> each relation [table]).
>
>         Knowing SQL in general can give some insights into what Django is
> doing behind the scenes for the 1<>many and many<>many linkages.
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         wlfr...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

After reading the posts concerning whether it's an MVC or  MTV here's
what the book says: "Django follows the MVC pattern closely enough
that it CAN be called an MVC framework."

I just thought I'd post that to be fair. . .Thanks Dennis.

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



Re: django/Data Base Advice

2012-01-05 Thread Chris Kavanagh


On Jan 5, 3:58 am, Lie Ryan  wrote:
> On 01/05/2012 01:01 PM, Chris Kavanagh wrote:
>
>
> While learning SQL could be helpful for writing fine-tuned SQL queries,
> IMO it doesn't really help much to design an effective database. To
> design an effective database schema, you need to learn about database,
> not (just) SQL. Learn about basic database concept such as primary and
> foreign keys, data modelling, and normalization (up to 3rd or 4th level
> normalization is generally good enough for all practical purposes).

Ok, I just learned something. I THOUGHT SQL WAS learning Database!!!
So, SQL is really just the language used to interact with databases,
not really the database itself??? I need to Google database concepts
and learn that, not just SQL?? I assume that's what you're saying Lie.

And THANKS for the advice.

-- 
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: Users getting logged out frequently

2012-01-05 Thread Javier Guerra Giraldez
On Thu, Jan 5, 2012 at 2:35 PM, Dennis Lee Bieber  wrote:
>        That would have to be a very erratic clock setting -- are there
> systems that don't use an NTP server to synchronize the clock? (I think
> all of my computers synchronize on a weekly basis).

virtual machines can have terribly erratic clock behaviour.  over a
minute of error in an hour is not unheard of.  of course, most
hypervisors now specifically handle this problem and keep the VM's
clock a lot more stable

NTP is the solution, but it's not as trivial to do correctly enough as
in real hardware.

-- 
Javier

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



Re: Pointing to Memcached on Remote Server

2012-01-05 Thread mattym
Thanks again everyone

The solution was a quick adjustment in memcached.conf.

Changing
-l 127.0.0.1
to
-l 0.0.0.0

Matt

On Dec 5 2011, 1:27 pm, mattym  wrote:
> Thanks all -
>
> I stepped away from this issue for a few days.  I am confident this
> thread will point me in the right direction.
>
> I did notice with nmap I am getting:
>
> PORT      STATE  SERVICE
> 11211/tcp closed unknown
>
> I will be digging into this issue again soon and this thread helps!
> Thanks again
>
> On Dec 3, 1:43 pm, huseyin yilmaz  wrote:
>
>
>
>
>
>
>
> > Also checkmemcachedconfiguration (/etc/memcached.conf)
> > from this file,you can limit IP addresses thatmemcachedlistening to
> > here is a configuration parameter that you might have
>
> > # Specify which IP address to listen on. The default is to listen on
> > all IP
> > addresses
> > # This parameter is one of the only security measures thatmemcached
> > has, so make
> > sure
> > # it's listening on a firewalled
> > interface.
> > #-l 127.0.0.1
>
> > On Dec 2, 3:49 am, mattym  wrote:
>
> > > Hi all -
>
> > > I am stuck on this one. Caching withmemcachedworks when I reference
> > > the local box holding Django. But when I point my setting to aremote
> > > box it does not cache:
>
> > > This is with Django 1.3 using python-memcachedon the localbox in a
> > > virtualenv
>
> > >  'default': {
> > >         'BACKEND':
> > > 'django.core.cache.backends.memcached.MemcachedCache',
> > >         #'LOCATION': ['127.0.0.1:11211',]  # This works
> > >         'LOCATION': ['xx.xxx.xxx.xx:11211',]  # Thisremoteone does not
> > >     }
>
> > > My settings file appears to have the proper middleware installed:
>
> > >  "django.middleware.gzip.GZipMiddleware",
> > >   "django.middleware.cache.UpdateCacheMiddleware",
> > >     "django.contrib.sessions.middleware.SessionMiddleware",
> > >     "django.contrib.auth.middleware.AuthenticationMiddleware",
> > >     "django.contrib.redirects.middleware.RedirectFallbackMiddleware",
> > >     "mezzanine.core.middleware.DeviceAwareUpdateCacheMiddleware",
> > >     "django.middleware.common.CommonMiddleware",
> > >     "django.middleware.csrf.CsrfViewMiddleware",
> > >     "mezzanine.core.middleware.DeviceAwareFetchFromCacheMiddleware",
> > >     "mezzanine.core.middleware.AdminLoginInterfaceSelector",
> > >     "django.middleware.cache.FetchFromCacheMiddleware",
>
> > > I've checked thatmemcachedis running on theremotebox. I am
> > > probably overlooking something simple.
> > > Any help is greatly appreciated.
>
> > > Thanks,
> > > Matt

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



project root or its parent in pythonpath?

2012-01-05 Thread Demetrio Girardi
Upon reading the django tutorial, I was under the impression that you should 
have the project root folder in your pythonpath, so that each app is available 
for import in modules, e.g. you can do

import myapp

However, my IDE seems to prefer putting its root in the pythonpath, so you'd 
have to

import project.myapp

and also it seems that the documentation for WSGI deployment expect the 
same (with project.settings)

What is recommended? 

I have two apps which are inter-dependent and import stuff from one 
another; if I decide to go for the project.app route, is there a way to import 
things without a reference to the project name? otherwise the imports would 
have to be rewritten when the apps are installed in another projcet.

-- 
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: This Week In History

2012-01-05 Thread Sherif Shehab Aldin
You can generate a random number for the year, random number for the day,
and query with them.

Regards,
Sherif.

On Thu, Jan 5, 2012 at 10:14 PM, Tim Sawyer wrote:

> Hi Folks,
>
> Does anyone have a strategy for selecting from a database where the date
> is this week, but a random year in the past?
>
> I have ~100 years of events in a database, each with a datefield - I would
> like to do a "this week in history" box that lists one or two on the
> homepage, randomly taken from the set.
>
> Ideas/pointers appreciated.
>
> Cheers,
>
> Tim.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

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



This Week In History

2012-01-05 Thread Tim Sawyer

Hi Folks,

Does anyone have a strategy for selecting from a database where the date 
is this week, but a random year in the past?


I have ~100 years of events in a database, each with a datefield - I 
would like to do a "this week in history" box that lists one or two on 
the homepage, randomly taken from the set.


Ideas/pointers appreciated.

Cheers,

Tim.

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



Re: no plus-sign to add related object in admin

2012-01-05 Thread K.C. Smith
I have written a small patch that will add this feature (i.e., the
ability to register a model in the admin and stop it from showing up
in the index).  If your problem was the same as mine, then this can
get the plus signs where you want them without changing your preferred
admin view.  See https://code.djangoproject.com/ticket/17498 for
details.

K.C.

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



Re: django/Data Base Advice

2012-01-05 Thread Lie Ryan

On 01/06/2012 02:35 AM, Dennis Lee Bieber wrote:

Django's models are just a means to define those independent of engine
specific notation.


while introducing django-specific notation, which generally maps more 
neatly to the theoretical foundation than SQL (while SQL maps more 
neatly to the implementation of database system).


In particular, in django the concept of primary keys is implemented as 
autoincrementing integers is well hidden from you, and django's foreign 
keys is a full-fledged objects instead of integers with a few restrictions.


--
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: virtualenv wrecked my Django+modules install

2012-01-05 Thread Andre Terra
Hello,

The error you're seeing is due to Django not being installed in your
virtual environment.

virtualenv is the way to go, unless you have an incredibly good reason not
to use it.

It couldn't possibly break anything as it installs virtual environments
alongside your system wide Python.

If you used the --no-site-packages option, you will need to install
everything for that virtual environment as it won't have copied the
libraries that were already in your system.

This is a good thing. It will give you a clean slate to start from. Proceed
to install everything through pip while *in* the newly created environment.
Remember pip can install from most VCS repositories, so consult the docs
should you need to do that..

The main advantage of using virtualenv is that you can keep things
separate. Imagine you want to work on two different Django projects, and
one of them is a maintenance job for something that was coded back when 1.0
was released, while the other is an upcoming website built on the dev
branch. If you install just one instance of Django for the whole system you
won't be able to work on both.

For more info, google "notes on using pip and virtualenv". It should have
everything you need.

I'm sorry for not linking anything but I'm typing on my phone while my
pupils finish dilating before an eye exam, so this is hard enough without
multitasking! ;-)

Also google virtualenvwrapper and *read through the docs* including the
user submitted tips!

Good luck and happy coding!

Cheers,
AT

On Jan 5, 2012 5:02 PM, "Alec Taylor"  wrote:
>
> Good morning,
>
> On my system (Windows 8 Developer Preview x64 with Python 2.7.2 x64) I
> painstakingly installed all the dependencies for Django, Satchmo and a
> few other large scale projects.
>
> (about 10% couldn't be installed with pip, which is why I use the word
> 'painstakingly')
>
> Recently though I needed Pinax for something, so following there guide
> (http://pinax.readthedocs.org/en/latest/gettingstarted.html) I setup a
> virtualenv for it.
>
> Not only could I not get Pinax running, but when I went back to work
> on my Satchmo-based project, and ran "manage.py runserver" I got the
> following error:
> Traceback (most recent call last):
>  File "P:\Prototype\Django\store\manage.py", line 18, in 
>from django.core.management import execute_manager
> ImportError: No module named django.core.management
>
> Typing in `import django` from the interpreter gives me:
> Traceback (most recent call last):
>  File "", line 1, in 
> ImportError: No module named django
>
> Does this mean I need to install everything required by my project all
> over again? - If so, should I take a virtualenv approach (and what
> would the advantages be of doing so)?
>
> Thanks for all suggestions,
>
> Alec Taylor
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Re: virtualenv wrecked my Django+modules install

2012-01-05 Thread Brett Epps
It sounds like you installed the Django/Satchmo/other packages globally.
If you switch out of the virtualenv by running
c:\path\to\virtualenv\bin\deactivate, those packages should be available
again.

I try to never install packages globally, with tools like pip or hg being
the only exceptions. I always create a new virtualenv for each project
(and sometimes separate envs for different versions/branches of the same
project) - this way, project A can require version 1 of package X and
project B can require version 2 of package X, and both projects can
coexist peacefully.

Brett


On 1/5/12 1:01 PM, "Alec Taylor"  wrote:

>Good morning,
>
>On my system (Windows 8 Developer Preview x64 with Python 2.7.2 x64) I
>painstakingly installed all the dependencies for Django, Satchmo and a
>few other large scale projects.
>
>(about 10% couldn't be installed with pip, which is why I use the word
>'painstakingly')
>
>Recently though I needed Pinax for something, so following there guide
>(http://pinax.readthedocs.org/en/latest/gettingstarted.html) I setup a
>virtualenv for it.
>
>Not only could I not get Pinax running, but when I went back to work
>on my Satchmo-based project, and ran "manage.py runserver" I got the
>following error:
>Traceback (most recent call last):
>  File "P:\Prototype\Django\store\manage.py", line 18, in 
>from django.core.management import execute_manager
>ImportError: No module named django.core.management
>
>Typing in `import django` from the interpreter gives me:
>Traceback (most recent call last):
>  File "", line 1, in 
>ImportError: No module named django
>
>Does this mean I need to install everything required by my project all
>over again? - If so, should I take a virtualenv approach (and what
>would the advantages be of doing so)?
>
>Thanks for all suggestions,
>
>Alec Taylor
>
>-- 
>You received this message because you are subscribed to the Google Groups
>"Django users" group.
>To post to this group, send email to django-users@googlegroups.com.
>To unsubscribe from this group, send email to
>django-users+unsubscr...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>

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



virtualenv wrecked my Django+modules install

2012-01-05 Thread Alec Taylor
Good morning,

On my system (Windows 8 Developer Preview x64 with Python 2.7.2 x64) I
painstakingly installed all the dependencies for Django, Satchmo and a
few other large scale projects.

(about 10% couldn't be installed with pip, which is why I use the word
'painstakingly')

Recently though I needed Pinax for something, so following there guide
(http://pinax.readthedocs.org/en/latest/gettingstarted.html) I setup a
virtualenv for it.

Not only could I not get Pinax running, but when I went back to work
on my Satchmo-based project, and ran "manage.py runserver" I got the
following error:
Traceback (most recent call last):
  File "P:\Prototype\Django\store\manage.py", line 18, in 
from django.core.management import execute_manager
ImportError: No module named django.core.management

Typing in `import django` from the interpreter gives me:
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named django

Does this mean I need to install everything required by my project all
over again? - If so, should I take a virtualenv approach (and what
would the advantages be of doing so)?

Thanks for all suggestions,

Alec Taylor

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



Taking a sample mysql dump

2012-01-05 Thread Amit Sethi
Is there a way one could take the dump of just a few sample fields using
mysqldump or some other similar tool. ?? Such that you can use it similar
to fixture data

-- 
A-M-I-T S|S

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



Re: How to get spanning relationships queryset right?

2012-01-05 Thread Carsten Fuchs

Dear Javier,

Am 03.01.2012 20:05, schrieb Javier Guerra Giraldez:

On Tue, Jan 3, 2012 at 2:02 PM, Javier Guerra Giraldez
  wrote:

On Tue, Jan 3, 2012 at 11:54 AM, Carsten Fuchs  wrote:

How can I find only those blogs where *all* entries were (co-)authored by
123?


Blog.objects.exclude(entry__in=Entry.objects.exclude(authors=123))



That works very well,
thank you very much for your help!  :-)

Best regards,
Carsten



--
   Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
  Learn more at http://www.cafu.de

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



Re: Passing variables from a context processor to a template

2012-01-05 Thread Rainy


On Jan 5, 12:38 pm, Rainy  wrote:
> On Jan 5, 12:35 pm, Guy Nesher  wrote:
>
> > Thanks,
>
> > I've initially tried to use a dictionary but was still unable to pull
> > the data in the template.
>
> > I'm using your updated context processor:
> > def swiss_context_processors(request):
> >     added_context = { 'mytest': 'aaa', }
> >     return added_context
>
> > and trying to call {{added_context.mytest}} in the template which
> > returns nothing
>
> It should be just {{ mytest }}


I should add that in Python, it doesn't matter what is the
variable name of value being returned. So if you have

def x(): a=1; return a

def y(): b=x()

There is no way for y() to know that inside x(), the
variable was called 'a'. It receives the value only. It's
effectively equivalent to x() being:

def x(): return 1

So you need to understand that django template
processing receives the dictionary {'mytest':'aaa'} and
could not possibly know what you mean by 'added_context'.

 -ak

-- 
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: Passing variables from a context processor to a template

2012-01-05 Thread Rainy


On Jan 5, 12:35 pm, Guy Nesher  wrote:
> Thanks,
>
> I've initially tried to use a dictionary but was still unable to pull
> the data in the template.
>
> I'm using your updated context processor:
> def swiss_context_processors(request):
>     added_context = { 'mytest': 'aaa', }
>     return added_context
>
> and trying to call {{added_context.mytest}} in the template which
> returns nothing


It should be just {{ mytest }}

Also note that a comma at the end is not necessary:

return {'mytest': 'aaa'} or even return dict(mytest='aaa')

 -ak

-- 
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: Passing variables from a context processor to a template

2012-01-05 Thread Guy Nesher
Thanks,

I've initially tried to use a dictionary but was still unable to pull
the data in the template.

I'm using your updated context processor:
def swiss_context_processors(request):
added_context = { 'mytest': 'aaa', }
return added_context

and trying to call {{added_context.mytest}} in the template which
returns nothing

I've added the context processor to settings.py and when I run a
pdb.trace() from the context_processor I am able to print the variable
so it is being called + defined.



On Jan 5, 5:22 pm, Nan  wrote:
> Two things:
>
> 1) make sure the context processor is installed in your settings file.
> 2) context processors should return dicts.  Try:
>
> def swiss_context_processors(request):
>     added_context = { 'mytest': 'aaa', }
>     return added_context
>
> On Jan 5, 12:03 pm, Guy Nesher  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I've created a simple context processor which simply returns a
> > variable, however I'm unable to retrieve it from my template.
>
> > The context processor is quite simple :
>
> > def swiss_context_processors(request):
> >     mytest = "aaa"
> >     return mytest
>
> > and I am calling the context processor in my view :
>
> > def index(request):
> >     return render_to_response('front/
> > index.html',context_instance=RequestContext(request)
> >     )
>
> > However when I try to access the variable in my template {{mytest}} it
> > returns empty.
>
> > What am I missing ?

-- 
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: Passing variables from a context processor to a template

2012-01-05 Thread Nan

Two things:

1) make sure the context processor is installed in your settings file.
2) context processors should return dicts.  Try:

def swiss_context_processors(request):
added_context = { 'mytest': 'aaa', }
return added_context

On Jan 5, 12:03 pm, Guy Nesher  wrote:
> Hi,
>
> I've created a simple context processor which simply returns a
> variable, however I'm unable to retrieve it from my template.
>
> The context processor is quite simple :
>
> def swiss_context_processors(request):
>     mytest = "aaa"
>     return mytest
>
> and I am calling the context processor in my view :
>
> def index(request):
>     return render_to_response('front/
> index.html',context_instance=RequestContext(request)
>     )
>
> However when I try to access the variable in my template {{mytest}} it
> returns empty.
>
> What am I missing ?

-- 
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: Passing variables from a context processor to a template

2012-01-05 Thread Michael Elkins

On Thu, Jan 05, 2012 at 09:03:56AM -0800, Guy Nesher wrote:

I've created a simple context processor which simply returns a
variable, however I'm unable to retrieve it from my template.


"Each context processor must return a dictionary."

https://docs.djangoproject.com/en/1.3/ref/templates/api/#writing-your-own-context-processors

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



Passing variables from a context processor to a template

2012-01-05 Thread Guy Nesher
Hi,

I've created a simple context processor which simply returns a
variable, however I'm unable to retrieve it from my template.

The context processor is quite simple :

def swiss_context_processors(request):
mytest = "aaa"
return mytest

and I am calling the context processor in my view :

def index(request):
return render_to_response('front/
index.html',context_instance=RequestContext(request)
)

However when I try to access the variable in my template {{mytest}} it
returns empty.

What am I missing ?

-- 
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: UnicodeDecodeError

2012-01-05 Thread Hassan
thnx mate its working now ;)

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



how to avoid pk collisions at loaddata time

2012-01-05 Thread Anshuman Aggarwal
Russ,
 Just wanted to pick up an old thread about loading fixtures without
PK ...isn't this now a natural extension of the natural_key support
that was included in Django 1.2? Anybody else for whom this is a big
enough itch?

Regards,
Anshuman

-- 
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: UnicodeDecodeError

2012-01-05 Thread J. Cliff Dyer
Your problem is the curly quotes around “Times New Roman”.  First, they
will prevent CSS from seeing the font as Times New Roman, and second,
they are encoded with the byte 0x93, which is how they show up in the
various Windows code pages (cp1252, for instance).  Convert your file to
UTF-8, if you can.  

Otherwise, remove all non-ascii characters from it.  If you do this, but
you need non-ascii characters to show up in your web pages, you'll need
to use HTML escape sequences, like 

Cheers,
Cliff


 On Thu, 2012-01-05 at 06:20 -0800, Hassan wrote:
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  width="800" height="200" id="movie_name" align="middle">
> 
> 
> 
> 
> 
> http://www.adobe.com/go/getflash;>
> http://www.adobe.com/images/shared/
> download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/>
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  width="550px">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> About Us
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut dictum
> enim. Quisque posuere justo sem, posuere lobortis ligulaLorem ipsum
> dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
> Quisque posuere justo sem, posuere lobortis ligula
> 
> 
> 
> 
> 
> About Us
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut dictum
> enim. Quisque posuere justo sem, posuere lobortis ligulaLorem ipsum
> dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
> Quisque posuere justo sem, posuere lobortis ligula
> 
> 
> 
> 
> About Us
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut dictum
> enim. Quisque posuere justo sem, posuere lobortis ligulaLorem ipsum
> dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
> Quisque posuere justo sem, posuere lobortis ligula
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Welcome
> Lorem ipsum
> dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
> Quisque posuere justo sem, posuere lobortis ligula. Etiam erat diam,
> elementum in dapibus bibendum, ultrices eget enim. Nulla et nibh nec
> elit venenatis commodo sit amet pretium eros. Duis vel velit at augue
> tristique vehicula. Nulla in lectus quis nisi egestas egestas at ac
> lacus. Donec rutrum volutpat rhoncus. Proin condimentum, odio eu
> commodo laoreet, turpis leo tincidunt nisi, nec mollis quam justo
> vitae velit.
> Read more i>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Global (c) 2011 | Privet policy
>  Powerd by http://www.gardeniatelco.com;>Gardeniatelco a>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 


-- 
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: Users getting logged out frequently

2012-01-05 Thread m1chael
Could an incorrect computer clock contribute to this kind of issue?

On Thu, Jan 5, 2012 at 10:35 AM, Dennis Lee Bieber
 wrote:
> On Thu, 5 Jan 2012 08:56:57 +0530, Arun P  wrote:
>
>>That’s a lot of education Dennis. Thanks.
>
>        Pardon, but just who were you replying to? Consider whose
> attribution line in in the quoted material...
>>
>>On Wed, Jan 4, 2012 at 11:36 PM, Cherian Thomas wrote:
>>
>
>        And as I think /I/ implied... I was grabbing hypothetical cases.
>
>        Other hypotheticals -- some view is specifying a mis-spelled cookie
> or overwriting the one already in place.
> --
>        Wulfraed                 Dennis Lee Bieber         AF6VN
>        wlfr...@ix.netcom.com    HTTP://wlfraed.home.netcom.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.
>

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



Re: Admin interface does not save routine object

2012-01-05 Thread Andy Oram
Yes (and sorry for getting your name wrong before, Brett).
str(self.document) works.

On Jan 4, 6:26 pm, Brett Epps  wrote:
> Oh, I think the problem is in the __unicode__() method of your Quiz8
> model.  You're returning self.document, which is a Document8 object and
> not a unicode string.  Try returning unicode(self.document) or something
> like '%d' % document.id.
>
> Brett
>
> On 1/4/12 5:07 PM, "Andy Oram"  wrote:
>
>
>
>
>
>
>
> >Thanks, Bill. I apologize for not including DEBUG output. Here is what
> >seems relevant. It looks like the ForeignKey relationship filled in
> >fields
> >with the id's of the document and document version (which is what
> >one would expect) and  there was a problem converting it to a string.
>
> >
>
> >Request Method:     POST
> >Request URL:        http://localhost:8000/admin/quiz9s/quiz9/add/
> >Django Version:     1.3.1
> >Exception Type:     TypeError
> >Exception Value:
>
> >coercing to Unicode: need string or buffer, int found
>
> >Exception Location:         /usr/local/lib/python2.6/dist-packages/django/
> >utils/encoding.py in force_unicode, line 71
> >Python Executable:  /usr/bin/python
> >Python Version:     2.6.5
>
> >---
>
> >csrfmiddlewaretoken: u'267144fccb830df5fa96feeb691b7ae8'
>
> >document: u'1'
>
> >quiz_owner: u'1'
>
> >_save: u'Save'
>
> >--
> >You received this message because you are subscribed to the Google Groups
> >"Django users" group.
> >To post to this group, send email to django-users@googlegroups.com.
> >To unsubscribe from this group, send email to
> >django-users+unsubscr...@googlegroups.com.
> >For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: UnicodeDecodeError

2012-01-05 Thread Simon Holness
I would hazard a guess that your index.html file is actually not ascii
or utf-8 but some other encoding - probably cp1252

0x93 in cp1252 is a "smart quote" ( see
http://en.wikipedia.org/wiki/Windows-1252 ) so that would look like it
fits with the line quoted below.

Open it in an editor that knows about encodings and save it as utf-8
and all should hopefully be well.


2012/1/5 Hassan :
> “Times New Roman”, Times, serif;text-decoration:none">Read morehttp://groups.google.com/group/django-users?hl=en.



Re: Using STATIC_URL in CSS/JS files?

2012-01-05 Thread francescortiz
The only case in which you can have issues with double brackets is
when a '{{' appears in the same line and before than a '}}'.

On Jan 4, 10:18 pm, Bill Freeman  wrote:
> Good point.  But you can run into double braces in JS.
>
>
>
>
>
>
>
> On Tue, Jan 3, 2012 at 3:29 PM, Christophe Pettus  wrote:
>
> > On Jan 3, 2012, at 11:18 AM, Bill Freeman wrote:
>
> >> This will be even morepainful if you use Django templates as the
> >> templating engine, since you will have to quote all those braces that you 
> >> need
> >> in CSS and Javascript.
>
> > I don't believe this is correct; Django's templating engine doesn't choke 
> > on single braces.
>
> > --
> > -- Christophe Pettus
> >   x...@thebuild.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 
> > athttp://groups.google.com/group/django-users?hl=en.

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



Re: UnicodeDecodeError

2012-01-05 Thread Hassan




























http://www.adobe.com/go/getflash;>
http://www.adobe.com/images/shared/
download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/>



















About Us
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut dictum
enim. Quisque posuere justo sem, posuere lobortis ligulaLorem ipsum
dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
Quisque posuere justo sem, posuere lobortis ligula





About Us
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut dictum
enim. Quisque posuere justo sem, posuere lobortis ligulaLorem ipsum
dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
Quisque posuere justo sem, posuere lobortis ligula




About Us
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut dictum
enim. Quisque posuere justo sem, posuere lobortis ligulaLorem ipsum
dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
Quisque posuere justo sem, posuere lobortis ligula










Welcome
Lorem ipsum
dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
Quisque posuere justo sem, posuere lobortis ligula. Etiam erat diam,
elementum in dapibus bibendum, ultrices eget enim. Nulla et nibh nec
elit venenatis commodo sit amet pretium eros. Duis vel velit at augue
tristique vehicula. Nulla in lectus quis nisi egestas egestas at ac
lacus. Donec rutrum volutpat rhoncus. Proin condimentum, odio eu
commodo laoreet, turpis leo tincidunt nisi, nec mollis quam justo
vitae velit.
Read more









Global (c) 2011 | Privet policy
 Powerd by http://www.gardeniatelco.com;>Gardeniatelco













-- 
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: UnicodeDecodeError

2012-01-05 Thread Hassan
i will post my index page now

-- 
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: UnicodeDecodeError

2012-01-05 Thread francescortiz
Also, don't forget about the magic functions provided by django:
smart_unicode and smart_str

On Jan 5, 2:27 pm, Karen Tracey  wrote:
> On Thu, Jan 5, 2012 at 8:16 AM, César Frias  wrote:
> > I guess you have some files without the # -*- coding: utf-8 -*- on the top
> > of the file
>
> > You will need this if you want to use some letters like é or ç...
>
> No, you get a different exception if you are missing the encoding
> declaration in a Python file that contains non-ASCII characters. In that
> case you get a SyntaxError that complains specifically about the missing
> encoding declaration.
>
> Getting an error from the utf8 codec attempting to transform a bytestring
> to unicode implies you've got some bytestring data that is assumed to be
> encoded in utf8 but is in fact using some other encoding. Since this is
> happening when rendering a template, my guess would be the template file's
> encoding is something other than utf8. Django has a setting 
> (https://docs.djangoproject.com/en/1.3/ref/settings/#file-charset) that
> controls what encoding is assumed for files read from disk, it defaults to
> utf8. Either fix the encoding of the template file to be utf8 or change
> that setting to match whatever encoding is being used for all your template
> files on disk.
>
> Karen

-- 
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: Oracle's SP OUT param

2012-01-05 Thread Akira Kir
That worked, tho i was already making all based on cx_oracle. 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/-/h-KISDJysLkJ.
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: UnicodeDecodeError

2012-01-05 Thread Karen Tracey
On Thu, Jan 5, 2012 at 8:16 AM, César Frias  wrote:

> I guess you have some files without the # -*- coding: utf-8 -*- on the top
> of the file
>
> You will need this if you want to use some letters like é or ç...
>
>
No, you get a different exception if you are missing the encoding
declaration in a Python file that contains non-ASCII characters. In that
case you get a SyntaxError that complains specifically about the missing
encoding declaration.

Getting an error from the utf8 codec attempting to transform a bytestring
to unicode implies you've got some bytestring data that is assumed to be
encoded in utf8 but is in fact using some other encoding. Since this is
happening when rendering a template, my guess would be the template file's
encoding is something other than utf8. Django has a setting (
https://docs.djangoproject.com/en/1.3/ref/settings/#file-charset) that
controls what encoding is assumed for files read from disk, it defaults to
utf8. Either fix the encoding of the template file to be utf8 or change
that setting to match whatever encoding is being used for all your template
files on disk.

Karen

-- 
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: UnicodeDecodeError

2012-01-05 Thread César Frias
I guess you have some files without the # -*- coding: utf-8 -*- on the top
of the file

You will need this if you want to use some letters like é or ç...




Att,
César Frias
Linux user: #506849
Twitter: twitter.com/cesarFrias


2012/1/5 Piotr Zalewa 

> Please attach the index.html - there might be an unknown unicode character
>
> zalun
>
>
> On 01/05/12 12:18, Hassan wrote:
>
>> Dear ALL,
>>
>> i am trying to do render_to_response('index.**html') , and i keep geting
>> this dont know why ? its a normal html page ??!! what to do ?
>>
>>
>> UnicodeDecodeError at /
>> 'utf8' codec can't decode byte 0x93 in position 3197: invalid start
>> byte
>> Request Method: GET
>> Request URL:http://127.0.0.1:8000/
>> Django Version: 1.3.1
>> Exception Type: UnicodeDecodeError
>> Exception Value:
>> 'utf8' codec can't decode byte 0x93 in position 3197: invalid start
>> byte
>> Exception Location: c:\python27\lib\encodings\utf_**8.py in decode,
>> line
>> 16
>> Python Executable:  c:\python27\python.exe
>> Python Version: 2.7.2
>> Python Path:
>> ['C:\\global',
>>  'c:\\python27\\lib\\site-**packages\\setuptools-0.6c11-**py2.7.egg',
>>  'c:\\python27\\lib\\site-**packages\\django_blog_zinnia-**0.8.1-
>> py2.7.egg',
>>  'c:\\python27\\lib\\site-**packages\\beautifulsoup-3.2.0-**py2.7.egg',
>>  'c:\\python27\\lib\\site-**packages\\django_xmlrpc-0.1.3-**py2.7.egg',
>>  'c:\\python27\\lib\\site-**packages\\django_tagging-0.3.**1-py2.7.egg',
>>  'c:\\python27\\lib\\site-**packages\\django_mptt-0.5.2-**py2.7.egg',
>>  'c:\\python27\\lib\\site-**packages\\pyparsing-1.5.6-py2.**7.egg',
>>  'c:\\python27\\lib\\site-**packages\\akismet-0.2.0-py2.7.**egg',
>>  'c:\\python27\\lib\\site-**packages\\south-0.7.3-py2.7.**egg',
>>  'c:\\python27\\lib\\site-**packages\\django_oembed-0.1.1-**py2.7.egg',
>>  'C:\\Windows\\system32\\**python27.zip',
>>  'c:\\python27\\DLLs',
>>  'c:\\python27\\lib',
>>  'c:\\python27\\lib\\plat-win',
>>  'c:\\python27\\lib\\lib-tk',
>>  'c:\\python27',
>>  'c:\\python27\\lib\\site-**packages',
>>  'c:\\python27\\lib\\site-**packages\\PIL',
>>  'c:\\python27\\lib\\site-**packages\\win32',
>>  'c:\\python27\\lib\\site-**packages\\win32\\lib',
>>  'c:\\python27\\lib\\site-**packages\\Pythonwin']
>> Server time:Thu, 5 Jan 2012 06:11:04 +0200
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

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



Re: UnicodeDecodeError

2012-01-05 Thread Daniel Roseman
On Thursday, 5 January 2012 11:18:52 UTC, Hassan wrote:
>
> Dear ALL, 
>
> i am trying to do render_to_response('index.html') , and i keep geting 
> this dont know why ? its a normal html page ??!! what to do ? 
>
 

You need to post some code.

However 99 times out of 100, when you see this error it's because the 
__unicode__ method in one of your models is not actually outputting 
unicode, and/or is converting wrongly. For instance, instead of this:

def __unicode__(self):
return 'foo %s' % self.bar

you should do this:

def __unicode__(self):
return u'foo %s' % self.bar

(note extra u).
--
DR.

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

2012-01-05 Thread Piotr Zalewa

Please attach the index.html - there might be an unknown unicode character

zalun

On 01/05/12 12:18, Hassan wrote:

Dear ALL,

i am trying to do render_to_response('index.html') , and i keep geting
this dont know why ? its a normal html page ??!! what to do ?


UnicodeDecodeError at /
'utf8' codec can't decode byte 0x93 in position 3197: invalid start
byte
Request Method: GET
Request URL:http://127.0.0.1:8000/
Django Version: 1.3.1
Exception Type: UnicodeDecodeError
Exception Value:
'utf8' codec can't decode byte 0x93 in position 3197: invalid start
byte
Exception Location: c:\python27\lib\encodings\utf_8.py in decode, line
16
Python Executable:  c:\python27\python.exe
Python Version: 2.7.2
Python Path:
['C:\\global',
  'c:\\python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg',
  'c:\\python27\\lib\\site-packages\\django_blog_zinnia-0.8.1-
py2.7.egg',
  'c:\\python27\\lib\\site-packages\\beautifulsoup-3.2.0-py2.7.egg',
  'c:\\python27\\lib\\site-packages\\django_xmlrpc-0.1.3-py2.7.egg',
  'c:\\python27\\lib\\site-packages\\django_tagging-0.3.1-py2.7.egg',
  'c:\\python27\\lib\\site-packages\\django_mptt-0.5.2-py2.7.egg',
  'c:\\python27\\lib\\site-packages\\pyparsing-1.5.6-py2.7.egg',
  'c:\\python27\\lib\\site-packages\\akismet-0.2.0-py2.7.egg',
  'c:\\python27\\lib\\site-packages\\south-0.7.3-py2.7.egg',
  'c:\\python27\\lib\\site-packages\\django_oembed-0.1.1-py2.7.egg',
  'C:\\Windows\\system32\\python27.zip',
  'c:\\python27\\DLLs',
  'c:\\python27\\lib',
  'c:\\python27\\lib\\plat-win',
  'c:\\python27\\lib\\lib-tk',
  'c:\\python27',
  'c:\\python27\\lib\\site-packages',
  'c:\\python27\\lib\\site-packages\\PIL',
  'c:\\python27\\lib\\site-packages\\win32',
  'c:\\python27\\lib\\site-packages\\win32\\lib',
  'c:\\python27\\lib\\site-packages\\Pythonwin']
Server time:Thu, 5 Jan 2012 06:11:04 +0200



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



Re: Django Form Field: BoundField question

2012-01-05 Thread Sven
Hi Tom, 

thanks for the link, in case of 'datetime.date.today' the callable makes a lot 
of sense. 

I changed my class field so that the value is not more a class definition, now 
it is wrapped by some kind of a proxy instance to avoid the callable effect.


-- 


Best Regards
 
Sven

On Thursday 05 January 2012 10:20:37 Tom Evans wrote:
> On Wed, Jan 4, 2012 at 5:25 PM, sassman  wrote:
> > Hi,
> > 
> > i'm using Django Version 1.3.1, can anyone say me why is the value
> > function in BoundField (FormField) makes a check if the value is
> > callable?
> > 
> >def value(self):
> >"""
> >Returns the value for this BoundField, using the initial value
> > if
> >the form is not bound or the data otherwise.
> >"""
> >if not self.form.is_bound:
> >data = self.form.initial.get(self.name,
> > self.field.initial)
> >if callable(data):
> >data = data()
> > 
> > 
> > I have a Field that encapsulates a Python Class, and this leads into a
> > problem because the value (a class definition) will be instatiated at
> > this time. But for a Dropdown field (wrapped by the TypedChoiceField
> > Field) this is not a neccessary action.
> > 
> > Can anyone say me what is the reason for having a datavalue callable
> > and call it on a field?
> > 
> > BR Sven
> 
> It is documented here:
> 
> https://docs.djangoproject.com/en/1.3/ref/forms/fields/#django.forms.Field.i
> nitial
> 
> Cheers
> 
> Tom

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



Re: How do you organize your deployment enviroment

2012-01-05 Thread Alexis Bellido
I think Fabric is the easiest solution, the tutorial is pretty good 
[http:/fabfile.org], Katie wrote about how she uses Fabric 
[http://therealkatie.net/blog/2011/nov/28/katie-finally-talks-about-her-fabfiles/],
 
and I tried to extend the idea a little to setup a server from scratch just 
with a couple of Fabric commands 
[https://github.com/alexisbellido/The-Django-gunicorn-fabfile-project]

Regards!

-- 
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/-/6yxy2qTnW7UJ.
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 dev/deploy environment for distributed agile teams

2012-01-05 Thread Alexis Bellido
I wrote a Fabric script to automate Django deployment, in my tests with 
Ubuntu servers (actually, virtual machines running under KVM) the script 
took 14 minutes from a clean Ubuntu install to a running Django environment.

You can get the code in GitHub:

https://github.com/alexisbellido/The-Django-gunicorn-fabfile-project

Regards!

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



Re: How to deploy new code to the Production Server?

2012-01-05 Thread Alexis Bellido
I don't think you need different braches in your code repository for your 
development and production (and don't forget staging) environments. The 
main differences are in the settings.py values and the database used. You 
can even use the same settings.py for different environments with clever 
use of DEBUG or some other constant.

And, as many others have already mentioned, you should really use 
virtualenv, pip and Fabric to automate as much as possible.

I wrote a fabfile to easily create staging and production environments in 
Ubuntu. The setup includes Django, gunicorn, Nginx and upstart. You could 
easily modify the fabfile to fit your needs. Here some more details:

http://www.ventanazul.com/webzine/django-gunicorn-fabfile-project

and here the actual code in GitHub:

https://github.com/alexisbellido/The-Django-gunicorn-fabfile-project

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



UnicodeDecodeError

2012-01-05 Thread Hassan
Dear ALL,

i am trying to do render_to_response('index.html') , and i keep geting
this dont know why ? its a normal html page ??!! what to do ?


UnicodeDecodeError at /
'utf8' codec can't decode byte 0x93 in position 3197: invalid start
byte
Request Method: GET
Request URL:http://127.0.0.1:8000/
Django Version: 1.3.1
Exception Type: UnicodeDecodeError
Exception Value:
'utf8' codec can't decode byte 0x93 in position 3197: invalid start
byte
Exception Location: c:\python27\lib\encodings\utf_8.py in decode, line
16
Python Executable:  c:\python27\python.exe
Python Version: 2.7.2
Python Path:
['C:\\global',
 'c:\\python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg',
 'c:\\python27\\lib\\site-packages\\django_blog_zinnia-0.8.1-
py2.7.egg',
 'c:\\python27\\lib\\site-packages\\beautifulsoup-3.2.0-py2.7.egg',
 'c:\\python27\\lib\\site-packages\\django_xmlrpc-0.1.3-py2.7.egg',
 'c:\\python27\\lib\\site-packages\\django_tagging-0.3.1-py2.7.egg',
 'c:\\python27\\lib\\site-packages\\django_mptt-0.5.2-py2.7.egg',
 'c:\\python27\\lib\\site-packages\\pyparsing-1.5.6-py2.7.egg',
 'c:\\python27\\lib\\site-packages\\akismet-0.2.0-py2.7.egg',
 'c:\\python27\\lib\\site-packages\\south-0.7.3-py2.7.egg',
 'c:\\python27\\lib\\site-packages\\django_oembed-0.1.1-py2.7.egg',
 'C:\\Windows\\system32\\python27.zip',
 'c:\\python27\\DLLs',
 'c:\\python27\\lib',
 'c:\\python27\\lib\\plat-win',
 'c:\\python27\\lib\\lib-tk',
 'c:\\python27',
 'c:\\python27\\lib\\site-packages',
 'c:\\python27\\lib\\site-packages\\PIL',
 'c:\\python27\\lib\\site-packages\\win32',
 'c:\\python27\\lib\\site-packages\\win32\\lib',
 'c:\\python27\\lib\\site-packages\\Pythonwin']
Server time:Thu, 5 Jan 2012 06:11:04 +0200

-- 
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: Oracle's SP OUT param

2012-01-05 Thread Tim Sawyer
This might help:

http://drumcoder.co.uk/blog/2010/apr/23/output-parameters-cx_oracle-and-plsql/

Tim.

> Hello.
> Im trying to get Oracle SPs working in django.
>
> Procedure recives in_param and out_param
>
> in get_data function i do
>
> [code]
> def get_data(self, in_param):
> cursor = connection.cursor()
> #out_param =
> ret=cursor.callproc("TEST_PKG", (in_param,out_param))
> cursor.close()
> [/code]
>
> the question is - how do i register out_param?
> If i try to make
> [code]
> out_param = models.CharField(max_length=20)
> [/code]
> im gettig wrong type error from database.
>
> --
> 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/-/vWTLGHMMkYUJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


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



Re: Django Form Field: BoundField question

2012-01-05 Thread Tom Evans
On Wed, Jan 4, 2012 at 5:25 PM, sassman  wrote:
> Hi,
>
> i'm using Django Version 1.3.1, can anyone say me why is the value
> function in BoundField (FormField) makes a check if the value is
> callable?
>
>    def value(self):
>        """
>        Returns the value for this BoundField, using the initial value
> if
>        the form is not bound or the data otherwise.
>        """
>        if not self.form.is_bound:
>            data = self.form.initial.get(self.name,
> self.field.initial)
>            if callable(data):
>                data = data()
>
>
> I have a Field that encapsulates a Python Class, and this leads into a
> problem because the value (a class definition) will be instatiated at
> this time. But for a Dropdown field (wrapped by the TypedChoiceField
> Field) this is not a neccessary action.
>
> Can anyone say me what is the reason for having a datavalue callable
> and call it on a field?
>
> BR Sven
>

It is documented here:

https://docs.djangoproject.com/en/1.3/ref/forms/fields/#django.forms.Field.initial

Cheers

Tom

-- 
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: Cheap Django hosting?

2012-01-05 Thread victoria
Hi,

I wanted to mention that if you are OK with using EC2 you can also use
the public BitNami DjangoStack AMI (I'm part from the BitNami team).
It includes preconfigured version of Apache with mod_wsgi, django
1.3.1 and Python 2.6.5. It also includes PostgreSQL and MySQL.
Alternatively you can also use BitNami Cloud Hosting that makes easier
the management of your sever (start/stop, basic monitoring, resize
images, schedule backups,...) we offer a free developer plan in which
you will only be charged by the Amazon costs (which you pay directly
to them) so if you are elegible for the free tier, it would be
completely free for the first year.

If you are interested these are the links:
http://bitnami.org/stack/djangostack#cloudImage (the AMI) and
http://bitnami.org/cloud (BCH). I will be glad of answering any
question you may have about the service.

Best regards,

Victoria.

On Thu, Jan 5, 2012 at 6:52 AM, Alec Taylor  wrote:
> Interesting, thanks.
>
> On Thu, Jan 5, 2012 at 4:47 PM, Kenneth Reitz  wrote:
>> Heroku gives you 750 free "dyno hours" per month, per app for free.
>>
>> Essentially, they let any app run 24/7 (equivalent to a single server with
>> 512MB of RAM and some pretty beefy processors). Scaling a process to
>> multiple dynos is when the $0.05/hr charge starts (essentially adding
>> another server behind a load balancer).
>>
>>
>>
>> --
>> Kenneth Reitz
>>
>> On Wednesday, January 4, 2012 at 10:20 PM, Alec Taylor wrote:
>>
>> On Thu, Jan 5, 2012 at 4:44 AM, Kenneth Reitz  wrote:
>>
>> You could easily run that on Heroku, and it would cost you $0.
>>
>>
>> I don't understand, why would it cost $0 on Heroku?
>>
>> I checked http://heroku.com/pricing and it seems to cost.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: django/Data Base Advice

2012-01-05 Thread Lie Ryan

On 01/05/2012 01:01 PM, Chris Kavanagh wrote:



On Jan 4, 8:20 am, Andre Terra  wrote:

I'm sorry, folks, but I'll have to *vehemently **disagree *with a lot of
what has been said in this thread. To the OP, I'm sorry I didn't reply any
sooner.

No, you *don't need *to go reading about what MVC means. Django is a
*MTV *framework,
not *MVC*. There are similarities, but the differences are enough to
confuse your head if this is your first time with either one. You should
definitely stick to Django Book[1] for a definition on what Models, Views
and Templates are. Everyone who says otherwise is wrong. Once you're
comfortable with Django, feel free to explore other frameworks so you can
weigh the pros and cons yourself.

No, you *don't need* to read the Python PEP on DB-API (?!?!). I'll go as
far as say you *shouldn't.* Not now and not for any time in the foreseeable
feature. You won't need to write raw SQL in Django until you've reached a
big bottleneck, and one that can't be solved in any other way. Writing raw
SQL is exactly what Django wants you to *stop* doing. The ORM doesn't only
exist in order to speed up development. It provides a layer of abstraction
that also allows for easy refactoring and code improvement. SQL is not as
flexible.

The only PEP you need to read right away is PEP 8[2]. Learn it, love it,
memorize it, use it. Everything else will only bring marginal benefits at
such an early stage in the learning curve while also carrying a level of
complexity that will most likely be a hindrance to your overall experience.

Follow the tutorials and the django book (while outdated, most of it should
work fine). When asking questions, remember to paste a *full *traceback and
code examples. It might not make any sense to you, but eventually you'll
learn your way around it. #django on freenode is rather helpful for quick
questions and, if you know how to ask your question[3], this mailing list
will also prove useful.

Finally, If you need some pointers on HTML/CSS/JS, start with the HTML5
boilerplate[4] "framework". Everyone and their grandma seem to be using it
nowadays. It will give you enough of a starting point that should make
cross-browser compatibility as painless as possible, and should get you
going in a flash.

I hope you find my advice convincing enough so that it may prevent you from
hurting your own learning process. I wish you only the best!

Good luck and happy coding!

André Terra

[1]http://djangobook.com/en/2.0/chapter01/
[2]http://www.python.org/dev/peps/pep-0008/
[3]https://code.djangoproject.com/wiki/UsingTheMailingList
[4]http://html5boilerplate.com/



Thanks for the advice Andre. . .Ok here's the crux of my original
question, that I didn't ask very well. How can I learn to make my own
Models, without knowing SQL?? In the book, at the beginning of Chp 5,
Models, there's a note that says something like, "you don't strictly
need to know SQL to follow along, but it sure helps." Since I have no
database experience, I took that quote seriously.

To be honest, after looking through the Models chapter in the book,
and on djangoproject.com, it doesn't look too complicated. The Model
Class Fields seem pretty simple. But then again, if I had to design a
model from scratch, I think I would have a problem. That's why I
thought learning SQL, just to learn a little about databases might be
helpful.


While learning SQL could be helpful for writing fine-tuned SQL queries, 
IMO it doesn't really help much to design an effective database. To 
design an effective database schema, you need to learn about database, 
not (just) SQL. Learn about basic database concept such as primary and 
foreign keys, data modelling, and normalization (up to 3rd or 4th level 
normalization is generally good enough for all practical purposes).


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



Re: admin interface error

2012-01-05 Thread Hassan
i did this in the WSGI file :

import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

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

and i added the path for my website and when i did syncdb it created
my tables but i cant access the admin interface now

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