Minimilisticaly: Deploying Django using Nginx on Ubuntu 12.10

2012-12-26 Thread djangobie
Hi all, 
I am trying to deploy my Django project using Nginx, tried various 
tutorials. All of them are filled bunch of dependencies and requirements. 
Here I am looking forward to a simple (in sure way minimilistic), procedure 
to do so i.e. deploying my Django project (*mysite1*) and (*mysite2*) with 
apps (*myapp1*) and (*myapp2*).

P.S, I am not looking for some solution stating use of 'virtualenv' or in 
combination with other servers i.e. 'Apache' or 'Gunicorn' etc.
It would be top, if you can explain the settings + config using (*mysite1*) 
with (*myapp1*). 

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/-/na_ZM3qY5IoJ.
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: Serving static files: Tried 3 ways with no luck

2012-12-26 Thread Mike Dewhirst

On 27/12/2012 2:03pm, warsam...@gmail.com wrote:

I am having an unbelievable time getting my new django application to
servie static files, i have read the django documentation but it seems
as there isn't one consistent way to serve static files while in
development using the Django server.

In order are my settings.py file, my urls.py file and finally in my
base.html where i reference these files.


I have no idea why i still get 404 not found errors when the path is
full load as in when i reference in my base.html file {{ Media_Url}} it
actually resolves to /media/ yet the file is still not found.

If anyone can help, please let me know. i have spent way to long on this
small issue.


I remember I found it tricky in the beginning. The way I finally got my 
head around it was to put print statements in my settings file (if DEBUG 
of course) to output the paths for static and media dirs. Then I 
experimented with settings.STATICFILES_FINDERS until I figured out 
exactly what delivered the goods.


hth

Mike



--
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/-/r63T5ycQ81MJ.
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: How do I create timestamp type columns in (mySQL) database?

2012-12-26 Thread Mike Dewhirst

On 27/12/2012 2:40am, Subodh Nijsure wrote:

I am working with situation where I would like to maintain timestamp (in
UTC) of when a record is created or updated.


I can't help with MySQL but Postgres makes it easy. If you syncdb a 
models.DateTimeField, Postgres (or more correctly, the Postgres backend 
in Django) makes it "timestamp with time zone"


Thereafter, to put the right data into such a column you need to make 
sure you are giving it a UTC date/time.


This is how I return a UTC timestamp wherever I want one ...

import pytz
from datetime import datetime

def when():
return datetime.now(tz=pytz.utc)

For datetime arithmetic I have a little utility like this which uses 
Django's timezone.make_aware() ...


def addyears(dday=None, yrs=5):
from django.utils import timezone
from calendar import leapdays
if not dday:
dday = when()
ldays = leapdays(dday.year, dday.year + yrs)
future = datetime.fromordinal(dday.toordinal() + (yrs * 365) + ldays)
return timezone.make_aware(future, pytz.utc)

And, as general practice I long ago decided to use datetimes exclusively 
so I don't have to think too hard.


hth

Mike



mySQL offers such facility if one declares column of type 'timestamp'
with attributes - default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'

However I haven't found way to declare a column time as timestamp in
django (1.4).

I have come across postings - http://ianrolfe.livejournal.com/36017.html

that tries to define field as timestamp, but it doesn't seem to work.

Is there way to declare column of type  'timestamp' in django and not
datetime and assign some properties to the column.

  As a hack I can always execute alter table command, but I am not sure
what effect that will have if I want to use admin interface to edit
those tables.

Would appreciate any help/pointer on how one can go about handling UTC
timestamp columns in database.

Thanks.

-Subodh

--
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: Is their an easy way to implement an ordered list of, say, urls in Django

2012-12-26 Thread Doug Snyder
OK, cool, thanks.
I'll keep in mind the custom SQL solution for the future but for this
project I think I do the editing on the front end ( see below)
I have a strange background where I'm learning django but have never used
SQL outside of django's ORM.
I haven't played around with custom SQL since I don't know it.
Is it just a matter of basically copying the code you listed above and
putting that somewhere in my model?



On Sun, Dec 23, 2012 at 12:14 AM, Dennis Lee Bieber
wrote:

> > I could also load the whole list into memory while editing and then save
> it
> > to the db once all editing was
> > complete.
>
> And updating ALL records one at a time is better than updating a
> bunch of "order" fields in one query
>
> This proposal is equivalent to just dumping the database table and
> creating it new on every addition of a record. If the data is not being
> used in any join operations you might as well just save it as a CSV file
> and reload that each time.


Yea, sorry I wasn't very clear. I am thinking of doing the editing on the
front end using KnockOutJS which is a ModelView  ViewModel implementation
in javascript. So I would pass the list to KnockOutJS in a mirrored data
structure and edit it there. SO I guess it is like dumping the whole list,
but since I want the user to edit it on the front end the ineficiency is
acceptable. I guess Javascript lends itself better to editing and inserting
to an ordered list than SQL does and the data has to go the front end
anyways.

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



Serving static files: Tried 3 ways with no luck

2012-12-26 Thread warsameb0
I am having an unbelievable time getting my new django application to 
servie static files, i have read the django documentation but it seems as 
there isn't one consistent way to serve static files while in development 
using the Django server.

In order are my settings.py file, my urls.py file and finally in my 
base.html where i reference these files.


I have no idea why i still get 404 not found errors when the path is full 
load as in when i reference in my base.html file {{ Media_Url}} it actually 
resolves to /media/ yet the file is still not found.

If anyone can help, please let me know. i have spent way to long on this 
small issue.

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

Title: {% block title %}Taleebo{% endblock %}






# Django settings for Bixin_Taleebo project.
import os
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'TaleeboBixin',  # Or path to database file if using sqlite3.
'USER': 'postgres',  # Not used with sqlite3.
'PASSWORD': 'f7!83pwu',  # Not used with sqlite3.
'HOST': 'localhost',  # Set to empty string for localhost. Not used with sqlite3.
'PORT': '5432',  # Set to empty string for default. Not used with sqlite3.
}
}

SITE_ROOT = '/'.join(os.path.dirname(__file__).split('/')[0:-2])

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = '%s/media/' % (SITE_ROOT)

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/;, "http://example.com/media/;
MEDIA_URL = '/media/'

ADMIN_MEDIA_PREFIX = '/media/admin/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join(SITE_ROOT, 'media/static/')

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/;
STATIC_URL = '/static/'

# Additional locations of static files
#STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
 #   os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'static'),
  #  )

# List of finder classes that know how to find static files in
# various locations.
#STATICFILES_FINDERS = (
#'django.contrib.staticfiles.finders.FileSystemFinder',
#'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
#)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '!^ztby2)y_(kc4#twtf1@x5xh1#kos$g)-*dc)nec(k9-wew$!'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',

Re: Mezzanine 1.3 and Cartridge 0.7 released

2012-12-26 Thread Stephen McDonald
Sorry for the double-post. I think this one was stuck in the spam
queue for a couple of days as it contains the word "spam", go
figure :-)

On Dec 26, 2:16 pm, Stephen McDonald  wrote:
> Hi all,
>
> I'm really pleased to announce the releases of Mezzanine 1.3 and Cartridge
> 0.7. Mezzanine is a BSD licensed CMS framework for Django, and Cartridge is
> its companion project that provides e-commerce support for Mezzanine. It's
> been almost 5 months since 1.2 and 0.6 were released, which is one of the
> longest stretches between releases in their history. These releases are
> also one of the largest in terms of number of changes, but one of the
> smallest in terms of new features. This represents a really interesting
> stage, showing good signs of both feature completeness and polish.
>
> Here's an overview of what's new:
>
> Project:
>
> - Full support for Django 1.5
> - Improved support for Lettuce test runner
> - Improved support for django-compressor
> - Updated to latest client libraries (jQuery/jQuery UI/Boostrap)
> - All previous versions now tagged in GitHub/Bitbucket
> - Separation of mandatory and optional fixtures during installation
> - Configurable upload_to handlers per file fields
> - Configurable spam filters (previously akismet only)
> - Configurable "search in" options in public search form
> - Support for custom markup formats in content description generation
> - Support for custom markup formats in comment rendering
> - Multi-tenancy now supports is_staff across Django Admin and live-editing
> - Multi-tenancy support in sitemaps
> - Support for excluding pages/content from sitemaps
>
> Deployment:
>
> - JVM/Jython compatibility
> - Improved automated deploys: locale and ssl config fixes
>
> Pages:
>
> - Improved drag/drop support for reordering the page tree
>
> Forms:
>
> - New DOB field type in the forms builder app
> - Support for custom field types in the forms builder app
>
> Blogs:
>
> - More granular template blocks throughout the blog app
> - Recent posts template tag in blog app supports tag/category filtering
> - Next/previous blog post in blog detail view- Ownable model filtering in
> Django Admin now configurable
>
> Shop (Cartridge):
>
> - New payment handler for Stripe
> - Better support for currency locale on Windows
>
> That's it! As usual the number of contributors and deployed sites has grown
> rapidly. A big thanks to everyone who has contributed features and fixes,
> provided community support, and for sharing the awesome sites they've built
> using Mezzanine and Cartridge.
>
> Check out the following URLs for more info:
>
> Project homepage:http://mezzanine.jupo.org
> Sites gallery:http://mezzanine.jupo.org/sites/
> Mailing list:https://groups.google.com/group/mezzanine-users
> IRC: #mezzanine on irc.freenode.net
> Mezzanine docs:http://mezzanine.jupo.org/docs/
> Mezzanine source:https://github.com/stephenmcd/mezzanine
> Cartridge docs:http://cartridge.jupo.org
> Cartridge source:https://github.com/stephenmcd/cartridge
>
> Cheers,
> Steve
>
> --
> Stephen McDonaldhttp://jupo.org

-- 
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: Python shell doesn't launch

2012-12-26 Thread Ramiro Morales
On Dec 26, 2012 7:46 PM,  wrote:
>
> You know what? I didn't "expect" anything because I HAVEN'T DONE THIS 
> BEFORE That is why I am doing an introductory tutorial. Thanks, Ramiro - 
> highly intelligent answer. Ryan - you are a professional.

Wait. Why do you assume I was trying  to troll you?. I'm not a native
english speaker and my question was honest and to the point, even if
terse.

But now you've made me think:

One of the basic things repeated many many times in our field (I think
it must have been so in the last decade) when it come to ask smart and
effective question is to state not only what are the results you get but
also what did you expect. How do you think we will be able to help you
if you don't tell us what were your expectations?

In the end, this might come to this sentence in part one of the official
tutorial (that I assume is the one you are following) when talking about
running manage.py shell:

"Now, let's hop into the interactive Python shell and play around with
the free API Django gives you. To invoke the Python shell, use this
command:

python manage.py shell
"

( https://docs.djangoproject.com/en/1.4/intro/tutorial01/#playing-with-the-api )

Personally I think people should not learn Python and Django at the same
time. In this way, having some Python familiarity will mean at this
point the reader will know at what the 'interactive Python shell' is.
Because it's beautifully explained in the most basic official Python
tutorial:

http://docs.python.org/2/tutorial/interpreter.html#interactive-mode

(it even has an example output very similar to the seemingly confusing
output you pasted in your first post).

This is the second thread in which my impression is that you'd be less
frustrated if you took the time to make yourself comfortable with the
basic Python concepts first.

Regards,

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



Re: Code guidance please review.

2012-12-26 Thread Bill Freeman
On Wed, Dec 26, 2012 at 3:50 PM, Glyn Jackson  wrote:

> ke1g, thank you for such a well written reply, clearly explained, I learn
> a lot. again thanks.
>
> The only bit I'm struggling to understand is the last part you state
>
> "The use of "thisPoints" in calculating "totalPoints" doesn't change
> "thisPoints".  You can still enumerate it in the template, and get the same
> result."
>

Manager and queryset methods like "filter" return a new queryset, which is
a python class instance holding all the things that you have said about
your query, but it hasn't touched the database as yet.  When you use
something like "filter" on an existing queryset, the original information
is still in the original queryset, it has been copied as necessary in the
construction of the new queryset.

A queryset is "evaluated" only when you try to use what's in the queryset,
such as "list(qs)" or "for r in qs" (including the template language's
"for"), or when you print it in the manage.py shell, as examples.  And only
when it is evaluated, does it wind up composing SQL, send it to the
database, parse the result into model instances (and cacheing these as part
of doing requests with large numbers of results in chunks, among other
things).  You really get quite a number of splendid optimizations when you
use the ORM.

So at the time I showed applying "aggregate" to the "thisPoints" queryset,
"thisPoints" hadn't touched the database.  At that time, it is specifically
NOT a list of instances.  It is still a queryset class instance.  And the
"aggregate" method uses what's in it, but doesn't change it.  Later, in
your template, where you presumably apply a "for" template tag to it, is
when it uses what it knows to get stuff for you from the database.

Bill

-- 
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 Polls in the admin page

2012-12-26 Thread Ryan Blunden
Can you provide the contents of your admin.py in your polls app. If you've got 
the below code, then I'm not sure how that is happening.
class PollAdmin(admin.ModelAdmin):
fields = ['pub_date', 'question']

admin.site.register(Poll, PollAdmin)

Cheers,
Ryan

On 26/12/2012, at 11:09 AM, Kelketek Rritaa  wrote:

> I'm having precisely the same issue with precisely the same side effects. 
> Further, I am able to get output to my logs by adding a print statement to 
> the admin.py file. So I know it's being executed, it just doesn't show up in 
> the admin page. Running syncdb has not fixed it.
> 
> Has anyone found a solution to this? There obviously must be something else 
> that needs to be done, as all the other apps continue to hum along just fine 
> in the admin page.
> 
> On Thursday, November 1, 2012 1:59:18 PM UTC-5, Mihail Mihalache wrote:
> I have followed the django tutorial up to part 2 - 
> https://docs.djangoproject.com/en/1.4/intro/tutorial02/ .
> Everything worked fine, until I couldn't see the Polls entry on the admin 
> page. I have checked that I have done everything mentioned in the tutorial. 
> I get no error whatsoever. I have no idea what's wrong.
> There is a polls entry INSTALLED_APPS.
> 
> -- 
> 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/-/eQx6YFul_j4J.
> 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: Python shell doesn't launch

2012-12-26 Thread Ryan Blunden
Glad to be able to help.

I've got a few tips too :)

  - Use the excellent Django Extensions app which once you add it to your 
INSTALLED_APPS tuple, will allow you to run python manage.py shell_plus, which 
automatically imports all of the models for apps. This is great as it's not 
often that you want to use shell without importing some models at least.

Also, install iPython, it has great features (e.g. command history) that make 
it much friendlier than the standard interactive mode.

Cheers,
Ryan

On 26/12/2012, at 2:45 PM, rktur...@gmail.com wrote:

> You know what? I didn't "expect" anything because I HAVEN'T DONE THIS 
> BEFORE That is why I am doing an introductory tutorial. Thanks, Ramiro - 
> highly intelligent answer. Ryan - you are a professional.  
> 
> On Wednesday, December 26, 2012 5:05:10 PM UTC-5, rktu...@gmail.com wrote:
> Whenever I run "python manage.py shell," I don't get any errors, but  I get 
> the following:
> 
> C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py shell
> Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on 
> win
> 32
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> 
> Any ideas on what am I doing or have done wrong?
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/_O0uxSfrIHIJ.
> 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: Python shell doesn't launch

2012-12-26 Thread rkturn49
You know what? I didn't "expect" anything because I HAVEN'T DONE THIS 
BEFORE That is why I am doing an introductory tutorial. Thanks, Ramiro 
- highly intelligent answer. Ryan - you are a professional.  

On Wednesday, December 26, 2012 5:05:10 PM UTC-5, rktu...@gmail.com wrote:
>
> Whenever I run "python manage.py shell," I don't get any errors, but  I 
> get the following:
>
> *C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py shell*
> *Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit 
> (Intel)] on win*
> *32*
> *Type "help", "copyright", "credits" or "license" for more information.*
> *(InteractiveConsole)*
> *
> *
> *Any ideas on what am I doing or have done wrong?*
> *
> *
> *
> *
>

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

2012-12-26 Thread Gerald Klein
@cramm0 obviously new to the game, cut him a break.

On Wed, Dec 26, 2012 at 4:11 PM, Ramiro Morales  wrote:

> On Dec 26, 2012 7:05 PM,  wrote:
> >
> > Whenever I run "python manage.py shell," I don't get any errors, but  I
> get the following:
> >
> > C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py shell
> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
> (Intel)] on win
> > 32
> > Type "help", "copyright", "credits" or "license" for more information.
> > (InteractiveConsole)
> >
> > Any ideas on what am I doing or have done wrong?
>
> That's what is supposed to happen. What did you expect?
>
> --
> 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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

geraldklein.wordpress.com

j...@zognet.com

708-599-0352


Arch Awesome, Ranger & Vim the coding triple threat.

Linux registered user #548580

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

2012-12-26 Thread Gerald Klein
do you use vim? There is a nice function that can straighten this out for
you. Also tabs va spaces can make a difference. Make sure a given block is
either all space indented ot all tab indented.

add to vimrc

set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<


then type

:set list

this will show whitespace characters and highlight difference tabs/spaces
to see them.

--jerry

On Wed, Dec 26, 2012 at 4:16 PM, Ramiro Morales  wrote:

>
> On Dec 26, 2012 5:56 PM,  wrote:
> >
> > This is strange - the original code is indented correctly; however, the
> copy/paste shows incorrect indentation.
>
> This could happen if you mix spaces andás tabs. Read some introductory
> Python material to know more why this is a bad idea and a basic mistake.
>
> --
> 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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

geraldklein.wordpress.com

j...@zognet.com

708-599-0352


Arch Awesome, Ranger & Vim the coding triple threat.

Linux registered user #548580

-- 
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: Python shell doesn't launch

2012-12-26 Thread Ryan Blunden
That's Python's standard output when starting an interactive session.

On 26/12/2012, at 2:05 PM, rktur...@gmail.com wrote:

> Whenever I run "python manage.py shell," I don't get any errors, but  I get 
> the following:
> 
> C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py shell
> Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on 
> win
> 32
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> 
> Any ideas on what am I doing or have done wrong?
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/cBacqTBYkgQJ.
> 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: Stuck

2012-12-26 Thread Ramiro Morales
On Dec 26, 2012 5:56 PM,  wrote:
>
> This is strange - the original code is indented correctly; however, the
copy/paste shows incorrect indentation.

This could happen if you mix spaces andás tabs. Read some introductory
Python material to know more why this is a bad idea and a basic mistake.

-- 
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: Python shell doesn't launch

2012-12-26 Thread Ramiro Morales
On Dec 26, 2012 7:05 PM,  wrote:
>
> Whenever I run "python manage.py shell," I don't get any errors, but  I
get the following:
>
> C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py shell
> Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
on win
> 32
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
>
> Any ideas on what am I doing or have done wrong?

That's what is supposed to happen. What did you expect?

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



Python shell doesn't launch

2012-12-26 Thread rkturn49
Whenever I run "python manage.py shell," I don't get any errors, but  I get 
the following:

*C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py shell*
*Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] 
on win*
*32*
*Type "help", "copyright", "credits" or "license" for more information.*
*(InteractiveConsole)*
*
*
*Any ideas on what am I doing or have done wrong?*
*
*
*
*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/cBacqTBYkgQJ.
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: debugging issues with settings.py and database (postgres) and syncdb

2012-12-26 Thread Ryan Blunden
Ok. I would try setting the ENGINE value to *sqlite3* and try running *syncdb
*again. If that works (which it should), then we can presume it's a
configuration access problem with the DB.


On 26 December 2012 13:18, Dan Richards  wrote:

> NO, just me messing around that it made no difference.  I have the db
> access to all and trust and the error doesn't change no matter what I use
> there.  It feels like it could be a permissions problem, but I don't know
> how to track it down other than to verify I can access postgres via psql
> which I can do...
>
>
> On Wednesday, December 26, 2012 12:40:28 PM UTC-5, Dan Richards wrote:
>>
>> First off, I am a newbie to django, python and postgres - so I suspect I
>> am missing something obvious, but I am stumped.  Any ideas will be
>> gratefully accepted...
>>
>> I get the popular "Improperly configured settings.DATABASES" error
>> message when I run syncdb on my test app.  I am running:
>>
>> django 1.4.3
>> postgres 9.2
>> MAC OS 10.6.8
>>
>> I have verified that it is picking up the right settings.py file (the one
>> in the app subdirectory) so I assume there is either something wrong with
>> the settings I have entered or something wrong with postgres.  How does one
>> debug this??
>>
>> I can connect to my database via psql, but nothing I have tried seems to
>> work and there seems to be very little I can do to actually debug what the
>> problem is...when the syncdb doesn't work, how do you debug to figure out
>> what exactly isn't working???
>>
>> My settings.py file:
>>
>> # Django settings for hellodjango project.
>>
>> DEBUG = True
>> TEMPLATE_DEBUG = DEBUG
>>
>> ADMINS = (
>> ('Joe Smith', 'jsm...@foobar.com'),
>> )
>>
>> MANAGERS = ADMINS
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.**postgresql_psycopg2', # Add
>> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
>> 'NAME': 'test_db1',  # Or path to database
>> file if using sqlite3.
>> 'USER': '',  # Not used with sqlite3.
>> 'PASSWORD': '',  # Not used with sqlite3.
>> 'HOST': '',  # Set to empty string for
>> localhost. Not used with sqlite3.
>> 'PORT': '',  # Set to empty string for
>> default. Not used with sqlite3.
>> }
>> }
>>
>> # Local time zone for this installation. Choices can be found here:
>> # 
>> http://en.wikipedia.org/wiki/**List_of_tz_zones_by_name
>> # although not all choices may be available on all operating systems.
>> # In a Windows environment this must be set to your system time zone.
>> TIME_ZONE = 'America/New_York'
>>
>> # Language code for this installation. All choices can be found here:
>> # 
>> http://www.i18nguy.com/**unicode/language-identifiers.**html
>> LANGUAGE_CODE = 'en-us'
>>
>> SITE_ID = 1
>>
>> # If you set this to False, Django will make some optimizations so as not
>> # to load the internationalization machinery.
>> USE_I18N = True
>>
>> # If you set this to False, Django will not format dates, numbers and
>> # calendars according to the current locale.
>> USE_L10N = True
>>
>> # If you set this to False, Django will not use timezone-aware datetimes.
>> USE_TZ = True
>>
>> # Absolute filesystem path to the directory that will hold user-uploaded
>> files.
>> # Example: 
>> "/home/media/media.lawrence.**com/media/
>> "
>> MEDIA_ROOT = ''
>>
>> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
>> # trailing slash.
>> # Examples: 
>> "http://media.lawrence.com/**media/",
>> "http://example.com/media/;
>> MEDIA_URL = ''
>>
>> # Absolute path to the directory static files should be collected to.
>> # Don't put anything in this directory yourself; store your static files
>> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
>> # Example: 
>> "/home/media/media.lawrence.**com/static/
>> "
>> STATIC_ROOT = ''
>>
>> # URL prefix for static files.
>> # Example: 
>> "http://media.lawrence.com/**static/
>> "
>> STATIC_URL = '/static/'
>>
>> # Additional locations of static files
>> STATICFILES_DIRS = (
>> # Put strings here, like "/home/html/static" or
>> "C:/www/django/static".
>> # Always use forward slashes, even on Windows.
>> # Don't forget to use absolute paths, not relative paths.
>> )
>>
>> # List of finder classes that know how to find static files in
>> # various locations.
>> STATICFILES_FINDERS = (
>> 'django.contrib.staticfiles.**finders.FileSystemFinder',
>> 'django.contrib.staticfiles.**finders.AppDirectoriesFinder',
>> #'django.contrib.staticfiles.**finders.DefaultStorageFinder',
>> )
>>
>> # Make this unique, and don't share it with anybody.
>> 

Re: debugging issues with settings.py and database (postgres) and syncdb

2012-12-26 Thread Dan Richards
NO, just me messing around that it made no difference.  I have the db 
access to all and trust and the error doesn't change no matter what I use 
there.  It feels like it could be a permissions problem, but I don't know 
how to track it down other than to verify I can access postgres via psql 
which I can do...

On Wednesday, December 26, 2012 12:40:28 PM UTC-5, Dan Richards wrote:
>
> First off, I am a newbie to django, python and postgres - so I suspect I 
> am missing something obvious, but I am stumped.  Any ideas will be 
> gratefully accepted...
>
> I get the popular "Improperly configured settings.DATABASES" error message 
> when I run syncdb on my test app.  I am running:
>
> django 1.4.3
> postgres 9.2
> MAC OS 10.6.8
>
> I have verified that it is picking up the right settings.py file (the one 
> in the app subdirectory) so I assume there is either something wrong with 
> the settings I have entered or something wrong with postgres.  How does one 
> debug this??
>
> I can connect to my database via psql, but nothing I have tried seems to 
> work and there seems to be very little I can do to actually debug what the 
> problem is...when the syncdb doesn't work, how do you debug to figure out 
> what exactly isn't working???
>
> My settings.py file:
>
> # Django settings for hellodjango project.
>
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
> ('Joe Smith', 'jsm...@foobar.com'),
> )
>
> MANAGERS = ADMINS
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 
> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'test_db1',  # Or path to database 
> file if using sqlite3.
> 'USER': '',  # Not used with sqlite3.
> 'PASSWORD': '',  # Not used with sqlite3.
> 'HOST': '',  # Set to empty string for 
> localhost. Not used with sqlite3.
> 'PORT': '',  # Set to empty string for 
> default. Not used with sqlite3.
> }
> }
>
> # Local time zone for this installation. Choices can be found here:
> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating systems.
> # In a Windows environment this must be set to your system time zone.
> TIME_ZONE = 'America/New_York'
>
> # Language code for this installation. All choices can be found here:
> # http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'en-us'
>
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so as not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # If you set this to False, Django will not format dates, numbers and
> # calendars according to the current locale.
> USE_L10N = True
>
> # If you set this to False, Django will not use timezone-aware datetimes.
> USE_TZ = True
>
> # Absolute filesystem path to the directory that will hold user-uploaded 
> files.
> # Example: "/home/media/media.lawrence.com/media/"
> MEDIA_ROOT = ''
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
> # trailing slash.
> # Examples: "http://media.lawrence.com/media/;, "http://example.com/media/
> "
> MEDIA_URL = ''
>
> # Absolute path to the directory static files should be collected to.
> # Don't put anything in this directory yourself; store your static files
> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> # Example: "/home/media/media.lawrence.com/static/"
> STATIC_ROOT = ''
>
> # URL prefix for static files.
> # Example: "http://media.lawrence.com/static/;
> STATIC_URL = '/static/'
>
> # Additional locations of static files
> STATICFILES_DIRS = (
> # Put strings here, like "/home/html/static" or "C:/www/django/static".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> )
>
> # List of finder classes that know how to find static files in
> # various locations.
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> #'django.contrib.staticfiles.finders.DefaultStorageFinder',
> )
>
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = '3*a*mgk*)dcdyzi8v4#2%z^mt^63-uqq5g)q63)xy37ogcqxux'
>
> # List of callables that know how to import templates from various sources.
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> # 'django.template.loaders.eggs.Loader',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> # Uncomment the next line for 

Re: Stuck

2012-12-26 Thread rkturn49
This is strange - the original code is indented correctly; however, the 
copy/paste shows incorrect indentation. I would have noticed something THAT 
obvious. The misspelling is legit, but what was wrong was that I had two 
files named"polls," which confused everything. 

On Wednesday, December 26, 2012 2:22:40 PM UTC-5, rktu...@gmail.com wrote:
>
> I'll keep this as short as possible. When I input * python manage.py sql 
> polls*, i get the following error:
> * *
> C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py sql pol
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py
> 443, in execute_from_command_line
> utility.execute()
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py
> 382, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in execute
> self.validate()
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in validate
> num_errors = get_validation_errors(s, app)
>   File "C:\Python27\lib\site-packages\django\core\management\validation.
> e 30, in get_validation_errors
> for (app_name, error) in get_app_errors().items():
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
>  get_app_errors
> self._populate()
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
> _populate
> self.load_app(app_name, True)
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
> load_app
> models = import_module('.models', app_name)
>   File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 3
> port_module
> __import__(name)
>   File "C:\Python27\Lib\site-packages\django\bin\mysite\polls\models.py"
> 0
> votes = models.IntergerField()
>  ^
> IndentationError: unindent does not match any outer indentation level
>
> So here is my settings.py "Installed apps"* *
> *
> *
> *INSTALLED_APPS = (*
> *'django.contrib.auth',*
> *'django.contrib.contenttypes',*
> *'django.contrib.sessions',*
> *'django.contrib.sites',*
> *'django.contrib.messages',*
> *'django.contrib.staticfiles',*
> *# Uncomment the next line to enable the admin:*
> *# 'django.contrib.admin',*
> *# Uncomment the next line to enable admin documentation:*
> *# 'django.contrib.admindocs',*
> * 'polls',*
> *)*
> *
> *
> And here is my models.py:
>
> from django.db import models
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntergerField()
>
> I am running python 2.7 and Django 1.4.3 on Windows 8
> 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/-/_tb9n3Oq35wJ.
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: Code guidance please review.

2012-12-26 Thread Glyn Jackson
ke1g, thank you for such a well written reply, clearly explained, I learn a 
lot. again thanks.

The only bit I'm struggling to understand is the last part you state

"The use of "thisPoints" in calculating "totalPoints" doesn't change 
"thisPoints".  You can still enumerate it in the template, and get the same 
result."


-- 
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/-/iJtWTRu4Id4J.
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 comments customization issue

2012-12-26 Thread sri
Hi donarb,

Thanks for your reply. It worked after changing the input tags names as you 
mentioned.

And also, thanks for mentioned about BR tags as well.

Thanks


On Wednesday, 26 December 2012 20:06:15 UTC, donarb wrote:
>
> On Wednesday, December 26, 2012 11:43:47 AM UTC-8, sri wrote:
>>
>> Hi, I am trying to learn django comments customization by adding an 
>> integer field to the comments framework. My Model looks like below
>>
>> class CommentWithRating(Comment): rating = 
>> models.IntegerField(name='rating')
>>
>> And i am trying to display the value in the rating field by using the 
>> jquery star, but it is displaying all the stars in one comment. Please 
>> check the link to see how the comments are displayed. 
>> http://imgur.com/43CUU  [1]
>>
>> The code i am using in my template is as below.
>>
>> 
>> {% load comments %}
>> 
>>  Add Your Comments Here / Rate : 
>> {% render_comment_form for party_details %}
>> {% get_comment_count for party_details as comment_count %}
>>   Customer Reviews( {{ comment_count }} comments have 
>> been posted.)
>> 
>> {% get_comment_list for party_details as comment_list %}
>> {% for comment in comment_list %}
>> 
>> Posted by: {{ comment.user_name }} on {{ 
>> comment.submit_date }} Rating: 
>>
>> 
>> {% for i in loop_times %}
>> {% if i == comment.rating %}
>> > class="star" checked="checked" disabled="disabled"/>
>> {% else %}
>> > class="star" disabled="disabled"/>
>> {% endif %}
>> {% endfor %}
>> {{ comment.rating }}
>> 
>> 
>> Comment: {{ comment.comment }}
>> 
>> {% endfor %}
>> 
>>
>> I am working on Django 1.4.1 version and 
>> http://www.fyneworks.com/jquery/star-rating/#tab-Overview[2] (for jquery 
>> stars). loop_times in the template is a range from 1 to 5, which is passed 
>> from the view.
>>
>> Can anyone help with why the ratings are all displayed in one place when 
>> i use jquery star.
>>
>> Thanks in advance.
>>
>
>
> It's most likely because your input items all have the same name 'star'. 
> You should use an index in the loop to make the names unique for each of 
> the comments. Something like:
>
> {% if i == comment.rating %}
>  class="star" checked=="checked" disabled="disabled"/>
> {% else %}
>  class="star" disabled="disabled"/>
> {% endif %}
>
> Note you have to use parentloop because your loop is nested.
>
> Also as an FYI, your 'br' tags are coded wrong, they should be ''.
>

-- 
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/-/NZICD7DewckJ.
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: debugging issues with settings.py and database (postgres) and syncdb

2012-12-26 Thread Ryan Blunden
Are the user and password fields meant  to be blank?

Cheers,
Ryan

On Dec 26, 2012, at 9:40 AM, Dan Richards  wrote:

> First off, I am a newbie to django, python and postgres - so I suspect I am 
> missing something obvious, but I am stumped.  Any ideas will be gratefully 
> accepted...
> 
> I get the popular "Improperly configured settings.DATABASES" error message 
> when I run syncdb on my test app.  I am running:
> 
> django 1.4.3
> postgres 9.2
> MAC OS 10.6.8
> 
> I have verified that it is picking up the right settings.py file (the one in 
> the app subdirectory) so I assume there is either something wrong with the 
> settings I have entered or something wrong with postgres.  How does one debug 
> this??
> 
> I can connect to my database via psql, but nothing I have tried seems to work 
> and there seems to be very little I can do to actually debug what the problem 
> is...when the syncdb doesn't work, how do you debug to figure out what 
> exactly isn't working???
> 
> My settings.py file:
> 
> # Django settings for hellodjango project.
> 
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
> 
> ADMINS = (
> ('Joe Smith', 'jsm...@foobar.com'),
> )
> 
> MANAGERS = ADMINS
> 
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 
> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'test_db1',  # Or path to database file 
> if using sqlite3.
> 'USER': '',  # Not used with sqlite3.
> 'PASSWORD': '',  # Not used with sqlite3.
> 'HOST': '',  # Set to empty string for localhost. 
> Not used with sqlite3.
> 'PORT': '',  # Set to empty string for default. 
> Not used with sqlite3.
> }
> }
> 
> # Local time zone for this installation. Choices can be found here:
> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating systems.
> # In a Windows environment this must be set to your system time zone.
> TIME_ZONE = 'America/New_York'
> 
> # Language code for this installation. All choices can be found here:
> # http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'en-us'
> 
> SITE_ID = 1
> 
> # If you set this to False, Django will make some optimizations so as not
> # to load the internationalization machinery.
> USE_I18N = True
> 
> # If you set this to False, Django will not format dates, numbers and
> # calendars according to the current locale.
> USE_L10N = True
> 
> # If you set this to False, Django will not use timezone-aware datetimes.
> USE_TZ = True
> 
> # Absolute filesystem path to the directory that will hold user-uploaded 
> files.
> # Example: "/home/media/media.lawrence.com/media/"
> MEDIA_ROOT = ''
> 
> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
> # trailing slash.
> # Examples: "http://media.lawrence.com/media/;, "http://example.com/media/;
> MEDIA_URL = ''
> 
> # Absolute path to the directory static files should be collected to.
> # Don't put anything in this directory yourself; store your static files
> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> # Example: "/home/media/media.lawrence.com/static/"
> STATIC_ROOT = ''
> 
> # URL prefix for static files.
> # Example: "http://media.lawrence.com/static/;
> STATIC_URL = '/static/'
> 
> # Additional locations of static files
> STATICFILES_DIRS = (
> # Put strings here, like "/home/html/static" or "C:/www/django/static".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> )
> 
> # List of finder classes that know how to find static files in
> # various locations.
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> #'django.contrib.staticfiles.finders.DefaultStorageFinder',
> )
> 
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = '3*a*mgk*)dcdyzi8v4#2%z^mt^63-uqq5g)q63)xy37ogcqxux'
> 
> # List of callables that know how to import templates from various sources.
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> # 'django.template.loaders.eggs.Loader',
> )
> 
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> # Uncomment the next line for simple clickjacking protection:
> # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> )
> 
> ROOT_URLCONF = 'hellodjango.urls'
> 
> # Python dotted path to the WSGI application used by Django's runserver.
> 

Re: Django comments customization issue

2012-12-26 Thread donarb
On Wednesday, December 26, 2012 11:43:47 AM UTC-8, sri wrote:
>
> Hi, I am trying to learn django comments customization by adding an 
> integer field to the comments framework. My Model looks like below
>
> class CommentWithRating(Comment): rating = 
> models.IntegerField(name='rating')
>
> And i am trying to display the value in the rating field by using the 
> jquery star, but it is displaying all the stars in one comment. Please 
> check the link to see how the comments are displayed. 
> http://imgur.com/43CUU  [1]
>
> The code i am using in my template is as below.
>
> 
> {% load comments %}
> 
>  Add Your Comments Here / Rate : 
> {% render_comment_form for party_details %}
> {% get_comment_count for party_details as comment_count %}
>   Customer Reviews( {{ comment_count }} comments have 
> been posted.)
> 
> {% get_comment_list for party_details as comment_list %}
> {% for comment in comment_list %}
> 
> Posted by: {{ comment.user_name }} on {{ 
> comment.submit_date }} Rating:  
>   
> 
> {% for i in loop_times %}
> {% if i == comment.rating %}
>  class="star" checked="checked" disabled="disabled"/>
> {% else %}
>  class="star" disabled="disabled"/>
> {% endif %}
> {% endfor %}
> {{ comment.rating }}
> 
> 
> Comment: {{ comment.comment }}
> 
> {% endfor %}
> 
>
> I am working on Django 1.4.1 version and 
> http://www.fyneworks.com/jquery/star-rating/#tab-Overview[2] (for jquery 
> stars). loop_times in the template is a range from 1 to 5, which is passed 
> from the view.
>
> Can anyone help with why the ratings are all displayed in one place when i 
> use jquery star.
>
> Thanks in advance.
>


It's most likely because your input items all have the same name 'star'. 
You should use an index in the loop to make the names unique for each of 
the comments. Something like:

{% if i == comment.rating %}

{% else %}

{% endif %}

Note you have to use parentloop because your loop is nested.

Also as an FYI, your 'br' tags are coded wrong, they should be ''.

-- 
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/-/kARdtyTU33EJ.
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: Stuck

2012-12-26 Thread Ian Foote

Others have commented on your indentation. You also have a typo:


 votes = models.IntergerField()


should be:

votes = models.IntegerField()

Regards,
Ian

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

2012-12-26 Thread Nick Dokos
rktur...@gmail.com wrote:

> I'll keep this as short as possible. When I input  python manage.py sql 
> polls, i get the following
> error:
>  
> C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py sql pol
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py
> 443, in execute_from_command_line
> utility.execute()
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py
> 382, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in execute
> self.validate()
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in validate
> num_errors = get_validation_errors(s, app)
>   File "C:\Python27\lib\site-packages\django\core\management\validation.
> e 30, in get_validation_errors
> for (app_name, error) in get_app_errors().items():
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
>  get_app_errors
> self._populate()
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
> _populate
> self.load_app(app_name, True)
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
> load_app
> models = import_module('.models', app_name)
>   File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 3
> port_module
> __import__(name)
>   File "C:\Python27\Lib\site-packages\django\bin\mysite\polls\models.py"
> 0
> votes = models.IntergerField()
>  ^
> IndentationError: unindent does not match any outer indentation level
> 
> So here is my settings.py "Installed apps" 
> 
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> # Uncomment the next line to enable the admin:
> # 'django.contrib.admin',
> # Uncomment the next line to enable admin documentation:
> # 'django.contrib.admindocs',
> 'polls',
> )
> 
> And here is my models.py:
> 
> from django.db import models
> 
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntergerField()
> 

In python, indentation matters. Also, spelling matters just as much as
it does in other languages: IntergerField should be IntegerField. Try:

--8<---cut here---start->8---
class Poll(models.Model):
  question = models.CharField(max_length=200)
  pub_date = models.DateTimeField('date published')

class Choice(models.Model):
  poll = models.ForeignKey(Poll)
  choice = models.CharField(max_length=200)
  votes = models.IntegerField()
--8<---cut here---end--->8---

Nick

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



Django comments customization issue

2012-12-26 Thread sri


Hi, I am trying to learn django comments customization by adding an integer 
field to the comments framework. My Model looks like below

class CommentWithRating(Comment): rating = 
models.IntegerField(name='rating')

And i am trying to display the value in the rating field by using the 
jquery star, but it is displaying all the stars in one comment. Please 
check the link to see how the comments are displayed. 
http://imgur.com/43CUU
 [1]

The code i am using in my template is as below.


{% load comments %}

 Add Your Comments Here / Rate : 
{% render_comment_form for party_details %}
{% get_comment_count for party_details as comment_count %}
  Customer Reviews( {{ comment_count }} comments have 
been posted.)

{% get_comment_list for party_details as comment_list %}
{% for comment in comment_list %}

Posted by: {{ comment.user_name }} on {{ 
comment.submit_date }} Rating:

{% for i in loop_times %}
{% if i == comment.rating %}

{% else %}

{% endif %}
{% endfor %}
{{ comment.rating }}


Comment: {{ comment.comment }}

{% endfor %}


I am working on Django 1.4.1 version and 
http://www.fyneworks.com/jquery/star-rating/#tab-Overview[2] (for jquery 
stars). loop_times in the template is a range from 1 to 5, which is passed 
from the view.

Can anyone help with why the ratings are all displayed in one place when i 
use jquery star.

Thanks in advance.

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

2012-12-26 Thread Gabriel [SGT]
On Wed, Dec 26, 2012 at 4:22 PM,   wrote:
> IndentationError: unindent does not match any outer indentation level

The error is quite self explanatory.

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

2012-12-26 Thread Jonathan
The stack trace you pasted clearly indicates that you have an
indentation error in your polls/models.py module. It appears that you've
applied two spaces to the 'votes' field while 'poll' and 'choice' have
four. If you'll apply four spaces to all the field, the interpreter
won't complain.

On 12/26/2012 12:22 PM, rktur...@gmail.com wrote:
> I'll keep this as short as possible. When I input / python manage.py
> sql polls/, i get the following error:
> / /
> C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py sql pol
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py
> 443, in execute_from_command_line
> utility.execute()
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py
> 382, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in execute
> self.validate()
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in validate
> num_errors = get_validation_errors(s, app)
>   File "C:\Python27\lib\site-packages\django\core\management\validation.
> e 30, in get_validation_errors
> for (app_name, error) in get_app_errors().items():
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
>  get_app_errors
> self._populate()
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
> _populate
> self.load_app(app_name, True)
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
> load_app
> models = import_module('.models', app_name)
>   File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 3
> port_module
> __import__(name)
>   File "C:\Python27\Lib\site-packages\django\bin\mysite\polls\models.py"
> 0
> votes = models.IntergerField()
>  ^
> IndentationError: unindent does not match any outer indentation level
>
> So here is my settings.py "Installed apps"/ /
> /
> /
> /INSTALLED_APPS = (/
> /'django.contrib.auth',/
> /'django.contrib.contenttypes',/
> /'django.contrib.sessions',/
> /'django.contrib.sites',/
> /'django.contrib.messages',/
> /'django.contrib.staticfiles',/
> /# Uncomment the next line to enable the admin:/
> /# 'django.contrib.admin',/
> /# Uncomment the next line to enable admin documentation:/
> /# 'django.contrib.admindocs',/
> /'polls',/
> /)/
> /
> /
> And here is my models.py:
>
> from django.db import models
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntergerField()
>
> I am running python 2.7 and Django 1.4.3 on Windows 8
> 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/-/e7XydlWTUVgJ.
> 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.



Stuck

2012-12-26 Thread rkturn49
I'll keep this as short as possible. When I input * python manage.py sql 
polls*, i get the following error:
* *
C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py sql pol
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py
443, in execute_from_command_line
utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py
382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", l
 in run_from_argv
self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", l
 in execute
self.validate()
  File "C:\Python27\lib\site-packages\django\core\management\base.py", l
 in validate
num_errors = get_validation_errors(s, app)
  File "C:\Python27\lib\site-packages\django\core\management\validation.
e 30, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
 get_app_errors
self._populate()
  File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
_populate
self.load_app(app_name, True)
  File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
load_app
models = import_module('.models', app_name)
  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 3
port_module
__import__(name)
  File "C:\Python27\Lib\site-packages\django\bin\mysite\polls\models.py"
0
votes = models.IntergerField()
 ^
IndentationError: unindent does not match any outer indentation level

So here is my settings.py "Installed apps"* *
*
*
*INSTALLED_APPS = (*
*'django.contrib.auth',*
*'django.contrib.contenttypes',*
*'django.contrib.sessions',*
*'django.contrib.sites',*
*'django.contrib.messages',*
*'django.contrib.staticfiles',*
*# Uncomment the next line to enable the admin:*
*# 'django.contrib.admin',*
*# Uncomment the next line to enable admin documentation:*
*# 'django.contrib.admindocs',*
* 'polls',*
*)*
*
*
And here is my models.py:

from django.db import models

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntergerField()

I am running python 2.7 and Django 1.4.3 on Windows 8
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/-/e7XydlWTUVgJ.
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 Polls in the admin page

2012-12-26 Thread Kelketek Rritaa
I'm having precisely the same issue with precisely the same side effects. 
Further, I am able to get output to my logs by adding a print statement to 
the admin.py file. So I know it's being executed, it just doesn't show up 
in the admin page. Running syncdb has not fixed it.

Has anyone found a solution to this? There obviously must be something else 
that needs to be done, as all the other apps continue to hum along just 
fine in the admin page.

On Thursday, November 1, 2012 1:59:18 PM UTC-5, Mihail Mihalache wrote:
>
> I have followed the django tutorial up to part 2 - 
> https://docs.djangoproject.com/en/1.4/intro/tutorial02/ .
> Everything worked fine, until I couldn't see the Polls entry on the admin 
> page. I have checked that I have done everything mentioned in the tutorial. 
> I get no error whatsoever. I have no idea what's wrong.
> There is a *polls* entry INSTALLED_APPS.
>

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



debugging issues with settings.py and database (postgres) and syncdb

2012-12-26 Thread Dan Richards
First off, I am a newbie to django, python and postgres - so I suspect I am 
missing something obvious, but I am stumped.  Any ideas will be gratefully 
accepted...

I get the popular "Improperly configured settings.DATABASES" error message 
when I run syncdb on my test app.  I am running:

django 1.4.3
postgres 9.2
MAC OS 10.6.8

I have verified that it is picking up the right settings.py file (the one 
in the app subdirectory) so I assume there is either something wrong with 
the settings I have entered or something wrong with postgres.  How does one 
debug this??

I can connect to my database via psql, but nothing I have tried seems to 
work and there seems to be very little I can do to actually debug what the 
problem is...when the syncdb doesn't work, how do you debug to figure out 
what exactly isn't working???

My settings.py file:

# Django settings for hellodjango project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
('Joe Smith', 'jsm...@foobar.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 
'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'test_db1',  # Or path to database file 
if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for 
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for default. 
Not used with sqlite3.
}
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/New_York'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded 
files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/;, "http://example.com/media/;
MEDIA_URL = ''

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/;
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '3*a*mgk*)dcdyzi8v4#2%z^mt^63-uqq5g)q63)xy37ogcqxux'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'hellodjango.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'hellodjango.wsgi.application'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or 
"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

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

Re: Path problem with jsi18n - internationalization

2012-12-26 Thread Виталий Панькин
Did you try to access it like http:jsi18n/ ? I have 
 http:///jsi18n/ 404 too, but it's okay with locale. It's not good, 
but at least it's something

On Tuesday, January 13, 2009 12:02:47 PM UTC+3, Tipan wrote:
>
> > 
> > That's strange, are you succesfully using another component of Django 
> > i18n infrastructure in the same application?. De you have USE_I18N set 
> to 
> > True in the settings file you are using? 
> > 
>
> Yes. The use_i18n is set to true and I've successfully translated most 
> of my pages, created the .po files with makemessages etc. It's just 
> the Javascript library element I can't seem to get working. 
>
> I just assumed I'd got the wrong path in the template to access the 
> jsi18n javascript. 
>
> Tim

-- 
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/-/Ek-VnVYT6qEJ.
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: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Gerald Klein
I think you are a little to micro what is the difference between a Person
and the other entities are they all not people?

On Wed, Dec 26, 2012 at 11:07 AM, Marcelo Mendes Pereira <
mpmarcel...@gmail.com> wrote:

> I think a i figured out a solution but i don't have a complete
> understanding about the problem to explain exactly what i was doing wrong,
> but here is my schema now
>
> class CommonInfo(models.Model):
> class Meta:
> abstract = True
>
> class User(models.Model):
> user = models.OneToOneField('auth.user')
>
> class Person(User, CommonInfo):
> # specific fields
> pass
>
> class LegalEntity(User, CommonInfo):
> # specific fields
> pass
>
> class Seller(User):
> # specific fields
> pass
>
> class PersonSeller(Person, Seller):
> # specific fields
> pass
>
> class LegalEntitySeller(LegalEntity, Seller):
> # specific fields
> pass
>
> class Supervisor(Seller):
> # specific fields
> supervisees = models.ManyToManyField('Seller', related_name='supervisors')
>
> class Customer(User):
> # specific fields
> pass
>
> class PersonCustomer(Person, Customer):
> # specific fields
> pass
>
> class LegalEntityCustomer(LegalEntity, Customer):
> # specific fields
> pass
>
> class Manager(User):
> # specific fields
> pass
>
> Unfortunately now i have a table user that control the generation of the
> dynamic ids to the models ensuring that i will not have a
> LegalEntityCustomer or PersonCustomer refering the same Customer, and as i
> needed a field user to refer to a django user i took the opportunity and
> used the same model User to define this field.
>
> Em quarta-feira, 26 de dezembro de 2012 10h13min20s UTC-2, Marcelo Mendes
> Pereira escreveu:
>>
>> Hi, i am trying to model the database for a project that i am developing
>> i have the following models
>>
>> class CommonInfo(models.Model):
>> #fields
>>  class Meta:
>> abstract = True
>> class Person(CommonInfo):
>> #fields
>> class LegalEntity(CommonInfo):
>> #fields
>> class User(models.Model):
>> user = models.OneToOneField('auth.**user', unique=True)
>>  class Meta:
>> abstract = True
>> class Customer(User):
>> #implicit user referece to a django user 'auth.user'
>>
>> class PersonCustomer(Person, Customer):
>> #implicit user referece to a django user 'auth.user'
>>
>> class LegalEntityCustomer(**LegalEntity, Customer):
>> #implicit user referece to a django user 'auth.user'
>>
>> I created the ModelAdmin to each model and setted a custom form to create
>> a django user every time a customer is created, but the problem i am
>> getting is that when i create a PersonCustomer (the custom form creates a
>> django user as expected) and after that a LegalEntityCustomer (again
>> another django user is created as expected) the PersonCustomer has its user
>> reference changed to the django user created to LegalEntityCustomer,
>> actually if i change the order of creation the same thing happens but this
>> time the LegalEntityCustomer that has it's user reference changed, anybody
>> know what i am doing wrong? Thanks, in advance.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/U_5SkUFAxRIJ.
> 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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

geraldklein.wordpress.com

j...@zognet.com

708-599-0352


Arch Awesome, Ranger & Vim the coding triple threat.

Linux registered user #548580

-- 
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: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Gerald Klein
I can't see from this a clear hierarchy, please describe relationships of
supervisors and managers etc. make hierarchy block diagram to show how
parts relate.

On Wed, Dec 26, 2012 at 11:07 AM, Marcelo Mendes Pereira <
mpmarcel...@gmail.com> wrote:

> I think a i figured out a solution but i don't have a complete
> understanding about the problem to explain exactly what i was doing wrong,
> but here is my schema now
>
> class CommonInfo(models.Model):
> class Meta:
> abstract = True
>
> class User(models.Model):
> user = models.OneToOneField('auth.user')
>
> class Person(User, CommonInfo):
> # specific fields
> pass
>
> class LegalEntity(User, CommonInfo):
> # specific fields
> pass
>
> class Seller(User):
> # specific fields
> pass
>
> class PersonSeller(Person, Seller):
> # specific fields
> pass
>
> class LegalEntitySeller(LegalEntity, Seller):
> # specific fields
> pass
>
> class Supervisor(Seller):
> # specific fields
> supervisees = models.ManyToManyField('Seller', related_name='supervisors')
>
> class Customer(User):
> # specific fields
> pass
>
> class PersonCustomer(Person, Customer):
> # specific fields
> pass
>
> class LegalEntityCustomer(LegalEntity, Customer):
> # specific fields
> pass
>
> class Manager(User):
> # specific fields
> pass
>
> Unfortunately now i have a table user that control the generation of the
> dynamic ids to the models ensuring that i will not have a
> LegalEntityCustomer or PersonCustomer refering the same Customer, and as i
> needed a field user to refer to a django user i took the opportunity and
> used the same model User to define this field.
>
> Em quarta-feira, 26 de dezembro de 2012 10h13min20s UTC-2, Marcelo Mendes
> Pereira escreveu:
>>
>> Hi, i am trying to model the database for a project that i am developing
>> i have the following models
>>
>> class CommonInfo(models.Model):
>> #fields
>>  class Meta:
>> abstract = True
>> class Person(CommonInfo):
>> #fields
>> class LegalEntity(CommonInfo):
>> #fields
>> class User(models.Model):
>> user = models.OneToOneField('auth.**user', unique=True)
>>  class Meta:
>> abstract = True
>> class Customer(User):
>> #implicit user referece to a django user 'auth.user'
>>
>> class PersonCustomer(Person, Customer):
>> #implicit user referece to a django user 'auth.user'
>>
>> class LegalEntityCustomer(**LegalEntity, Customer):
>> #implicit user referece to a django user 'auth.user'
>>
>> I created the ModelAdmin to each model and setted a custom form to create
>> a django user every time a customer is created, but the problem i am
>> getting is that when i create a PersonCustomer (the custom form creates a
>> django user as expected) and after that a LegalEntityCustomer (again
>> another django user is created as expected) the PersonCustomer has its user
>> reference changed to the django user created to LegalEntityCustomer,
>> actually if i change the order of creation the same thing happens but this
>> time the LegalEntityCustomer that has it's user reference changed, anybody
>> know what i am doing wrong? Thanks, in advance.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/U_5SkUFAxRIJ.
> 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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

geraldklein.wordpress.com

j...@zognet.com

708-599-0352


Arch Awesome, Ranger & Vim the coding triple threat.

Linux registered user #548580

-- 
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: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Marcelo Mendes Pereira
I think a i figured out a solution but i don't have a complete 
understanding about the problem to explain exactly what i was doing wrong, 
but here is my schema now

class CommonInfo(models.Model):
class Meta:
abstract = True

class User(models.Model):
user = models.OneToOneField('auth.user')

class Person(User, CommonInfo):
# specific fields
pass

class LegalEntity(User, CommonInfo):
# specific fields
pass

class Seller(User):
# specific fields
pass

class PersonSeller(Person, Seller):
# specific fields
pass

class LegalEntitySeller(LegalEntity, Seller):
# specific fields
pass 

class Supervisor(Seller):
# specific fields
supervisees = models.ManyToManyField('Seller', related_name='supervisors')

class Customer(User):
# specific fields
pass

class PersonCustomer(Person, Customer):
# specific fields
pass

class LegalEntityCustomer(LegalEntity, Customer):
# specific fields
pass

class Manager(User):
# specific fields
pass

Unfortunately now i have a table user that control the generation of the 
dynamic ids to the models ensuring that i will not have a 
LegalEntityCustomer or PersonCustomer refering the same Customer, and as i 
needed a field user to refer to a django user i took the opportunity and 
used the same model User to define this field.

Em quarta-feira, 26 de dezembro de 2012 10h13min20s UTC-2, Marcelo Mendes 
Pereira escreveu:
>
> Hi, i am trying to model the database for a project that i am developing i 
> have the following models
>
> class CommonInfo(models.Model):
> #fields
>  class Meta:
> abstract = True
> class Person(CommonInfo):
> #fields
> class LegalEntity(CommonInfo):
> #fields
> class User(models.Model):
> user = models.OneToOneField('auth.user', unique=True)
>  class Meta:
> abstract = True
> class Customer(User):
> #implicit user referece to a django user 'auth.user'
>
> class PersonCustomer(Person, Customer):
> #implicit user referece to a django user 'auth.user'
>
> class LegalEntityCustomer(LegalEntity, Customer):
> #implicit user referece to a django user 'auth.user'
>
> I created the ModelAdmin to each model and setted a custom form to create 
> a django user every time a customer is created, but the problem i am 
> getting is that when i create a PersonCustomer (the custom form creates a 
> django user as expected) and after that a LegalEntityCustomer (again 
> another django user is created as expected) the PersonCustomer has its user 
> reference changed to the django user created to LegalEntityCustomer, 
> actually if i change the order of creation the same thing happens but this 
> time the LegalEntityCustomer that has it's user reference changed, anybody 
> know what i am doing wrong? Thanks, in advance.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/U_5SkUFAxRIJ.
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: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Marcelo Mendes Pereira
Thanks for the reply. I omitted my entire schema i should had mentioned 
that i have the models Seller, Supervisor (which is a seller and supervises 
other sellers) and Manager and the seller can be a Person and LegalEntity 
too that is why i didn't made Person or LegalEntity inherit from Customer 
because not all Persons or LegalEntities are customers. 

Em quarta-feira, 26 de dezembro de 2012 13h49min39s UTC-2, Gerald Klein 
escreveu:
>
> It seems like you have the same idea recurring twice in this model. This 
> IMHO doesn't require multiple inheritance. I would call commoninfo customer 
> with it's fields and inherit django user then Person and LegalEntity 
> inherit customer (which inherits django user) and add on their specific 
> fields and skip the PersonCustomer and the LegalEntityCustomer. 
>
> Customer would inherit the django userid, and so then would person and 
> legalentity. They could still be identitied with an 'is a' customer' or 'is 
> a' Person or legal entity. 
>
> hope this helps
>
> --jerry
>
> On Wed, Dec 26, 2012 at 7:50 AM, Marcelo Mendes Pereira <
> mpmar...@gmail.com > wrote:
>
>> Customer
>
>
>
>
> -- 
>
>  Gerald Klein DBA
>
> cont...@geraldklein.com 
>
> www.geraldklein.com 
>
> geraldklein.wordpress.com
>
> j...@zognet.com 
>
> 708-599-0352
>
>
> Arch Awesome, Ranger & Vim the coding triple threat.
>
> Linux registered user #548580 
>
>
>  

-- 
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/-/MBIkIAxr09IJ.
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: File/Code Structure

2012-12-26 Thread Jonathan
I think you've got the right idea with regard to structure and
separation of concerns, and my next step would be to write 'recent
polls' as an inclusion tag so that it can be reused on various templates
that aren't necessarily directly concerned with the polls app. This
allows you to maintain the integrity of your 'core' app views while
still utilizing data from neighbouring apps, as you've described.

https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags

Cheers,
Jonathan

On 12/26/2012 07:07 AM, Omar Abou Mrad wrote:
> Greeting friends, 
>
> Let's assume I have a poll app. This 'poll' app uses some generic
> models which have been tossed into a 'core' app (ie: Category).
> Everything concerning the 'poll' app is working fine, but now i'd like
> to create an index page for the entire site. My first intuition was to
> make the view, part of the 'core' app; but then i wanted to show
> 'recent polls' on the index which now requires me to reference the
> poll models. 
>
> My question is, what should I change (or how should i start thinking
> from here on out) to avoid this kind of app cross referencing. 
>
> Thanks!
>
>
>
> -- 
> 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: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Gerald Klein
It seems like you have the same idea recurring twice in this model. This
IMHO doesn't require multiple inheritance. I would call commoninfo customer
with it's fields and inherit django user then Person and LegalEntity
inherit customer (which inherits django user) and add on their specific
fields and skip the PersonCustomer and the LegalEntityCustomer.

Customer would inherit the django userid, and so then would person and
legalentity. They could still be identitied with an 'is a' customer' or 'is
a' Person or legal entity.

hope this helps

--jerry

On Wed, Dec 26, 2012 at 7:50 AM, Marcelo Mendes Pereira <
mpmarcel...@gmail.com> wrote:

> Customer




-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

geraldklein.wordpress.com

j...@zognet.com

708-599-0352


Arch Awesome, Ranger & Vim the coding triple threat.

Linux registered user #548580

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



File/Code Structure

2012-12-26 Thread Omar Abou Mrad
Greeting friends,

Let's assume I have a poll app. This 'poll' app uses some generic models
which have been tossed into a 'core' app (ie: Category). Everything
concerning the 'poll' app is working fine, but now i'd like to create an
index page for the entire site. My first intuition was to make the view,
part of the 'core' app; but then i wanted to show 'recent polls' on
the index which now requires me to reference the poll models.

My question is, what should I change (or how should i start thinking from
here on out) to avoid this kind of app cross referencing.

Thanks!

-- 
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 do I create timestamp type columns in (mySQL) database?

2012-12-26 Thread Subodh Nijsure
I am working with situation where I would like to maintain timestamp (in
UTC) of when a record is created or updated.

mySQL offers such facility if one declares column of type 'timestamp' with
attributes - default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'

However I haven't found way to declare a column time as timestamp in django
(1.4).

I have come across postings - http://ianrolfe.livejournal.com/36017.html

that tries to define field as timestamp, but it doesn't seem to work.

Is there way to declare column of type  'timestamp' in django and not
datetime and assign some properties to the column.

 As a hack I can always execute alter table command, but I am not sure what
effect that will have if I want to use admin interface to edit those tables.

Would appreciate any help/pointer on how one can go about handling UTC
timestamp columns in database.

Thanks.

-Subodh

-- 
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 1.4 Development Workflow Using Static Files

2012-12-26 Thread Bill Freeman
On Wed, Dec 26, 2012 at 6:06 AM, huw_at1  wrote:

> Thanks for the reply. I realised a few moments ago that I can use a
> relative STATIC_URL rather than an absolute one so now I just have
> '/static/' set as the value which works well.
>
> Many thanks
>
> RESOLVED
>
>
> On Wednesday, 26 December 2012 00:53:42 UTC, אברהם סרור wrote:
>
>> Maybe you can just upload the files directly to the collect static folder
>> on the server
>>
>> In any case maybe you want them under version control, so I guess you
>> could just automate all these steps with fabric
>> On Dec 26, 2012 1:00 AM, "huw_at1"  wrote:
>>
>>> Hi again,
>>>
>>> Another quick question. I'm still getting used to 1.4 and I've been
>>> setting up a remote static file service for the production deployment of my
>>> web app. This works just great however it seems a little cumbersome when
>>> developing if I want to add fresh image content I have to add it to the
>>> project locally, commit and push the changes, deploy to production and
>>> collect the static files there before the image is available to the
>>> development server...This seems like a very round about way of developing -
>>> I must be missing something here although I do not know what? Should I
>>> modify the setting.py to change the STATIC_URL value dependent on whether
>>> the server is production or development or is there any smarter way?
>>>
>>> As ever any advice is much appreciated.
>>>
>>> Huw_at1
>>>
>>>
>>> You can also use the trick:

try:
from local_settings import *
except:
pass

To have a different value in STATIC_URL for your testing environment.
(Obviously, you keep local_settings.py out of revision control.)

Bill

-- 
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 1.4 manage.py cannot find settings

2012-12-26 Thread Bill Freeman
On Tue, Dec 25, 2012 at 8:22 AM, huw_at1  wrote:

> Hi,
>
> This has probably been asked a million times before so apologies. I'm new
> to 1.4 so the standard project layout is a little unfamiliar. I'm trying to
> perform a simple import from within my shell:
>
> from django.contrib.sites.models import Site
>
> However I am constantly getting the problem that my settings are not being
> found:
>
> raise ImportError("Could not import settings '%s' (Is it on
> sys.path?): %s" % (self.SETTINGS_MODULE, e))
> ImportError: Could not import settings 'test.test.settings' (Is it on
> sys.path?): No module named test.settings
>
> In the past I would have thought that this was an issue as the project and
> the "app" had the same name although in the case of 1.4 the settings are
> placed in a directory with the same name as the project. I'm not sure what
> I should change to get this to work.
>
> Has this been seen before or any ideas?
>
> Many thanks
>
>
> The only shell from which you can perform this import is the one you reach
via:

python manage.py shell

If you just start python, such imports will not work.

Note, too, that the directory containing manage.py should be the current
directory at the time that python is started (as opposed to adding that
directory to sys.path.

You can do a lot of typing and get a bare python into a state from which it
can import Site, but it would be far more productive to teach your IDE to
start a shell as above for those times when you want to play like this.

Bill

-- 
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: Code guidance please review.

2012-12-26 Thread Bill Freeman
On Tue, Dec 25, 2012 at 1:33 PM, Glyn Jackson  wrote:

> Hi,
>
> I'm new to Django and just need some guidance.
>
> Below is my attempt at creating a simple app that displays all
> transactions and lists the grand total called 'points' for a particular
> user. Now the following works and does just that, however, I'm not 100% if
> this is the 'correct' way nor really what a 'manager' is.
>
> Could someone look at the following code and advice?
>
> Many, many thanks O, and Happy Christmas everyone!
>
>
> models.py
>
> from django.db import models
> from django.contrib.auth.models import User
>
>
>
>
> class TransactionManager(models.Manager):
>
> def Transaction_list(self,thisUser):
> list = Transaction.objects.filter(user=thisUser)
> return list
>
> def points_total(self,thisUser):
> return
> Transaction.objects.filter(user=thisUser).aggregate(total_points=models.Sum('points'))
>
>
>
> class Transaction (models.Model):
>
> statusOptions = (
> (0, 'Pending'),
> (1, 'Added'),
> (2, 'Deducted'),
> (3, 'Processing'),
> )
>
> user = models.ForeignKey(User)
> points = models.IntegerField(verbose_name=("Points"), default=0)
> created = models.DateTimeField(("Created at"), auto_now_add=True)
> updated = models.DateTimeField(verbose_name=("Updated at"),
> auto_now=True)
> status = models.IntegerField(default=0, choices=statusOptions)
>
> objects = TransactionManager()
>
>
> views.py
>
> from django.template import RequestContext
> from django.contrib.auth.decorators import login_required
> from django.shortcuts import render_to_response
> from points.models import Transaction
>
> @login_required
> def history(request):
>
> thisPoints = Transaction.objects.Transaction_list(request.user)
> totalPoints = Transaction.objects.points_total(request.user)
> context = {'points':thisPoints,'totalPoints':totalPoints}
> return render_to_response('points/history.html', context,
> context_instance=RequestContext(request))
>
> This is certainly reasonable over all.

I would point out, however, that manager instance, "self" in your
Transaction_list and points_total methods, *is* Transaction.object, so
(assuming that you keep them as manager methods), you could just use
"self.filter...".  Further, in the interests of not having duplicate code
to maintain, you could implement points_total using
"self.Transaction_list(thisUser).aggregate...".  A style point, while it is
customary to use an initial upper case letter on model and manager (and
other class) names, method names, especially those using underscores as
word separators, are usually all lower case.  But, too, since it is part of
a TransactionManager, it is a bit redundant to name the method
Transaction_list.  You could call it just "list", but perhaps "for_user" is
clearer, allowing you to say (in the view)
"Transaction.objects.for_user(request.user)", which is nearly the simple
English for what you are doing.

It is possible, but not conventional, to create these methods as
classmethods on the Transaction class, rather than requiring the
implementation of a custom manager class, e.g.:

@classmethod
def for_user(cls, thisUser):
return cls.objects.filter(user=thisUser)

You would use this in the view like so:

thisPoints = Transaction.for_user(request.user)

There is a mild preference for the manager approach, since it doesn't
pollute the model name space.  A model already has an "objects" attribute,
so accessing the manager doesn't require a new attribute.  Using the
classmethod means that there is one more attribute on a model instance,
which should largely be about the instance (table row), rather than about
accessing instances.  Not, however, a big deal.

But both of these methods are so simple that hand coding them in the view
has appeal.  It makes the code local, rather than forcing the reader to
find the manager code to know for sure what's happening.  If the function
were more complex, or if it is used in more than one place, then the
separate manager methods are to be preferred.

And note that you can use a queryset multiple times without having to
recreate it.

@login_required
def history(request):
thisPoints = Transaction.objects.filter(user=request.user)
totalPoints =
thisPoints.aggregate(total_points=models.Sum('points'))
...

The use of "thisPoints" in calculating "totalPoints" doesn't change
"thisPoints".  You can still enumerate it in the template, and get the same
result.

Bill

-- 
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: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Marcelo Mendes Pereira
The problem seems to happen because of both PersonCustomer and 
LegalEntityCustomer inheriting from Customer, and their primary key being a 
foreign key to Customer primary key, when as LegalEntityCustomer is created 
its primary key is set to 1 the same of PersonCustomer and that way both 
references the first Customer created, the desired behavior should be 
create a customer to each PersonCustomer or LegalEntityCustomer, anybody 
know how to correct this problem? in the model schema definition?

Em quarta-feira, 26 de dezembro de 2012 10h13min20s UTC-2, Marcelo Mendes 
Pereira escreveu:
>
> Hi, i am trying to model the database for a project that i am developing i 
> have the following models
>
> class CommonInfo(models.Model):
> #fields
>  class Meta:
> abstract = True
> class Person(CommonInfo):
> #fields
> class LegalEntity(CommonInfo):
> #fields
> class User(models.Model):
> user = models.OneToOneField('auth.user', unique=True)
>  class Meta:
> abstract = True
> class Customer(User):
> #implicit user referece to a django user 'auth.user'
>
> class PersonCustomer(Person, Customer):
> #implicit user referece to a django user 'auth.user'
>
> class LegalEntityCustomer(LegalEntity, Customer):
> #implicit user referece to a django user 'auth.user'
>
> I created the ModelAdmin to each model and setted a custom form to create 
> a django user every time a customer is created, but the problem i am 
> getting is that when i create a PersonCustomer (the custom form creates a 
> django user as expected) and after that a LegalEntityCustomer (again 
> another django user is created as expected) the PersonCustomer has its user 
> reference changed to the django user created to LegalEntityCustomer, 
> actually if i change the order of creation the same thing happens but this 
> time the LegalEntityCustomer that has it's user reference changed, anybody 
> know what i am doing wrong? Thanks, in advance.
>

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



Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Marcelo Mendes Pereira
Hi, i am trying to model the database for a project that i am developing i 
have the following models

class CommonInfo(models.Model):
#fields
 class Meta:
abstract = True
class Person(CommonInfo):
#fields
class LegalEntity(CommonInfo):
#fields
class User(models.Model):
user = models.OneToOneField('auth.user', unique=True)
 class Meta:
abstract = True
class Customer(User):
#implicit user referece to a django user 'auth.user'

class PersonCustomer(Person, Customer):
#implicit user referece to a django user 'auth.user'

class LegalEntityCustomer(LegalEntity, Customer):
#implicit user referece to a django user 'auth.user'

I created the ModelAdmin to each model and setted a custom form to create a 
django user every time a customer is created, but the problem i am getting 
is that when i create a PersonCustomer (the custom form creates a django 
user as expected) and after that a LegalEntityCustomer (again another 
django user is created as expected) the PersonCustomer has its user 
reference changed to the django user created to LegalEntityCustomer, 
actually if i change the order of creation the same thing happens but this 
time the LegalEntityCustomer that has it's user reference changed, anybody 
know what i am doing wrong? Thanks, in advance.

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



Mezzanine 1.3 and Cartridge 0.7 released

2012-12-26 Thread Stephen McDonald
Hi all,

I'm really pleased to announce the releases of Mezzanine 1.3 and Cartridge
0.7. Mezzanine is a BSD licensed CMS framework for Django, and Cartridge is
its companion project that provides e-commerce support for Mezzanine. It's
been almost 5 months since 1.2 and 0.6 were released, which is one of the
longest stretches between releases in their history. These releases are
also one of the largest in terms of number of changes, but one of the
smallest in terms of new features. This represents a really interesting
stage, showing good signs of both feature completeness and polish.

Here's an overview of what's new:

Project:

- Full support for Django 1.5
- Improved support for Lettuce test runner
- Improved support for django-compressor
- Updated to latest client libraries (jQuery/jQuery UI/Boostrap)
- All previous versions now tagged in GitHub/Bitbucket
- Separation of mandatory and optional fixtures during installation
- Configurable upload_to handlers per file fields
- Configurable spam filters (previously akismet only)
- Configurable "search in" options in public search form
- Support for custom markup formats in content description generation
- Support for custom markup formats in comment rendering
- Multi-tenancy now supports is_staff across Django Admin and live-editing
- Multi-tenancy support in sitemaps
- Support for excluding pages/content from sitemaps

Deployment:

- JVM/Jython compatibility
- Improved automated deploys: locale and ssl config fixes

Pages:

- Improved drag/drop support for reordering the page tree

Forms:

- New DOB field type in the forms builder app
- Support for custom field types in the forms builder app

Blogs:

- More granular template blocks throughout the blog app
- Recent posts template tag in blog app supports tag/category filtering
- Next/previous blog post in blog detail view- Ownable model filtering in
Django Admin now configurable

Shop (Cartridge):

- New payment handler for Stripe
- Better support for currency locale on Windows

That's it! As usual the number of contributors and deployed sites has grown
rapidly. A big thanks to everyone who has contributed features and fixes,
provided community support, and for sharing the awesome sites they've built
using Mezzanine and Cartridge.

Check out the following URLs for more info:

Project homepage: http://mezzanine.jupo.org
Sites gallery: http://mezzanine.jupo.org/sites/
Mailing list: https://groups.google.com/group/mezzanine-users
IRC: #mezzanine on irc.freenode.net
Mezzanine docs: http://mezzanine.jupo.org/docs/
Mezzanine source: https://github.com/stephenmcd/mezzanine
Cartridge docs: http://cartridge.jupo.org
Cartridge source: https://github.com/stephenmcd/cartridge

Cheers,
Steve

-- 
Stephen McDonald
http://jupo.org

-- 
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 1.4 Development Workflow Using Static Files

2012-12-26 Thread huw_at1
Thanks for the reply. I realised a few moments ago that I can use a 
relative STATIC_URL rather than an absolute one so now I just have 
'/static/' set as the value which works well.

Many thanks

RESOLVED

On Wednesday, 26 December 2012 00:53:42 UTC, אברהם סרור wrote:
>
> Maybe you can just upload the files directly to the collect static folder 
> on the server
>
> In any case maybe you want them under version control, so I guess you 
> could just automate all these steps with fabric
> On Dec 26, 2012 1:00 AM, "huw_at1"  
> wrote:
>
>> Hi again,
>>
>> Another quick question. I'm still getting used to 1.4 and I've been 
>> setting up a remote static file service for the production deployment of my 
>> web app. This works just great however it seems a little cumbersome when 
>> developing if I want to add fresh image content I have to add it to the 
>> project locally, commit and push the changes, deploy to production and 
>> collect the static files there before the image is available to the 
>> development server...This seems like a very round about way of developing - 
>> I must be missing something here although I do not know what? Should I 
>> modify the setting.py to change the STATIC_URL value dependent on whether 
>> the server is production or development or is there any smarter way?
>>
>> As ever any advice is much appreciated.
>>
>> Huw_at1
>>
>> -- 
>> 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/-/SL1HBsWfETwJ.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>

-- 
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/-/BpNp4qTuVbgJ.
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-allauth: ImproperlyConfigured at /accounts/login/ No Facebook app configured: please add a SocialApp using the Django admin

2012-12-26 Thread Manu
Hi Gabriel, 

Thanks for replying. However, the issue, I think, came up because of the 
incorrect SITE_ID value in my settings.py. 
You can see the conversation at this stackoverflow thread. 
http://stackoverflow.com/questions/14019017/django-allauth-no-facebook-app-configured-please-add-a-socialapp-using-the-djan
 


It's solved for now. :-)
Regards,
Manu

On Tuesday, 25 December 2012 20:16:27 UTC+5:30, Gabriel - Iulian Dumbrava 
wrote:
>
> Hi Manu,
> Enter the admin and at allauth -> apps add a new application of type 
> "Facebook" with your FB credentials. 
>
> You have added a facebook login in settings.py but such a login type is 
> not yet defined in admin. 
>
> I hope this helps!
> Gabriel
>
>

-- 
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/-/NQC82_En1v8J.
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: Append [RESOLVED] to your post subject if you got to a working solution

2012-12-26 Thread Avraham Serour
so maybe we should file a bug report to gmail on this


On Wed, Dec 26, 2012 at 10:01 AM, Axel Rau  wrote:

>
> Am 25.12.2012 um 09:51 schrieb Avraham Serour:
>
> > I oppose adding [RESOLVED] to the subject, this means changing the
> subject
> > to a complete different string and detaching it from the thread.
> MUAs like Apple Mail or Thunderbird use "references" header (if present)
> instead of "subject" for threading.
>
> Axel
> ---
> PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To 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: Append [RESOLVED] to your post subject if you got to a working solution

2012-12-26 Thread Axel Rau

Am 25.12.2012 um 09:51 schrieb Avraham Serour:

> I oppose adding [RESOLVED] to the subject, this means changing the subject
> to a complete different string and detaching it from the thread.
MUAs like Apple Mail or Thunderbird use "references" header (if present) 
instead of "subject" for threading.

Axel
---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius

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