Re: django.db.utils.OperationalError: server closed the connection unexpectedly

2017-06-01 Thread Bobby Paul
Thank you Antonis,
Yeah, We have installed postgresql-8.4.20-7.el6.x86_64

Now we are checking the permission. Will touch you once it done.

Thanks,

Bobby Paul
On Wednesday, May 31, 2017 at 5:14:29 PM UTC+5:30, Bobby Paul wrote:
>
> Dear All,
>
> I am getting this error message while trying to install psql database.
>
>  File "setup.py", line 18, in 
> execute_from_command_line(['manage.py','migrate'])
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 354, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 346, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
> line 394, in run_from_argv
> self.execute(*args, **cmd_options)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
> line 445, in execute
> output = self.handle(*args, **options)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
>  
> line 93, in handle
> executor = MigrationExecutor(connection, 
> self.migration_progress_callback)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/executor.py",
>  
> line 19, in __init__
> self.loader = MigrationLoader(self.connection)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
> line 47, in __init__
> self.build_graph()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
> line 191, in build_graph
> self.applied_migrations = recorder.applied_migrations()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py",
>  
> line 59, in applied_migrations
> self.ensure_schema()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py",
>  
> line 49, in ensure_schema
> if self.Migration._meta.db_table in 
> self.connection.introspection.table_names(self.connection.cursor()):
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 162, in cursor
> cursor = self.make_debug_cursor(self._cursor())
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 135, in _cursor
> self.ensure_connection()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 130, in ensure_connection
> self.connect()
>   File "/usr/local/bin/lib/python2.7/site-packages/django/db/utils.py", 
> line 98, in __exit__
> six.reraise(dj_exc_type, dj_exc_value, traceback)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 130, in ensure_connection
> self.connect()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 119, in connect
> self.connection = self.get_new_connection(conn_params)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
>  
> line 176, in get_new_connection
> connection = Database.connect(**conn_params)
>   File "/usr/local/bin/lib/python2.7/site-packages/psycopg2/__init__.py", 
> line 130, in connect
> conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
> django.db.utils.OperationalError: server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> ==
> DATABASES_DEFAULT = {
>
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'NAME': 'litdb',
> 'USER': 'root',
> 'PASSWORD': '',
> 'HOST': 'localhost',
> 'PORT': '80',
> }
>
> How to sort this issue?
>
> Kind Regards
> Bobby Paul
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92514ce1-503c-4904-8da7-857dd70e10cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.db.utils.OperationalError: server closed the connection unexpectedly

2017-05-31 Thread Bobby Paul
Dear Antonis,

Thank you very much for your quick response.
Sorry, I am newer in this field. I was trying to install LitDB 
(http://www.ikmb.uni-kiel.de/litdb)
I changed the settings as what your suggestion, but not happened.

with port number 5432, it showing
 Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

Is there any other settings i need to change?
Thanks and Regards
Bobby Paul


On Wednesday, May 31, 2017 at 5:14:29 PM UTC+5:30, Bobby Paul wrote:
>
> Dear All,
>
> I am getting this error message while trying to install psql database.
>
>  File "setup.py", line 18, in 
> execute_from_command_line(['manage.py','migrate'])
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 354, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 346, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
> line 394, in run_from_argv
> self.execute(*args, **cmd_options)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
> line 445, in execute
> output = self.handle(*args, **options)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
>  
> line 93, in handle
> executor = MigrationExecutor(connection, 
> self.migration_progress_callback)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/executor.py",
>  
> line 19, in __init__
> self.loader = MigrationLoader(self.connection)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
> line 47, in __init__
> self.build_graph()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
> line 191, in build_graph
> self.applied_migrations = recorder.applied_migrations()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py",
>  
> line 59, in applied_migrations
> self.ensure_schema()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py",
>  
> line 49, in ensure_schema
> if self.Migration._meta.db_table in 
> self.connection.introspection.table_names(self.connection.cursor()):
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 162, in cursor
> cursor = self.make_debug_cursor(self._cursor())
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 135, in _cursor
> self.ensure_connection()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 130, in ensure_connection
> self.connect()
>   File "/usr/local/bin/lib/python2.7/site-packages/django/db/utils.py", 
> line 98, in __exit__
> six.reraise(dj_exc_type, dj_exc_value, traceback)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 130, in ensure_connection
> self.connect()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 119, in connect
> self.connection = self.get_new_connection(conn_params)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
>  
> line 176, in get_new_connection
> connection = Database.connect(**conn_params)
>   File "/usr/local/bin/lib/python2.7/site-packages/psycopg2/__init__.py", 
> line 130, in connect
> conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
> django.db.utils.OperationalError: server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> ==
> DATABASES_DEFAULT = {
>
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'NAME': 'litdb',
> 'USER': 'root',
> 'PASSWORD': '',
> 'HOST': 'localhost',
> 'PORT': '80',
> }
>
> How to sort this issue?
>
> Kind Regards
> Bobby Paul
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c367c3b4-502b-49ec-94e3-10a0433ccb99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django.db.utils.OperationalError: server closed the connection unexpectedly

2017-05-31 Thread Bobby Paul
Dear All,

I am getting this error message while trying to install psql database.

 File "setup.py", line 18, in 
execute_from_command_line(['manage.py','migrate'])
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 354, in execute_from_command_line
utility.execute()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
line 394, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
line 445, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
 
line 93, in handle
executor = MigrationExecutor(connection, 
self.migration_progress_callback)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/executor.py", 
line 19, in __init__
self.loader = MigrationLoader(self.connection)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
line 47, in __init__
self.build_graph()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
line 191, in build_graph
self.applied_migrations = recorder.applied_migrations()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py", 
line 59, in applied_migrations
self.ensure_schema()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py", 
line 49, in ensure_schema
if self.Migration._meta.db_table in 
self.connection.introspection.table_names(self.connection.cursor()):
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 162, in cursor
cursor = self.make_debug_cursor(self._cursor())
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 135, in _cursor
self.ensure_connection()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 130, in ensure_connection
self.connect()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/utils.py", 
line 98, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 130, in ensure_connection
self.connect()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 119, in connect
self.connection = self.get_new_connection(conn_params)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
 
line 176, in get_new_connection
connection = Database.connect(**conn_params)
  File "/usr/local/bin/lib/python2.7/site-packages/psycopg2/__init__.py", 
line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
==
DATABASES_DEFAULT = {

'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'litdb',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '80',
}

How to sort this issue?

Kind Regards
Bobby Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b07acc86-a2a9-4fe7-9004-0f7a90fe4100%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: User model not using persistent DB connection?

2016-12-29 Thread Bobby Mozumder
I’m actually already setting CONN_MAX_AGE to None on a connection pool.  The 
rest of the queries in the view are using the persistent connection pools.

It’s only this specific request.user object that keeps creating a new 
connection instead of using the persistent connection for some reason.

-bobby

> On Dec 29, 2016, at 4:16 PM, James Bennett <ubernost...@gmail.com> wrote:
> 
> See the documentation for details:
> 
> https://docs.djangoproject.com/en/1.10/ref/settings/#conn-max-age 
> <https://docs.djangoproject.com/en/1.10/ref/settings/#conn-max-age>
> 
> Also, generally speaking maintaining a connection pool has been seen as out 
> of scope for Django itself, and most people use a standalone connection 
> pooler (such as pgpool for Postgres).
> 
> On Thu, Dec 29, 2016 at 1:13 PM, Bobby Mozumder <bmozum...@gmail.com 
> <mailto:bmozum...@gmail.com>> wrote:
> Hi,
> 
> It seems Django doesn’t use a persistent DB connection whenever I use the 
> Request.User object.
> 
> I always get a signal saying a new DB connection occurs when I call the 
> object.
> 
> For example:
> 
> class MyView(DetailView):
> def get(self, request, slug):
> print(request.user) # <--- Boom, new database connection signal is 
> sent here.
> # continue processing view
>   pass
> 
> Is that by design?  Or is it an error?  
> 
> I’d like it to use the same persistent DB connection across all requests. 
> 
> I’m looking through the Django source (auth & sessions backend) and can’t 
> find where the DB connection is happening.  I haven’t touched the User models 
> at all, although I do have a DB connection receiver that runs prepared 
> statements when the app starts - it’s where I found this. 
> 
> Any info on this is appreciated, & happy Holidays!
> 
> -bobby
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/A56E8EB4-EE0A-477F-B8DD-F39AA43F71EB%40gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/A56E8EB4-EE0A-477F-B8DD-F39AA43F71EB%40gmail.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAL13Cg8FmJRC%2Br9VoKoa3R4o_wURMc6kJGQGUB_WG5NJgcZEQg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CAL13Cg8FmJRC%2Br9VoKoa3R4o_wURMc6kJGQGUB_WG5NJgcZEQg%40mail.gmail.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5CB94F19-DA9A-4898-856F-DEEABA725CF4%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


User model not using persistent DB connection?

2016-12-29 Thread Bobby Mozumder
Hi,

It seems Django doesn’t use a persistent DB connection whenever I use the 
Request.User object.

I always get a signal saying a new DB connection occurs when I call the object.

For example:

class MyView(DetailView):
def get(self, request, slug):
print(request.user) # <--- Boom, new database connection signal is sent 
here.
# continue processing view
pass

Is that by design?  Or is it an error?  

I’d like it to use the same persistent DB connection across all requests. 

I’m looking through the Django source (auth & sessions backend) and can’t find 
where the DB connection is happening.  I haven’t touched the User models at 
all, although I do have a DB connection receiver that runs prepared statements 
when the app starts - it’s where I found this.  

Any info on this is appreciated, & happy Holidays!

-bobby

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/A56E8EB4-EE0A-477F-B8DD-F39AA43F71EB%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTTP2 Server Push with Django?

2016-06-28 Thread Bobby Mozumder
No these are for push at the app layer, for functionality purposes.

HTTP/2 server push is meant for speeding up website responsiveness, by 
delivering static assets before the request for them are even made.

-bobby

> On Jun 28, 2016, at 12:34 PM, Mario R. Osorio <nimbiot...@gmail.com> wrote:
> 
> Here are some resources:
> Django Push HTTP Response to users 
> <http://stackoverflow.com/questions/5479741/django-push-http-response-to-users>
> Django Packages <https://www.djangopackages.com/grids/g/real-time/>
> django-push-notifications 
> <https://github.com/jleclanche/django-push-notifications>
> Django-PuSH <https://django-push.readthedocs.io/en/latest/>
> django-pushserver <https://github.com/mitar/django-pushserver>
> SwampDragon <https://github.com/jonashagstedt/swampdragon>
> On Tuesday, June 28, 2016 at 8:46:26 AM UTC-4, Bobby Mozumder wrote:
> Does anyone know of an http/2 server with server push capability that can 
> work with Django? 
>  
> It looks like nginx supports http2 with uWSGI, but it doesn’t actually 
> support server push capability.
>  
> I also found the h2o server, but it doesn’t look like it supports uWSGI yet..
>  
> Any other options out there for http2 server push, preferably with 
> cache-aware server push?
>  
> (I’d set http “Link” headers in my app to direct server push.)
>  
> -bobby
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/0aaaeb31-dcd7-430c-973a-fa1a0c6331ee%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/0aaaeb31-dcd7-430c-973a-fa1a0c6331ee%40googlegroups.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CB2E870B-4C9E-45F8-9132-B59CA5054922%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTTP2 Server Push with Django?

2016-06-28 Thread Bobby Mozumder
The h2o server (https://h2o.examp1e.net) looks like it supports http/2 push, 
but it doesn’t have WSGI capability for Django.

-bobby

> On Jun 28, 2016, at 9:09 AM, Fabio C. Barrionuevo da Luz <bna...@gmail.com> 
> wrote:
> 
> as far as I know, there is still no any web server that fully implements the 
> "push" capability from HTTP2 specification.
> 
> let me know if any web server now implements "push" capability completely
> 
> On Tue, Jun 28, 2016 at 9:46 AM, Bobby Mozumder <bmozum...@gmail.com 
> <mailto:bmozum...@gmail.com>> wrote:
> Does anyone know of an http/2 server with server push capability that can 
> work with Django?
> 
> It looks like nginx supports http2 with uWSGI, but it doesn’t actually 
> support server push capability.
> 
> I also found the h2o server, but it doesn’t look like it supports uWSGI yet..
> 
> Any other options out there for http2 server push, preferably with 
> cache-aware server push?
> 
> (I’d set http “Link” headers in my app to direct server push.)
> 
> -bobby
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users%2bunsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5A078BDA-0C9C-48E3-B7DC-56CA49434388%40gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/5A078BDA-0C9C-48E3-B7DC-56CA49434388%40gmail.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> 
> 
> -- 
> Fábio C. Barrionuevo da Luz
> Palmas - Tocantins - Brasil - América do Sul
> 
> http://pythonclub.com.br/ <http://pythonclub.com.br/>
> 
> Blog colaborativo sobre Python e tecnologias Relacionadas, mantido totalmente 
> no https://github.com/pythonclub/pythonclub.github.io 
> <https://github.com/pythonclub/pythonclub.github.io> .
> 
> Todos são livres para publicar. É só fazer fork, escrever sua postagem e 
> mandar o pull-request. Leia mais sobre como publicar em README.md e 
> contributing.md <http://contributing.md/>.
> Regra básica de postagem:
> "Você" acha interessante? É útil para "você"? Pode ser utilizado com Python 
> ou é útil para quem usa Python? Está esperando o que? Publica logo, que estou 
> louco para ler...
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAPVjvMYqcOq3cUR5UroSkJu%2BQBvOGG9uwBok9OvOpKz%2B%2BZDDMg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CAPVjvMYqcOq3cUR5UroSkJu%2BQBvOGG9uwBok9OvOpKz%2B%2BZDDMg%40mail.gmail.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/985EF5F5-DC05-488F-A867-7E7933D9AA32%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


HTTP2 Server Push with Django?

2016-06-28 Thread Bobby Mozumder
Does anyone know of an http/2 server with server push capability that can work 
with Django?

It looks like nginx supports http2 with uWSGI, but it doesn’t actually support 
server push capability.

I also found the h2o server, but it doesn’t look like it supports uWSGI yet..

Any other options out there for http2 server push, preferably with cache-aware 
server push?

(I’d set http “Link” headers in my app to direct server push.)

-bobby

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5A078BDA-0C9C-48E3-B7DC-56CA49434388%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there a hook to run an SQL Query at every Postgres session start?

2016-02-03 Thread Bobby Mozumder
Thanks Simon this works great so far =^)

-bobby

> On Feb 3, 2016, at 12:34 PM, Simon Charette <charett...@gmail.com> wrote:
> 
> Hi Bobby,
> 
> I'm not sure this is what you are looking for but it looks like 
> `connection_created`[1] signal might do.
> 
> Cheers,
> Simon
> 
> [1] https://docs.djangoproject.com/en/1.9/ref/signals/#connection-created
> 
> Le mercredi 3 février 2016 12:25:36 UTC-5, Bobby Mozumder a écrit :
> I'm looking to use PREPARE/EXECUTE statements, to eliminate my Query Planning 
> time from every Web request.
> 
> This can be done via SQL PREPARE/EXECUTE statements.
> 
> But, Postgres only supports PREPARE statements on a connection 
> session-by-session basis.  
> 
> To do this with Django, I need to be able to run an SQL Query that runs the 
> PREPARE statement for every connection to the Database. I only need to do 
> this once per DB connection, as I have enabled Persistent connections.  
> 
> The code to run, if I put it into the App.view, would be something like this:
> 
> class PreparedView(View):
> def prepare_db():
> cursor = connection.cursor()
> cursor.execute(“”"
> PREPARE prepared_query (int, text, etc) AS
>   SELECT … some query … 
> “”"
> return cursor.close()
> 
> I’m looking through the Django code to see where I can run some sort of 
> Query.  Maybe I can subclass 
> django.db.backends.postgresql.base.DatabaseWrapper.init_db_connection_state()?
> 
> Also, where can I hook that into my app?  If I subclass that, I’m not sure if 
> I can/should put that in the Model, View, or URL of modules of my app, so 
> that it’s called?  Do I create an entirely new version of 
> django.db.backends.postgresql?
> 
> Ideally this would work with both the basic built-in development server 
> connecting to a local host Postgres, as well as in a uWSGI environment with 
> possible pgBouncer in the stack somewhere.
> 
> Thanks!
> 
> -bobby
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/06a0a777-9823-4112-9683-131e277d0c2b%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/06a0a777-9823-4112-9683-131e277d0c2b%40googlegroups.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/B3B59F19-C447-41B9-B839-D645FB9F07E4%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Is there a hook to run an SQL Query at every Postgres session start?

2016-02-03 Thread Bobby Mozumder
I'm looking to use PREPARE/EXECUTE statements, to eliminate my Query Planning 
time from every Web request.

This can be done via SQL PREPARE/EXECUTE statements.

But, Postgres only supports PREPARE statements on a connection 
session-by-session basis.  

To do this with Django, I need to be able to run an SQL Query that runs the 
PREPARE statement for every connection to the Database. I only need to do this 
once per DB connection, as I have enabled Persistent connections.  

The code to run, if I put it into the App.view, would be something like this:

class PreparedView(View):
def prepare_db():
cursor = connection.cursor()
cursor.execute(“”"
PREPARE prepared_query (int, text, etc) AS
  SELECT … some query … 
“”"
return cursor.close()

I’m looking through the Django code to see where I can run some sort of Query.  
Maybe I can subclass 
django.db.backends.postgresql.base.DatabaseWrapper.init_db_connection_state()?

Also, where can I hook that into my app?  If I subclass that, I’m not sure if I 
can/should put that in the Model, View, or URL of modules of my app, so that 
it’s called?  Do I create an entirely new version of 
django.db.backends.postgresql?

Ideally this would work with both the basic built-in development server 
connecting to a local host Postgres, as well as in a uWSGI environment with 
possible pgBouncer in the stack somewhere.

Thanks!

-bobby

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/E91526A2-C5C1-449F-8DC9-0A56CDB74738%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding context data to a TemplateView?

2015-07-22 Thread bobby
An additional point, if you want to be able to use the view more 
generically (be able to pass in custom context from your urls.py), I've 
done the following:

class StaticPageView(TemplateView):
context = None

def get_context_data(self, **kwargs):
context = super(StaticPageView, self).get_context_data(**kwargs)
context.update(self.context or {})
return context

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cc05af47-b6ae-4050-bbd9-6a8958db502e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django TCP socket communication

2015-03-27 Thread Bobby
I am new to TCP socket programming. I have a django based server 
communicating with a microcontroller. Now, I want to implement TCP based 
socket on the server side in order to communicate with the TCP socket on 
the microcontroller. Can anyone give me an idea on how to do this ? What 
libraries should I use on my django server The microprocessor basically 
opens the socket every 5 seconds and sends a notification to the server. I 
on the server side should be able to read this and pump data back to the 
microprocessor using this socket which was opened by the microprocessor.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5ea5bf85-0163-40cf-a4da-ec9edb27f3ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


HTML6 proposal for single-page apps without Javascript

2015-03-20 Thread Bobby Mozumder
Hi everbody,

I submitted a proposal to the W3C for browsers to implement a 
model-view-controller design pattern so that we don’t need to build them using 
Javascript frameworks for our sites.

The message is here:
https://lists.w3.org/Archives/Public/public-whatwg-archive/2015Mar/0071.html 
<https://lists.w3.org/Archives/Public/public-whatwg-archive/2015Mar/0071.html>

This should fit right in with Django on the server side.  Meanwhile, packages 
like Node.js are starting to implementthe back-end framework, because they 
already have the MVC framework in place on the front-end.

As a Python/Django coder, I’m pretty sure nobody here wants to write 
Javascript, so please provide feedback to that mailing list for this proposal.  

Thank you,

-bobby

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/62B49FE4-4D54-4928-8409-8CBD6DF0114F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Recommendations for hosting service?

2015-01-06 Thread Bobby Mozumder
Anyone have recommendations for hosting services that can do Django, Node.js, 
Postgreqsl, python3, as well as PHP/MySQL for legacy stuff?  I’m also looking 
to have IMAP email.  This would be for several domains, with maybe 100GB of 
data.

-bobby

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/28330C48-FA41-4A84-9591-2A2DBB1872D3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: Django website redesign launched

2014-12-17 Thread Bobby Mozumder
For the Documentation, one suggestion I have is that the body font that’s more 
different from the source code font.

It looks like you’re using Roboto (a Helvetica clone) for the body text and 
Incosolota for the source code. They’re a little too similar.  Also, Roboto 
isn’t a good font for descriptive sentences and paragraphs.  It’s more of a 
short text font for titles, subheadline, and captions.

You generally don’t write long paragraphs with Helvetica, and you shouldn’t do 
that in Roboto either.

-bobby

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DE43C262-BD64-4140-B82A-A046308F2EE2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django image upload not saving

2014-06-26 Thread Bobby Gulshan
No errors when hitting upload. But the image doesn't appear where I have 
indicated it ought to. Put an absolute path in MEDIA_ROOT and referenced 
the same in (upload_to) param ImageField. Not sure what I am missing. 

Model:

class FileUploadHandler(models.Model):
title = models.CharField(max_length=100)
file = 
models.ImageField(upload_to='/Python27/Lib/site-packages/django/bin/mideastinfo/wiki/static/')

View:

from models import Article, Edit
from forms import ArticleForm, EditForm
from forms import *
from PIL import Image
from models import FileUploadHandler

def image_upload(request):
if request.method == 'POST':
form = UploadImageForm(request.POST, request.FILES)
if form.is_valid():
FileUploadHandler(request.FILES['image'])
return render_to_response('wiki/gallery.html')
else:
form = UploadImageForm()
return render_to_response('wiki/gallery.html', 
RequestContext(request, {'form': form}))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/29eff052-3181-4e0d-80fc-84fffe6ba029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


what's the best admin skin (free)

2014-04-16 Thread Bobby Roberts
hey group.   I've been out of the loop for  a few years now.  What is the 
best skin for admin?  Is Grapelli still good?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e51e16a7-5e37-4ead-88f7-1b1092c6e161%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


throwing a 301

2014-01-24 Thread Bobby Roberts
i've got a site i'm porting from classic asp over to django.  Is there a 
way to nicely throw a 301 for the .asp pages?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5d025669-08bc-4eaa-af00-0b3e63214fc3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Honest feedback

2014-01-24 Thread Bobby Roberts
Hi group.  I've been out if the django world for over four years.  I am going 
to rebrand and replatform away from classic asp.   Don't laugh.  Yes I know 
it's sad.  Without telling me how good django is, what has changed in the last 
four year that should make me choose django as my new platform?  Are they still 
actively developing it ?  Just looking for honest feedback, not a sales pitch.  
 Thanks in advance 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fdc1d112-a509-4996-93ee-d56a8c799d7f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: quick question: RE model relations

2013-09-02 Thread Bobby Roberts
i tried doing that and now get this error:

Error: One or more models did not validate:
galleryview.galleryphoto: Accessor for field 'GalleryId' clashes with 
related field 'Gallery.Gallery_Id'. Add a related_name argument to the 
definition for 'GalleryId'.
galleryview.galleryphoto: Reverse query name for field 'GalleryId' clashes 
with related field 'Gallery.Gallery_Id'. Add a related_name argument to the 
definition for 'GalleryId'.
events.event: Accessor for field 'GalleryId' clashes with related field 
'Gallery.Gallery_Id'. Add a related_name argument to the definition for 
'GalleryId'.
events.event: Reverse query name for field 'GalleryId' clashes with related 
field 'Gallery.Gallery_Id'. Add a related_name argument to the definition 
for 'GalleryId'.


now i'm really lost.

On Monday, September 2, 2013 12:40:29 PM UTC-4, Andre Terra (airstrike) 
wrote:
>
> As per the current docs[0], you need to provide a dotted path to your 
> model in the form app.ModelName when defining a ForeignKey.
>
> So try this instead:
>
> GalleryId = models.ForeignKey('galleryview.Gallery', 
> verbose_name=_('Gallery Id'), related_name='Gallery_Id',blank=True, 
> null=True, help_text=_("You can associate a photo gallery to this event 
> here."))
>
> If you don't mind me saying, 'galleryview' is a funny name for a django 
> module, considering how we use the name 'view' for something else entirely.
>
>
> Cheers,
> AT
>
>  [0] https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey
>
>
> On Mon, Sep 2, 2013 at 1:24 PM, Bobby Roberts <tche...@gmail.com
> > wrote:
>
>> I'm creating an event module and want people to be able to associate a 
>> picture gallery with the event:
>>
>>
>>
>> from django.utils.translation import get_language, ugettext, 
>> ugettext_lazy as _
>> from django.contrib import admin
>> from django.db import models
>> from django.contrib.auth.models import User
>> from tinymce import models as tinymce_models
>> from galleryview.models import Gallery
>>
>> active_choices=(
>> (1,"Yes"),
>> (0,"No"),
>> )
>>
>> class event (models.Model):
>> id = models.AutoField (primary_key=True)
>> active = models.IntegerField(blank=False, choices=active_choices)
>> title = models.CharField(blank=False,max_length=150)
>> startDate = models.DateTimeField (blank=False,db_index=True)
>> endDate = models.DateTimeField (blank=False,db_index=True)
>> blurb = models.TextField (blank=False, 
>> max_length=175,help_text="limit to a sentence, 175 chars.")
>> message = models.TextField (blank=False, max_length=2000)
>> GalleryId = models.ForeignKey('Gallery', verbose_name=_('Gallery 
>> Id'), related_name='Gallery_Id',blank=True, null=True, help_text=_("You can 
>> associate a photo gallery to this event here."))
>>
>> class eventAdmin(admin.ModelAdmin):
>> list_display = ('startDate','endDate','title','active',)
>> list_filter = ('startDate',)
>> date_heiarchy = ['startDate','endDate']
>> search_fields = ['title','blurb','message']
>> admin.site.register(event,eventAdmin)
>>
>>
>> *when i try to syncdb, i'm getting the following error:*
>>
>> Error: One or more models did not validate:
>> events.event: 'GalleryId' has a relation with model Gallery, which has 
>> either not been installed or is abstract.
>>
>> What am i doing wrong here?
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

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


Re: quick question: RE model relations

2013-09-02 Thread Bobby Roberts
thanks for the info... yes the name is funny for the model isn't it?  I try 
to write confusing code.


Always test in production


On Monday, September 2, 2013 12:24:41 PM UTC-4, Bobby Roberts wrote:
>
> I'm creating an event module and want people to be able to associate a 
> picture gallery with the event:
>
>
>
> from django.utils.translation import get_language, ugettext, ugettext_lazy 
> as _
> from django.contrib import admin
> from django.db import models
> from django.contrib.auth.models import User
> from tinymce import models as tinymce_models
> from galleryview.models import Gallery
>
> active_choices=(
> (1,"Yes"),
> (0,"No"),
> )
>
> class event (models.Model):
> id = models.AutoField (primary_key=True)
> active = models.IntegerField(blank=False, choices=active_choices)
> title = models.CharField(blank=False,max_length=150)
> startDate = models.DateTimeField (blank=False,db_index=True)
> endDate = models.DateTimeField (blank=False,db_index=True)
> blurb = models.TextField (blank=False, 
> max_length=175,help_text="limit to a sentence, 175 chars.")
> message = models.TextField (blank=False, max_length=2000)
> GalleryId = models.ForeignKey('Gallery', verbose_name=_('Gallery 
> Id'), related_name='Gallery_Id',blank=True, null=True, help_text=_("You can 
> associate a photo gallery to this event here."))
>
> class eventAdmin(admin.ModelAdmin):
> list_display = ('startDate','endDate','title','active',)
> list_filter = ('startDate',)
> date_heiarchy = ['startDate','endDate']
> search_fields = ['title','blurb','message']
> admin.site.register(event,eventAdmin)
>
>
> *when i try to syncdb, i'm getting the following error:*
>
> Error: One or more models did not validate:
> events.event: 'GalleryId' has a relation with model Gallery, which has 
> either not been installed or is abstract.
>
> What am i doing wrong here?
>
>

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


quick question: RE model relations

2013-09-02 Thread Bobby Roberts
I'm creating an event module and want people to be able to associate a 
picture gallery with the event:



from django.utils.translation import get_language, ugettext, ugettext_lazy 
as _
from django.contrib import admin
from django.db import models
from django.contrib.auth.models import User
from tinymce import models as tinymce_models
from galleryview.models import Gallery

active_choices=(
(1,"Yes"),
(0,"No"),
)

class event (models.Model):
id = models.AutoField (primary_key=True)
active = models.IntegerField(blank=False, choices=active_choices)
title = models.CharField(blank=False,max_length=150)
startDate = models.DateTimeField (blank=False,db_index=True)
endDate = models.DateTimeField (blank=False,db_index=True)
blurb = models.TextField (blank=False, 
max_length=175,help_text="limit to a sentence, 175 chars.")
message = models.TextField (blank=False, max_length=2000)
GalleryId = models.ForeignKey('Gallery', verbose_name=_('Gallery 
Id'), related_name='Gallery_Id',blank=True, null=True, help_text=_("You can 
associate a photo gallery to this event here."))

class eventAdmin(admin.ModelAdmin):
list_display = ('startDate','endDate','title','active',)
list_filter = ('startDate',)
date_heiarchy = ['startDate','endDate']
search_fields = ['title','blurb','message']
admin.site.register(event,eventAdmin)


*when i try to syncdb, i'm getting the following error:*

Error: One or more models did not validate:
events.event: 'GalleryId' has a relation with model Gallery, which has 
either not been installed or is abstract.

What am i doing wrong here?

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


help with query set

2013-07-14 Thread Bobby Roberts
hi.  I  need help with this simple setup.  i need to get a list of 
announcements where active =1 and the discontinueDate is either null OR 
less than NOW.  There are two issues:

1) the filter doesn't work
2) numannouncements always equals 1 even when nothing is returned 

any ideas?
*


model:*

active_choices=(
(1,"Yes"),
(0,"No"),
)

class Announcement (models.Model):
Id = models.AutoField (primary_key=True)
adminTag = models.CharField (max_length=50, blank=False, 
db_index=True,help_text=_("Shows in Admin for quick reference."))
active = models.IntegerField(blank=False, choices=active_choices)
synopsis = models.TextField (blank=False, 
max_length=2000,help_text=_("Appears on sermon audio page."))
announcementDate = models.DateField(blank=False)
discontinueDate = models.DateField(blank=True)


class AnnouncementAdmin(admin.ModelAdmin):
list_display = 
('adminTag','announcementDate','discontinueDate','active')
search_fields = ['adminTag','synopsis']

admin.site.register(Announcement,AnnouncementAdmin)



*view:*
def getAnnouncements (request):
dateNow = datetime.datetime.now().strftime("%Y-%m-%d")
try:
tms = 
Announcement.objects.filter(active__exact=1).filter(discontinueDate__lt=dateNow).order_by('announcementDate')
numannouncements = Announcement.objects.count()
except:
tms = ''
numannouncements = 0
assert False, tms.active
return render_to_response('announcements/listpage.html',{'tms': 
tms,'numannouncements':numannouncements}, 
context_instance=RequestContext(request))


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




print shop framework

2013-01-15 Thread Bobby Roberts
hi all... a possible client of mine is looking for an online custom print 
shop like 4over4.com.  Are there any open source frameworks like this out 
there?  I'd prefer a django app but will consider other languages.

-- 
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/-/6wFOXdSLANYJ.
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.



send_mail reply to (how to?)

2013-01-13 Thread Bobby Roberts
i'm trying to set the reply-to as shown here but it's erroring out:

textmessage = 
render_to_string('communications/email/text/contact.html', mydict)
from_email=request.POST.get('Email','')
to_email=['whate...@gmail.com']
subject = 'mysite  Inquiry'
iheaders = 
{'reply-to':request.POST.get('Email','')}

send_mail(subject,textmessage,from_email,to_email, headers=iheaders)


Traceback:  

send_mail() got an unexpected keyword argument 'headers'



What am i doing wrong here?

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



Is there a orded ModelMultipleChoiceField ?

2012-02-24 Thread fabby bobby
Hello everyone,
 I was writing a website, and meet a problem.
 I want users select some instances from a model , and  want to print
them in order.
 I integrate it with a jquery plugin( 
http://code.google.com/p/jquery-asmselect/)
,and users can select some instances and they can change the order of
the items. But, the field ModelMultipleChoiceField couldn't take the
order.

Some key codes are:

forms.py
class ExcelForm(forms.Form):
choices =
forms.ModelMultipleChoiceField(queryset=Question.objects.all(),
required=False, widget=forms.SelectMultiple)

views.py
  if request.method=='POST':
form = ExcelForm(request.POST)
if form.is_valid():
#print request.POST
wb = Workbook()
sheet = wb.add_sheet(u'test')
print form.data
column = form.cleaned_data['choices']
print column
for i,j in enumerate(column):
sheet.write(0,i,j.text)

datafile = StringIO.StringIO()
wb.save(datafile)
datafile.seek(0)
response = HttpResponse(datafile.read(), mimetype =
'application/vnd.ms-excel')
response['Content-Disposition'] = 'attachment;
filename=test.xls'
return response
else:
form = ExcelForm()

-- 
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: Satchmo, the bloated manatee

2011-07-29 Thread Bobby Roberts

Django is the best thing since the Civil Rights
Movement.
Satchmo is ok for the most part except for certain things
which do not work unless you correct the errors in the programming.
I'm sorry for ranting on the board.
I will never rant again.
@bloatedmanatee


-- 
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: Satchmo, the bloated manatee

2011-07-29 Thread Bobby Roberts

   Django is the next best thing to Emancipation.
   I like Satchmo for the most part.
   I'll keep my rants off list.
.  I promise.  You can follow me on
twitter @bloatedmanatee from now on.

Thanks for setting me straight everyone!

On Jul 29, 1:14 pm, Jacob Kaplan-Moss <ja...@jacobian.org> wrote:
> Hi Bobby --
>
> I'm quite sorry if you took my words as a threat. Such wasn't my
> intent -- at all. I'm simply trying to make clear certain community
> expectations. You're completely right that banning would be wildly
> inappropriate, and I certainly wasn't suggesting that.
>
> The Django community has historically been known as a friendly,
> accepting, professional one free of the usual flamewars that crop up
> on free software. I really appreciate your help in keeping it that
> way. I think we can all agree that a helpful, welcoming community is
> something to be proud of.
>
> That's the last I've got to say on the matter; at this point we're
> basically going in circles. I hope I made my point clear enough. If
> not, please feel free to contact me off-list so everyone else can get
> back to talking about software.
>
> Thanks!
>
> Jacob

-- 
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: Satchmo, the bloated manatee

2011-07-29 Thread Bobby Roberts
opinions on software should never be taken personally and should never
be silenced.  I take heat over programming on a daily basis just as I
have for the past 30 years.  It's part of the business.  Good
programmers take it, grow from it and come back with a better product.

There was no slight intended toward the programmers and I doubt I'm
the only one that has ever said that this version is bloated or with
issues. I am sorry to the Satchmo team, and the sweet gentle aquatic
bovine If I have caused personal insult to either.  I have used
Satchmo for over three years now and it's simply this version which I
believe perhaps was rushed. It seems to be behind the django
compatibility curve and some of the documentation is outdated as well
and not everything works as it should and needs serious tweaking to
the code to get it to even function.

Boot me out if you feel I need to be booted from the group.  However,
that would be the biggest flame to an open source board    note
this is an opinion, i'm not meaning to insult ANYONE.

If i'm allowed to stay, perhaps I will use the new WC3  or
 tags to make things clear.

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



Satchmo, the bloated manatee

2011-07-28 Thread Bobby Roberts
satchmo has become a bloated manatee of a codebase.  Does anyone know
why it run so slowly now?  Or, do you have to feed it treats or
something secretive to get it running properly?  I've got two satchmo
sites on a 256mb slice at slicehost and they are pretty much unusable
at the moment.

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



csrf token not working

2011-07-02 Thread Bobby Roberts
I'm looking at the docs at 
https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
for CSRF implementation.  I've got steps 1 and 2 done but the csrf
token is not even showing in the form even though i have {%csrf_token
%} within the form html any ideas what would cause it not to
create a token?

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



satchmo images

2011-06-16 Thread Bobby Roberts
anyone know where to adjust the upload size of the product images in
satchmo?

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



filter chaining question

2011-06-15 Thread Bobby Roberts
consider  this:

findit = inventory.objects.filter(Barcode = self.Barcode,
Condition__name = "good")

How could i make this filter say "good" or "acceptable"

or IN ('good','acceptable')

-- 
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: send_mail issue

2011-06-08 Thread Bobby Roberts
got it... worked like a charm.  i read that but it didn't click the
first time.

thanks again!

On Jun 8, 9:50 pm, David Graves <johosaph...@gmail.com> wrote:
> Fromhttps://docs.djangoproject.com/en/dev/topics/email/#django.core.mail
> like attachments argument should be a list of tuples, so instead of
> attachments=(filename,filecontent,'application/vnd.ms-excel'), try
> attachments=[(filename,filecontent,'application/vnd.ms-excel')].  If that
> doesn't work, just take the attachments argument out, and do:
> message.attach(filename,filecontent,'application/vnd.ms-excel') before your
> message.send
>
> On Wed, Jun 8, 2011 at 7:59 PM, Bobby Roberts <tchend...@gmail.com> wrote:
> > hey david... that got past he original error but now i'm getting this:
>
> > _create_attachment() takes at most 4 arguments (37 given)
>
> > i think this is happening from the content argument maybe?  any idea
> > how to get around that?
>
> > On Jun 8, 8:38 pm, David Graves <johosaph...@gmail.com> wrote:
> > > from django.core.mail import EmailMessage
>
> > > On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts <tchend...@gmail.com>
> > wrote:
> > > > hi all... i'm trying to send an email attachment and am getting the
> > > > following traceback:
>
> > > > global name 'EmailMessage' is not defined
>
> > > > Here's the code:
>
> > > > [...]
> > > >    from django.core.mail import send_mail
>
> > > >    list2send = mymodel.objects.filter(idNumber = 3)
> > > >    filecontent = render_to_string('template_excel.html',
> > > > {'trs':list2send})
> > > >    filename = 'myfile.xls'
>
> > > >    emailmsg = "See Attached"
> > > >    to_email="x...@.com"
> > > >    subject  = "important email subject here"
> > > >    message = EmailMessage(subject, emailmsg,
> > > > 'fromem...@domainname.com
> > > > ',to_email,attchements=(filename,filecontent,'application/
> > > > vnd.ms-excel'))
>
> > > >    message.send()
>
> > > > am i not importing something?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: send_mail issue

2011-06-08 Thread Bobby Roberts
hey david... that got past he original error but now i'm getting this:

_create_attachment() takes at most 4 arguments (37 given)

i think this is happening from the content argument maybe?  any idea
how to get around that?



On Jun 8, 8:38 pm, David Graves <johosaph...@gmail.com> wrote:
> from django.core.mail import EmailMessage
>
> On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts <tchend...@gmail.com> wrote:
> > hi all... i'm trying to send an email attachment and am getting the
> > following traceback:
>
> > global name 'EmailMessage' is not defined
>
> > Here's the code:
>
> > [...]
> >    from django.core.mail import send_mail
>
> >    list2send = mymodel.objects.filter(idNumber = 3)
> >    filecontent = render_to_string('template_excel.html',
> > {'trs':list2send})
> >    filename = 'myfile.xls'
>
> >    emailmsg = "See Attached"
> >    to_email="x...@.com"
> >    subject  = "important email subject here"
> >    message = EmailMessage(subject, emailmsg,
> > 'fromem...@domainname.com
> > ',to_email,attchements=(filename,filecontent,'application/
> > vnd.ms-excel'))
>
> >    message.send()
>
> > am i not importing something?
>
> > --
> > 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: send_mail issue

2011-06-08 Thread Bobby Roberts
that should be

message = EmailMessage(subject,
emailmsg,'fromem...@domainname.com',to_email,attachments=(filename,filecontent,'application/
vnd.ms-excel'))

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



send_mail issue

2011-06-08 Thread Bobby Roberts
hi all... i'm trying to send an email attachment and am getting the
following traceback:

global name 'EmailMessage' is not defined

Here's the code:

[...]
from django.core.mail import send_mail

list2send = mymodel.objects.filter(idNumber = 3)
filecontent = render_to_string('template_excel.html',
{'trs':list2send})
filename = 'myfile.xls'

emailmsg = "See Attached"
to_email="x...@.com"
subject  = "important email subject here"
message = EmailMessage(subject, emailmsg,
'fromem...@domainname.com',to_email,attchements=(filename,filecontent,'application/
vnd.ms-excel'))

message.send()


am i not importing something?

-- 
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: VERY cheap django hosting?

2011-06-08 Thread Bobby Roberts
i've been using webfaction.com for a while for $9/mo with one click
django installs.  You can also checkout www.slicehost.com if you want
your own vps and more control.

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



Excel dumps to Office 10

2011-06-06 Thread Bobby Roberts
hey -

we are dumping results to excel as such:


response = render_to_response('templatename_excel.html',
{'trs':trs,})
filename='myfilename.xls'
response['Content-Disposition'] = 'attachment; filename='
+ filename
response['Content-Type'] = 'application/vnd.ms-excel;
charset=utf-8'
return response


where trs is our record set.  This works fine for office 2003 and open
office but we get an invalid format error when trying to open the item
in office 2010... we can click OK on the alert box and the file opens
but it is still annoying.  Do you have to do anything specifically for
Excel 2010 to get that message to go away?


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



accessing views outside a module

2011-06-04 Thread Bobby Roberts
let's say i've got two apps in my project... app a and app b


how do i access views in app a from app b views?

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



debug=false issue

2011-06-02 Thread Bobby Roberts
hey -

i've got a weird issue with a django app.  The app runs great on both
the front end and in the /admin section when DEBUG=True in my
settings.py file.  However, whenever I set DEBUG=False in the settings
file so that i get tracebacks by email, the entire /admin section
404s.  Any idea what could be causing this?

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



DEBUG=False issue

2011-06-02 Thread Bobby Roberts
hey -

i've got a weird issue with a django app.  The app runs great on both
the front end and in the /admin section when DEBUG=True in my
settings.py file.  However, whenever I set DEBUG=False in the settings
file so that i get tracebacks by email, the entire /admin section
404s.  Any idea what could be causing this?

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



"invalid label' as it pertains to application name

2011-05-31 Thread Bobby Roberts
I am getting a pretty non-descript error reading "Caught RuntimeError
while rendering: invalid label: cigar-wizard" when i go to a certain
url on my website.  This isn't a form label... it's referring to an
application name.  Any ideas what that means?

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



invalid label

2011-05-27 Thread Bobby Roberts
ok got a strange situation here.  I'm using Satchmo for a shopping
cart and have an independent module i wrote which is called from the
main nav.  This module works fine on every page of the site except for
the product detail page in Satchmo.  When i view the page in satchmo i
get this error:


Django Version: 1.3 pre-alpha SVN-14462
Exception Type: TemplateSyntaxError
Exception Value:

Caught RuntimeError while rendering: invalid label: cigar-wizard

where cigar-wizard is the name of my module... it has nothing to do
with satchmo.  any idea what invalid label means?  I don't see
anything like this in the docs anywhere

-- 
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: Caught RuntimeError while rendering: invalid label:

2011-05-26 Thread Bobby Roberts
anyone have any idea what invalid label means?

On May 26, 12:24 pm, Bobby Roberts <tchend...@gmail.com> wrote:
> i'm getting this error:
>
> Caught RuntimeError while rendering: invalid label:  "whatever"
>
> where whatever is the name of an app in INSTALLED_APPS.  what does
> "invalid label" mean?

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



Caught RuntimeError while rendering: invalid label:

2011-05-26 Thread Bobby Roberts
i'm getting this error:

Caught RuntimeError while rendering: invalid label:  "whatever"


where whatever is the name of an app in INSTALLED_APPS.  what does
"invalid label" mean?

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



weird error with MS Excel 2010 exports

2011-05-19 Thread Bobby Roberts
hi.  Regardless of how we try to export from a view into an excel
file, we get a weird msgbox reading:

"The file you are trying to open, 'filenamehere.xls', is in a
different format than specified by the file extension.  Verify that
the file is not corrupted and is from a trusted source before openin
gthe file.  Do you want to open the file now?"   YES  NO HELP"

Now if they click yes, it opens just fine.  Has anyone run into this
issue with MS Excel 2010?  It's fine in openoffice and previous
versions of Excel.

-- 
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: readonly field ordering issue

2011-04-20 Thread Bobby Roberts
thanks!  That is exactly what i used.  would be great if the docs
actually said that would solve the issue.




On Apr 20, 10:52 am, Shawn Milochik  wrote:
> I think you can just specify a 'fields' attribute in your admin model
> to fix this. It should retain the order in which they're entered.
>
> http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contri...

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



readonly field ordering issue

2011-04-20 Thread Bobby Roberts
hi all... i have certain fields in my model such as this:

field1
field2
field3
field4
field5
field6
field7
field8
field9
field10

I have the even fields set to readonly fields.

The issue i'm having is that when I go into edit this record in admin,
i see the odd numbered fields at the top (which you can edit) and the
even (read only ) fields at the bottom.  Is there a way to show all of
the fields in their correct order regardless of whether or not they
are in readonly mode?

-- 
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: weird "must be an intance" error

2011-04-18 Thread Bobby Roberts
haha Thanks for that... i never would have figured it out




On Apr 18, 4:59 pm, akaariai <akaar...@gmail.com> wrote:
> On Apr 18, 11:38 pm, Bobby Roberts <tchend...@gmail.com> wrote:
>
> > oops... forgot to clarify that Item.tid is a FK to printLocation
>
> Then you would want to assign to tid_id. For foreign keys the tid
> wants an instance, the tid_id can be assigned the "db value" for that
> foreign key. I am not sure if the tid_id can be named something else.
> If it can be, you can find out the right field name to assign to by
> checking out ItemTracking._meta.get_field_by_name('tid')[0].attname in
> the django shell.
>
>  - Anssi

-- 
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: weird "must be an intance" error

2011-04-18 Thread Bobby Roberts
oops... forgot to clarify that Item.tid is a FK to printLocation

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



weird "must be an intance" error

2011-04-18 Thread Bobby Roberts
considering this snippet:


 
valPrintlocation=int(request.POST.get('printlocation'))
if valPrintlocation==-1:
needsprinting=0
else:
needsprinting=1

Item = ItemTracking.objects.get(Barcode =
barcode)
Item.tid=valPrintlocation
Item.NeedsPrinting=needsprinting
...

can you see any reason i'm getting this error:

Cannot assign "-1": "ItemTracking.tid" must be a "printLocation"
instance.


I get the same error regardless of the value of valPrintlocation

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



code 128 or code 39 barcode generation

2011-04-18 Thread Bobby Roberts
anyone know if there is a django module to generate code 128 or 39
barcodes for printing out on a webpage?

-- 
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: sorting in /admin

2011-03-22 Thread Bobby Roberts
yeah we want it split into first name and last name.  That part is
working fine... i'm just trying to figure out how to get the column
sortable by clicking on the column header.

On Mar 22, 3:53 pm, Siara <pawel.skrzyn...@gmail.com> wrote:
> Hmm i dont know but if you dont realy need 2 separate colums for name
> and surname you can define in Customer __unicode__ like that:
>
> def __unicode__(self):
>    return self.lastName + " " + self.firstName
>
> and then in list_diplay = ['CustomerId'],
> but that solution could give ou another problems
>
> On 22 Mar, 20:10, Bobby Roberts <tchend...@gmail.com> wrote:
>
> > how else would you pull in information from another model into the
> > current model list view in admin?
>
> > On Mar 22, 2:41 pm, Siara <pawel.skrzyn...@gmail.com> wrote:
>
> > > Why are you doing this way ?
> > > The better idea is to make it that way:
>
> > > class YourModelAdmin(admin.ModelAdmin):
> > >    model = YourModel
> > >    list_display = [ 'firstName', 'lastName' ]
>
> > > admin.site.register(YourModel, YourModelAdmin)
>
> > > and i'm sure then you will be able to sort olums
>
> > > On 22 Mar, 19:28, Bobby Roberts <tchend...@gmail.com> wrote:
>
> > > > I am listing the following fields from the model in /admin as follows:
>
> > > > [...snip...]
>
> > > > def Client_Lastname(self, obj):
> > > >      return  obj.CustomerId.lastName
>
> > > > def Client_Firstname(self, obj):
> > > >      return  obj.CustomerId.firstName
>
> > > > list_display = ('Client_Firstname', 'Client_Lastname', )
>
> > > > [...snip...]
>
> > > > The Firstname and Lastname fields from the Client model drop right
> > > > into the list fine but I cannot sort on these fields when i click the
> > > > column header.  What do I need to do to make them sortable?

-- 
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: sorting in /admin

2011-03-22 Thread Bobby Roberts
how else would you pull in information from another model into the
current model list view in admin?



On Mar 22, 2:41 pm, Siara <pawel.skrzyn...@gmail.com> wrote:
> Why are you doing this way ?
> The better idea is to make it that way:
>
> class YourModelAdmin(admin.ModelAdmin):
>    model = YourModel
>    list_display = [ 'firstName', 'lastName' ]
>
> admin.site.register(YourModel, YourModelAdmin)
>
> and i'm sure then you will be able to sort olums
>
> On 22 Mar, 19:28, Bobby Roberts <tchend...@gmail.com> wrote:
>
> > I am listing the following fields from the model in /admin as follows:
>
> > [...snip...]
>
> > def Client_Lastname(self, obj):
> >      return  obj.CustomerId.lastName
>
> > def Client_Firstname(self, obj):
> >      return  obj.CustomerId.firstName
>
> > list_display = ('Client_Firstname', 'Client_Lastname', )
>
> > [...snip...]
>
> > The Firstname and Lastname fields from the Client model drop right
> > into the list fine but I cannot sort on these fields when i click the
> > column header.  What do I need to do to make them sortable?

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



sorting in /admin

2011-03-22 Thread Bobby Roberts
I am listing the following fields from the model in /admin as follows:

[...snip...]

def Client_Lastname(self, obj):
 return  obj.CustomerId.lastName

def Client_Firstname(self, obj):
 return  obj.CustomerId.firstName

list_display = ('Client_Firstname', 'Client_Lastname', )

[...snip...]


The Firstname and Lastname fields from the Client model drop right
into the list fine but I cannot sort on these fields when i click the
column header.  What do I need to do to make them sortable?

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



/admin weirdness

2011-03-17 Thread Bobby Roberts
when i login to my /admin area, I can see my models on the main model
listing.  When I click on a model to add/edit/delete data, I'm getting
a 404.  No errors are being thrown.  Has anyone else run into
something like this?

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



dumping to excel from /admin

2011-03-15 Thread Bobby Roberts
let's say i'm on page X of a list admin view... is there an easy way
to dump just those returns to excel?

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



date_heiarchy not working

2011-03-07 Thread Bobby Roberts
i've got this in my admin model:
 date_heiarchy='ShipDate'

Shipdate is a DateField.  The Date Heiarchy plugin is not showing on
my admin list view... has that been depricated in django 1.2+?

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



weird ifnotequal issue

2011-03-06 Thread Bobby Roberts
fieldname does in fact equal "-" so why is the TR still showing?

 {% ifnotequal mymodel.fieldname"-"%}
  
Flagged Reason
{{mymodel.fieldname}}
  
{%endifnotequal%}

-- 
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: Looking for a developer

2011-03-05 Thread Bobby Roberts
i'd like to see a copy of the RFP

On Mar 4, 8:05 am, Colleen  wrote:
> I'm representing an international company that needs a website
> developed fast. (15weeks). We have the RFP to send out (today - March
> 4th) and are looking for interested developers.
>
> No parties will be considered after today. Sorry. Tight turnaround.

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



foreign key search in admin

2011-03-05 Thread Bobby Roberts
hi all... i'm banging my head against a wall here.

consider this model

class mymodel(models.Model):
id = models.AutoField (primary_key=True)
Barcode = models.IntegerField(unique = True, blank=False)
CustomerId= models.ForeignKey(Customer, db_index=True,
blank=True, null = True)


Now in the admin list view, we are able to pull back
Customer.FirstName and Customer.Lastname in the list fields.

How would i search mymodel from admin on Customer.FirstName or
Customer.LastName?

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



searching a model in admin with data from a related model

2011-02-25 Thread Bobby Roberts
consider this model (only a portion of it):

class Tracker (models.Model):
id = models.AutoField (primary_key=True)
Barcode = models.IntegerField(unique = True, blank=False)
OrderId = models.IntegerField(blank=False)
CustomerId = models.CharField (max_length=20, blank=False)
   [[sniped]]


when you view the Tracker model in /admin on the list page, there is a
search box in the top right corner.  Is it possible to search on
another model called Customer for Customer.firstname,
customer.LastName?  If you notice we have CustomerId as a charfield...
if we changed that to a foreign key, is it possible to search the
Tracker model by customer firstname/lastname and if so, how?

thanks in advance!





-- 
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: Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-25 Thread Bobby Roberts
anyone have any other ideas?

On Feb 22, 5:02 pm, Bobby Roberts <tchend...@gmail.com> wrote:
> Hey Daniel -
>
> we've got {% load thumbnail%} at the top of the template (a standard
> satchmo template anyway)... running version 3.2.5 for sorl.
>
> On Feb 22, 4:25 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
>
> > On Tuesday, February 22, 2011 6:22:16 PM UTC, Bobby Roberts wrote:
>
> > > Hi group.  I've posted this in the satchmo group but am posting here
> > > as well in hopes of getting some help.
>
> > > This error is caused by this code:
>
> > > {% if product.main_image %}
> > >               
> > >               {% thumbnail product.main_image.picture 85x85 as image
> > > %}
> > >                > > src="{{ image }}" width="{{ image.width }}"
> > > height="{{ image.height }}" />
> > >               
> > > {% endif %}
>
> > > it makes use of sorl thumbnail to resize images on the fly i believe.
> > > We can import sorl thumbnail into python from command line just fine.
>
> > > If anyone uses satchmo for their ecommerce store have you run into
> > > this error?  How did you resolve.  Please help and thank you in
> > > advance.
>
> > You haven't loaded the template tag library that defines the thumbnail tag.
>
> >     {% load thumbnail_tags %}
>
> > or whatever.
> > --
> > DR.

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



admin list help

2011-02-23 Thread Bobby Roberts
hi group.  I really need to know how to do something in regard to my
models shown below.  Please consider these three models and then look
at the bottom for my question.

garments
class modela (models.Model):
id = models.AutoField (primary_key=True)
type = models.CharField (max_length=128, blank=False)
order_id = models.IntegerField (blank=False)
lastSave  = models.BigIntegerField (blank=True)

class modelaAdmin(admin.ModelAdmin):
list_display = ('id','type','order_id','lastSave')
search_fields = ['type','order_id','lastSave']
admin.site.register(modela,modelaAdmin)

orders
class modelb (models.Model):
id = models.AutoField (primary_key=True)
title = models.CharField (max_length=128, blank=False)
status = models.CharField(max_length=20, blank=False)
client_id = models.CharField(max_length=11, blank=False)
source = models.CharField (max_length=255, blank=False)

class modelbAdmin(admin.ModelAdmin):
list_display = ('id','title','status','client_id','source')
search_fields = ['title','status','client_id','source']
admin.site.register(modelb,modelbAdmin)


Customer
class modelc (models.Model):
id = models.CharField
(primary_key=True,max_length=10,blank=False)
firstName = models.CharField (max_length=128, blank=False)
lastName = models.CharField (max_length=128, blank=False)
phone = models.CharField (max_length=64, blank=False)
email = models.CharField (max_length=128, blank=False)
comments = models.TextField (blank=False)

class modelcAdmin(admin.ModelAdmin):
list_display =
('id','firstName','lastName','phone','email','comments')
search_fields =
['id','firstName','lastName','phone','email','comments']
admin.site.register(modelc,modelcAdmin)



I am looking to do two things:

1) in the admin list for modela, i would like to show the firstname
and lastname from modelc.

modela is tied to model by by modela.client_id=modelb.id  and modelb
is tied to modelc by modelb.client_id=modelc.id

In addition, I would like to be able to search modela by
modelc.firstname or modelc.lastname


2) in the list view for modela, I would like to show lastSave as a
date/time value. The integer value stored in lastSave is the integer
value of a date.


Are these two things possible to do... if so,  how do i do it?

-- 
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: Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-22 Thread Bobby Roberts
Hey Daniel -

we've got {% load thumbnail%} at the top of the template (a standard
satchmo template anyway)... running version 3.2.5 for sorl.




On Feb 22, 4:25 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Tuesday, February 22, 2011 6:22:16 PM UTC, Bobby Roberts wrote:
>
> > Hi group.  I've posted this in the satchmo group but am posting here
> > as well in hopes of getting some help.
>
> > This error is caused by this code:
>
> > {% if product.main_image %}
> >               
> >               {% thumbnail product.main_image.picture 85x85 as image
> > %}
> >                > src="{{ image }}" width="{{ image.width }}"
> > height="{{ image.height }}" />
> >               
> > {% endif %}
>
> > it makes use of sorl thumbnail to resize images on the fly i believe.
> > We can import sorl thumbnail into python from command line just fine.
>
> > If anyone uses satchmo for their ecommerce store have you run into
> > this error?  How did you resolve.  Please help and thank you in
> > advance.
>
> You haven't loaded the template tag library that defines the thumbnail tag.
>
>     {% load thumbnail_tags %}
>
> or whatever.
> --
> DR.

-- 
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: Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-22 Thread Bobby Roberts

hey daniel -

we've got {%load thumbnail%} at the top of the standard satchmo
template.


On Feb 22, 4:25 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Tuesday, February 22, 2011 6:22:16 PM UTC, Bobby Roberts wrote:
>
> > Hi group.  I've posted this in the satchmo group but am posting here
> > as well in hopes of getting some help.
>
> > This error is caused by this code:
>
> > {% if product.main_image %}
> >               
> >               {% thumbnail product.main_image.picture 85x85 as image
> > %}
> >                > src="{{ image }}" width="{{ image.width }}"
> > height="{{ image.height }}" />
> >               
> > {% endif %}
>
> > it makes use of sorl thumbnail to resize images on the fly i believe.
> > We can import sorl thumbnail into python from command line just fine.
>
> > If anyone uses satchmo for their ecommerce store have you run into
> > this error?  How did you resolve.  Please help and thank you in
> > advance.
>
> You haven't loaded the template tag library that defines the thumbnail tag.
>
>     {% load thumbnail_tags %}
>
> or whatever.
> --
> DR.

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



Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-22 Thread Bobby Roberts
Hi group.  I've posted this in the satchmo group but am posting here
as well in hopes of getting some help.

This error is caused by this code:

{% if product.main_image %}
  
  {% thumbnail product.main_image.picture 85x85 as image
%}
  
  
{% endif %}



it makes use of sorl thumbnail to resize images on the fly i believe.
We can import sorl thumbnail into python from command line just fine.

If anyone uses satchmo for their ecommerce store have you run into
this error?  How did you resolve.  Please help and thank you in
advance.

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



Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-22 Thread Bobby Roberts
Hi group.  I've posted this in the satchmo group but am posting here
as well in hopes of getting some help.

This error is caused by this code:

{% if product.main_image %}
  
  {% thumbnail product.main_image.picture 85x85 as image
%}
  
  
{% endif %}



it makes use of sorl thumbnail to resize images on the fly i believe.
We can import sorl thumbnail into python from command line just fine.

If anyone uses satchmo for their ecommerce store have you run into
this error?  How did you resolve.  Please help and thank you in
advance.

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



query set on a manytomany table

2011-02-17 Thread Bobby Roberts
I have a Manytomanyfield in a model called "registrants" on a
fieldname called locations.  It stores the person's facility values in
a table in the database in something called like
registrants_locations_values  (just as an example).


How can i do a query on the registrants_locations_values table since
it's not a model?

I'm trying something like this:

tms = registrants_locations_values.objects.filter(id=user.id)

but that is not working... how can i pull data from this Manytomany
table?


-- 
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: form select box how to (help needed)

2011-02-16 Thread Bobby Roberts
i have no idea what this means is there an example anywhere?

On Feb 16, 12:43 am, Kenneth Gonsalves <law...@thenilgiris.com> wrote:
> On Tue, 2011-02-15 at 19:05 -0800, Bobby Roberts wrote:
> > I can't load it through the "CHOICES" parameter in my forms field...
> > how can I do this?
>
> override __init__ in your form and populate there
> --
> regards
> KGhttp://lawgon.livejournal.com
> Coimbatore LUG roxhttp://ilugcbe.techstud.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.



form select box how to (help needed)

2011-02-15 Thread Bobby Roberts
I've got several select boxes in a user profile that the we can
manipulate in /admin.  One of these select boxes is called "locations"
and has locations to which you can assign a user.

for explanation, let's say that that the select box is populated like
such:


1,location1
2,location2
3,location3
4,location4

where the numbers are the option values and the text is the option
text.

In this user profile, if they choose ocation1,location2,location3, it
saves to a session variable as "1,2,3" (and of course also saves in
their profile.)

so far so good.


now here's what i need help with.

On the public side of the site, they'll login and do certain things.
i want to have a select box (as previously described), HOWEVER, i only
want it populated with options 1,2 and 3 (the values in their session
variable)... not the 4th location since they haven't been assigned to
that location.


I can't load it through the "CHOICES" parameter in my forms field...
how can I do this?

-- 
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: trouble storing a manytomany field in a session variable

2011-02-14 Thread Bobby Roberts
yeah i've got it where session ends on browser close so they will
refresh when they come back and log back in.  I'm just trying to find
an efficient way to store the values so that I don't have to query on
every page.

On Feb 14, 9:19 pm, Shawn Milochik  wrote:
> Pickling will let you store objects as strings. However, perhaps you
> would like to use a memoize[1]  decorator on your function.
>
> Are you trying to do this for performance reasons, because getting
> that relationship info from the database is slow?
>
> Regardless of why you're doing it, make sure you understand the
> circumstances which would invalidate your cached values. Whether
> they're stored in the session or not, they will become stale and cause
> bugs or user frustration.
>
> Shawn
>
> [1]http://wiki.python.org/moin/PythonDecoratorLibrary#Memoize

-- 
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: trouble storing a manytomany field in a session variable

2011-02-14 Thread Bobby Roberts
someone can choose 1 or many locations in their profile and i'm
trying to think of an interesting way to put those values from the MTM
table into a session var.

On Feb 14, 9:03 pm, Bobby Roberts <tchend...@gmail.com> wrote:
> just wanted to clarify... i've got the manytomany setup in a user
> profile.  When they login i'm loading certain pieces of their profile
> into session variables.  One of these fields is the MTM and the data
> is stored outside of the userprofile model in the MTM table... how
> would I go about taking all of those values and making a CSV string to
> save in the session variable?
>
> On Feb 14, 8:37 pm, Bobby Roberts <tchend...@gmail.com> wrote:
>
> > I'm trying to figure out how to store a manytomany relationship in a
> > session variable.  is the only way really to do it to loop through and
> > make a csv string and save that?

-- 
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: trouble storing a manytomany field in a session variable

2011-02-14 Thread Bobby Roberts
just wanted to clarify... i've got the manytomany setup in a user
profile.  When they login i'm loading certain pieces of their profile
into session variables.  One of these fields is the MTM and the data
is stored outside of the userprofile model in the MTM table... how
would I go about taking all of those values and making a CSV string to
save in the session variable?

On Feb 14, 8:37 pm, Bobby Roberts <tchend...@gmail.com> wrote:
> I'm trying to figure out how to store a manytomany relationship in a
> session variable.  is the only way really to do it to loop through and
> make a csv string and save that?

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



trouble storing a manytomany field in a session variable

2011-02-14 Thread Bobby Roberts
I'm trying to figure out how to store a manytomany relationship in a
session variable.  is the only way really to do it to loop through and
make a csv string and save that?

-- 
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: Caught KeyError while rendering: u'objects_name'

2011-02-13 Thread Bobby Roberts
returning foo resulted in the same error.




On Feb 13, 6:29 pm, Ivo Brodien <i...@brodien.de> wrote:
> Hi,
>
> when the admin is deleting an object it gathers a list (calling all unicode 
> methods) of other foreign key objects and displays them as a warning that 
> they will also be deleted.
> I think the error occurs in:
>
> > class Disposition (models.Model):
> >  []
> >        def __unicode__(self):
> >                return self.name
>
> try to return u’foo’ to see if the errors still occurs!
>
> BTW: method names should be lowercase
>
> (http://www.python.org/dev/peps/pep-0008/)
>
> On 13.02.2011, at 23:52, Bobby Roberts wrote:
>
> > when i try to delete one of the TractorRecord objects in this model, i
> > get this message:
>
> > Caught KeyError while rendering: u'objects_name'
>
> > any idea what that means?
>
> > Django 1.2.3 (mod_wsgi 3.2/Python 2.6)
>
> > # this holds possible dispositions for Tractoruees
> > class Disposition (models.Model):
> >        id = models.AutoField (primary_key=True)
> >        name = models.CharField (max_length=50, blank=False,
> > db_index=True)
> >        active = models.IntegerField(blank=False,
> > choices=active_choices)
> >        order = models.IntegerField(blank=True, default=0)
>
> >        def __unicode__(self):
> >                return self.name
>
> > class DispositionAdmin(admin.ModelAdmin):
> >        list_display = ('name','active','order',)
> >        search_fields = ['name']
>
> > admin.site.register(Disposition,DispositionAdmin)
>
> > #this holds the Tractor information
> > class TractorRecord (models.Model):
> >        id = models.AutoField (primary_key=True)
> >        FirstName = models.CharField (max_length=25,blank=False,
> > db_index=True)
> >        LastName = models.CharField (max_length=45,blank=False,
> > db_index=True)
> >        Status = models.CharField
> > (choices=inout_choices,max_length=3,blank=False, db_index=True)
> >        Photo= models.ImageField(upload_to="Tractoruees/", blank=True)
> >        Disposition = models.ForeignKey('Disposition',
> > verbose_name=_('Disposition Value'),db_index=True, blank=False)
> >        Notes = models.TextField(blank=True)
> >        LastTouchedBy = models.ForeignKey(User, unique=False,
> > db_index=True, blank=False)
> >        LastUpdated = models.DateTimeField
> > (auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')
>
> >        def disposition_name(self):
> >                return self.Disposition.name
>
> >        def Last_Updated_By(self):
> >                return self.LastTouchedBy.get_full_name()
>
> >        #resize uploaded image to max 650 x 650
> >        def save(self, size=(175,175)):
> >                super(TractorRecord, self).save()
> >                if self.Photo:
> >                        filename = self.Photo.path
> >                        image = Image.open(filename)
> >                        image.thumbnail(size, Image.ANTIALIAS)
> >                        image.save(filename)
>
> > class TractorRecordAdmin(admin.ModelAdmin):
> >        list_display =
> > ('Picture','FirstName','LastName','Status','disposition_name','Last_Updated_By','LastUpdated')
> >        search_fields = ['FirstName','LastName','LastTouchedby']
>
> >        def Picture(self,instance):
> >                return '' %
> > (instance.Photo)
> >        Picture.allow_tags=True
>
> > admin.site.register(TractorRecord,TractorRecordAdmin)
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

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



Re: Caught KeyError while rendering: u'objects_name'

2011-02-13 Thread Bobby Roberts
i'm also using the grappelli skin for admin

On Feb 13, 5:52 pm, Bobby Roberts <tchend...@gmail.com> wrote:
> when i try to delete one of the TractorRecord objects in this model, i
> get this message:
>
> Caught KeyError while rendering: u'objects_name'
>
> any idea what that means?
>
> Django 1.2.3 (mod_wsgi 3.2/Python 2.6)
>
> # this holds possible dispositions for Tractoruees
> class Disposition (models.Model):
>         id = models.AutoField (primary_key=True)
>         name = models.CharField (max_length=50, blank=False,
> db_index=True)
>         active = models.IntegerField(blank=False,
> choices=active_choices)
>         order = models.IntegerField(blank=True, default=0)
>
>         def __unicode__(self):
>                 return self.name
>
> class DispositionAdmin(admin.ModelAdmin):
>         list_display = ('name','active','order',)
>         search_fields = ['name']
>
> admin.site.register(Disposition,DispositionAdmin)
>
> #this holds the Tractor information
> class TractorRecord (models.Model):
>         id = models.AutoField (primary_key=True)
>         FirstName = models.CharField (max_length=25,blank=False,
> db_index=True)
>         LastName = models.CharField (max_length=45,blank=False,
> db_index=True)
>         Status = models.CharField
> (choices=inout_choices,max_length=3,blank=False, db_index=True)
>         Photo= models.ImageField(upload_to="Tractoruees/", blank=True)
>         Disposition = models.ForeignKey('Disposition',
> verbose_name=_('Disposition Value'),db_index=True, blank=False)
>         Notes = models.TextField(blank=True)
>         LastTouchedBy = models.ForeignKey(User, unique=False,
> db_index=True, blank=False)
>         LastUpdated = models.DateTimeField
> (auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')
>
>         def disposition_name(self):
>                 return self.Disposition.name
>
>         def Last_Updated_By(self):
>                 return self.LastTouchedBy.get_full_name()
>
>         #resize uploaded image to max 650 x 650
>         def save(self, size=(175,175)):
>                 super(TractorRecord, self).save()
>                 if self.Photo:
>                         filename = self.Photo.path
>                         image = Image.open(filename)
>                         image.thumbnail(size, Image.ANTIALIAS)
>                         image.save(filename)
>
> class TractorRecordAdmin(admin.ModelAdmin):
>         list_display =
> ('Picture','FirstName','LastName','Status','disposition_name','Last_Updated_By','LastUpdated')
>         search_fields = ['FirstName','LastName','LastTouchedby']
>
>         def Picture(self,instance):
>                 return '' %
> (instance.Photo)
>         Picture.allow_tags=True
>
> admin.site.register(TractorRecord,TractorRecordAdmin)

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



Caught KeyError while rendering: u'objects_name'

2011-02-13 Thread Bobby Roberts
when i try to delete one of the TractorRecord objects in this model, i
get this message:

Caught KeyError while rendering: u'objects_name'

any idea what that means?

Django 1.2.3 (mod_wsgi 3.2/Python 2.6)




# this holds possible dispositions for Tractoruees
class Disposition (models.Model):
id = models.AutoField (primary_key=True)
name = models.CharField (max_length=50, blank=False,
db_index=True)
active = models.IntegerField(blank=False,
choices=active_choices)
order = models.IntegerField(blank=True, default=0)

def __unicode__(self):
return self.name

class DispositionAdmin(admin.ModelAdmin):
list_display = ('name','active','order',)
search_fields = ['name']


admin.site.register(Disposition,DispositionAdmin)

#this holds the Tractor information
class TractorRecord (models.Model):
id = models.AutoField (primary_key=True)
FirstName = models.CharField (max_length=25,blank=False,
db_index=True)
LastName = models.CharField (max_length=45,blank=False,
db_index=True)
Status = models.CharField
(choices=inout_choices,max_length=3,blank=False, db_index=True)
Photo= models.ImageField(upload_to="Tractoruees/", blank=True)
Disposition = models.ForeignKey('Disposition',
verbose_name=_('Disposition Value'),db_index=True, blank=False)
Notes = models.TextField(blank=True)
LastTouchedBy = models.ForeignKey(User, unique=False,
db_index=True, blank=False)
LastUpdated = models.DateTimeField
(auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')

def disposition_name(self):
return self.Disposition.name

def Last_Updated_By(self):
return self.LastTouchedBy.get_full_name()

#resize uploaded image to max 650 x 650
def save(self, size=(175,175)):
super(TractorRecord, self).save()
if self.Photo:
filename = self.Photo.path
image = Image.open(filename)
image.thumbnail(size, Image.ANTIALIAS)
image.save(filename)

class TractorRecordAdmin(admin.ModelAdmin):
list_display =
('Picture','FirstName','LastName','Status','disposition_name','Last_Updated_By','LastUpdated')
search_fields = ['FirstName','LastName','LastTouchedby']

def Picture(self,instance):
return '' %
(instance.Photo)
Picture.allow_tags=True

admin.site.register(TractorRecord,TractorRecordAdmin)

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



foreign key help

2011-02-13 Thread Bobby Roberts
class Disposition (models.Model):
id = models.AutoField (primary_key=True)
name = models.CharField (max_length=50, blank=False,
db_index=True)
active = models.IntegerField(blank=False,
choices=active_choices)
order = models.IntegerField(blank=True, default=0)
class DispositionAdmin(admin.ModelAdmin):
list_display = ('name','active','order',)
search_fields = ['name']
admin.site.register(Disposition,DispositionAdmin)

class Record (models.Model):
id = models.AutoField (primary_key=True)
FirstName = models.CharField (max_length=25,blank=False,
db_index=True)
LastName = models.CharField (max_length=45,blank=False,
db_index=True)
Status = models.CharField
(choices=inout_choices,max_length=3,blank=False, db_index=True)
Photo= models.ImageField(upload_to="demo/evacuees/",
blank=True)
Disposition = models.ForeignKey('Disposition',
verbose_name=_('Disposition Value'),db_index=True, blank=False)
Notes = models.TextField(blank=True)
LastTouchedBy = models.ForeignKey(User, unique=False,
db_index=True, blank=False)
LastUpdated = models.DateTimeField
(auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')

def disposition_name(self):
return self.Disposition.name

def Last_Updated_By(self):
return self.LastTouchedBy.get_full_name()



Can you see any reason that the Disposition select box in the Record
Model would be populated witth "Disposition object 1,2,3,4" rather
than Disposition.name?

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



manytomany help

2011-02-07 Thread Bobby Roberts
I've got two models:

class a (models.Model):
id = models.AutoField (primary_key=True)
name = models.CharField (max_length=50, blank=False,
db_index=True)
class aAdmin(admin.ModelAdmin):
list_display = ('name',)
search_fields = ['name']
admin.site.register(a,aAdmin)


class b(models.Model):
id = models.AutoField (primary_key=True)
name = models.CharField (max_length=50, blank=False,
db_index=True)
CommunicationsStatus = models.CharField
(max_length=50,blank=False, db_index=True)
active = models.IntegerField(blank=False,
choices=active_choices)
order = models.IntegerField(blank=True, default=0)
usedby = models.ManyToManyField('a')
class bAdmin(admin.ModelAdmin):
list_display =
('name','active','order','CommunicationsStatus',)
search_fields = ['name']
admin.site.register(b,bAdmin)



Note the usedby field in model b.  when i goto/admin and into that
model, I get the following error:

(1146, "Table 'AppSettings_b_usedby' doesn't exist")


Any idea what the heck that means?  It looks like it's trying to
create a table or something.  when i syncdb there's no action taken on
the database.

-- 
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: model names

2011-02-06 Thread Bobby Roberts
ah... i only had that on he admin model




On Feb 6, 12:07 pm, Ivo Brodien <i...@brodien.de> wrote:
> On 06.02.2011, at 18:01, Bobby Roberts wrote:
>
> > yeah i tried that already and it didn't work
>
> did you also define the meta class for the Admin class?

-- 
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: model names

2011-02-06 Thread Bobby Roberts
yeah i tried that already and it didn't work

On Feb 6, 11:38 am, Joel Goldstick <joel.goldst...@gmail.com> wrote:
> On Sun, Feb 6, 2011 at 11:33 AM, Bobby Roberts <tchend...@gmail.com> wrote:
> > if i have a model name "Facility", django adds an "s" to it in /admin
> > and it shows up as Facilitys.  How can I make it show up as
> > "Facilities" in /admin?
>
> > --
> > 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.
>
> http://docs.djangoproject.com/en/dev/topics/db/models/shows this:
> Meta 
> options¶<http://docs.djangoproject.com/en/dev/topics/db/models/#meta-options>
>
> Give your model metadata by using an inner class Meta, like so:
>
> class Ox(models.Model):
>     horn_length = models.IntegerField()
>
>     class Meta:
>         ordering = ["horn_length"]
>         verbose_name_plural = "oxen"
>
> --
> Joel Goldstick

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



model names

2011-02-06 Thread Bobby Roberts
if i have a model name "Facility", django adds an "s" to it in /admin
and it shows up as Facilitys.  How can I make it show up as
"Facilities" in /admin?

-- 
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: user full name in template

2011-02-03 Thread Bobby Roberts
here's what i'm trying

from django.contrib.auth import authenticate, login, logout
#import django user modules
from django.contrib.auth.models import User

def ShowMainMenu (request):
fullname=User.first_name + ' ' + User.last_name
return render_to_response('scanning/menu.html',
{'fullname':fullname}, context_instance=RequestContext(request))

I'm getting this err:

type object 'User' has no attribute 'first_name'



On Feb 4, 12:15 am, arlolra  wrote:
> user.get_full_name should 
> workhttps://github.com/django/django/blob/master/django/contrib/auth/mode...

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



user full name in template

2011-02-03 Thread Bobby Roberts
is there a template tag to show the user's full name on a template?

-- 
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: foreign key issue

2011-02-03 Thread Bobby Roberts
yeah i changed the related name to see if that would make any
difference... the error baffles me.

On Feb 3, 9:18 am, Tom Evans <tevans...@googlemail.com> wrote:
> On Thu, Feb 3, 2011 at 2:05 PM, Bobby Roberts <tchend...@gmail.com> wrote:
> > here ya go:
>
> >...
> > models.ForeignKey('AppSettings.InventoryOption',
> > verbose_name=_('InvFunction'),
> > related_name='inv_function',blank=False, null=False)
>
> So you already changed it?
>
> I can't reproduce this, even when I change the related_name to how you
> had it before.
>
> Cheers
>
> Tom

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



Re: foreign key issue

2011-02-03 Thread Bobby Roberts
here ya go:


class InventoryOption (models.Model):
id = models.AutoField (primary_key=True)
name = models.CharField (max_length=50, blank=False,
db_index=True)
active = models.IntegerField(blank=False,
choices=active_choices)
order = models.IntegerField(blank=True, default=0)
class InventoryOptionAdmin(admin.ModelAdmin):
list_display = ('name','active','order',)
search_fields = ['name']
admin.site.register(InventoryOption,InventoryOptionAdmin)


class Inventory (models.Model):
id = models.AutoField (primary_key=True)
Barcode = models.IntegerField(blank=False)
Location = models.CharField (max_length=25,blank=False,
db_index=True)
Sku = models.CharField (max_length=25,blank=False,
db_index=True)
Quantity = models.DecimalField (blank=False, max_digits=7,
default=0,decimal_places=2,help_text='Quanity on barcode')
InventoryFunction =
models.ForeignKey('AppSettings.InventoryOption',
verbose_name=_('InvFunction'),
related_name='inv_function',blank=False, null=False)
LastTouchedBy = models.ForeignKey(User, unique=False,
db_index=True, blank=False)
LastUpdated = models.DateTimeField
(auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')

@property
def touched_by_name(self):
return self.LastTouchedBy.get_full_name()

@property
def inventory_option_name(self):
return self.AppSettings.InventoryOption.name

class InventoryAdmin(admin.ModelAdmin):
list_display =
('Barcode','Sku','Location','inventory_option_name','LastUpdated','touched_by_name',)
search_fields = ['Barcode','Location','Sku','LastTouchedBy']
readonly_fields =
['Barcode','Location','Sku','Quantity','InventoryFunction','LastTouchedBy','LastUpdated']
admin.site.register(Inventory,InventoryAdmin)






On Feb 3, 8:59 am, Tom Evans <tevans...@googlemail.com> wrote:
> On Thu, Feb 3, 2011 at 1:32 PM, Bobby Roberts <tchend...@gmail.com> wrote:
> > I'm setting up a foreignkey field in my model as follows:
>
> >        InventoryFunction =
> > models.ForeignKey('AppSettings.InventoryOption',
> > verbose_name=_('InvFunction'), related_name='InvFunction',blank=False,
> > null=False)
>
> > result from syncdb:
>
> > scanning.inventory: Accessor for field 'InventoryFunction' clashes
> > with related field 'InventoryOption.InvFunction'. Add a related_name
> > argument to the definition for 'InventoryFunction'.
> > scanning.inventory: Reverse query name for field 'InventoryFunction'
> > clashes with related field 'InventoryOption.InvFunction'. Add a
> > related_name argument to the definition for 'InventoryFunction'.
> > scanning.inventoryhistory: Accessor for field 'InventoryFunction'
> > clashes with related field 'InventoryOption.InvFunction'. Add a
> > related_name argument to the definition for 'InventoryFunction'.
> > scanning.inventoryhistory: Reverse query name for field
> > 'InventoryFunction' clashes with related field
> > 'InventoryOption.InvFunction'. Add a related_name argument to the
> > definition for 'InventoryFunction'.
>
> > why am i getting these errors when i do have related_name argument
> > setup?
>
> Impossible to tell, since you have omitted half the story. Where is
> the definition of InventoryOption, which apparently already has a
> field called InvFunction?
>
> Cheers
>
> Tom

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



foreign key issue

2011-02-03 Thread Bobby Roberts
I'm setting up a foreignkey field in my model as follows:

InventoryFunction =
models.ForeignKey('AppSettings.InventoryOption',
verbose_name=_('InvFunction'), related_name='InvFunction',blank=False,
null=False)

result from syncdb:


scanning.inventory: Accessor for field 'InventoryFunction' clashes
with related field 'InventoryOption.InvFunction'. Add a related_name
argument to the definition for 'InventoryFunction'.
scanning.inventory: Reverse query name for field 'InventoryFunction'
clashes with related field 'InventoryOption.InvFunction'. Add a
related_name argument to the definition for 'InventoryFunction'.
scanning.inventoryhistory: Accessor for field 'InventoryFunction'
clashes with related field 'InventoryOption.InvFunction'. Add a
related_name argument to the definition for 'InventoryFunction'.
scanning.inventoryhistory: Reverse query name for field
'InventoryFunction' clashes with related field
'InventoryOption.InvFunction'. Add a related_name argument to the
definition for 'InventoryFunction'.


why am i getting these errors when i do have related_name argument
setup?

-- 
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: help with foreign keys in admin

2011-02-03 Thread Bobby Roberts
nevermind... it was a case issue... you know if python knows there's
an error with case  it would just say "hey check the case here"




On Feb 3, 12:31 am, Karl Bowden <karlbow...@gmail.com> wrote:
> On 3 February 2011 16:14, Bobby Roberts <tchend...@gmail.com> wrote:
>
>
>
> > considering this model:
>
> > class Inventory (models.Model):
> >        id = models.AutoField (primary_key=True)
> >        Barcode = models.BigIntegerField(blank=False)
> >        Location = models.CharField (max_length=25,blank=False,
> > db_index=True)
> >        Sku = models.CharField (max_length=25,blank=False,
> > db_index=True)
> >        Quantity = models.DecimalField (blank=False, max_digits=7,
> > default=0,decimal_places=2,help_text='Quanity on barcode')
> >        LastAction = models.ForeignKey('AppSettings.InventoryOption',
> > verbose_name=_('Last Action'), related_name='LastAction',blank=False,
> > null=False)
> >        LastTouchedBy = models.ForeignKey(User, unique=False,
> > db_index=True, blank=False)
> >        LastUpdated = models.DateTimeField
> > (auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')
>
> > class InventoryAdmin(admin.ModelAdmin):
> >        list_display =
> > ('Barcode','Sku','Location','LastAction','LastUpdated','User.first_name',)
> >        search_fields = ['Barcode','Location','Sku','LastTouchedBy']
> >        readonly_fields =
>
> > ['BarCode','Location','Sku','Quantity','LastAction','LastTouchedBy','LastUpdated']
> > admin.site.register(Inventory,InventoryAdmin)
>
> > two questions.
>
> > 1) LastTouchedBy is the userid - what do i need to do to print out the
> > firstname+lastname of the user in the list_display. (ie instead of
> > printing out userid 123, I want to print out the user's full name,
> > "john doe"
>
> 2) LastAction - I'm importing AppSettings model further up the page,> how can 
> I print out the text value of
> > (AppSettings.InventoryOption.name) in place of the numerical value
> > stored in LastAction
>
> Hi Bobby,
> You might be able to do this with python property decorators for both these
> questions.
>
> Ie:
> class Inventory(models.Model):
>     @property
>     def touched_by_name(self):
>         return self.LastTouchedBy.get_full_name()
>
>     @property
>     def inventory_option_name(self):
>         return self.AppSettings.InventoryOption.name
>
> class InventoryAdmin(admin.ModelAdmin):
>     list_display
> = 
> ('Barcode','Sku','Location','LastAction','inventory_option_name','LastUpdated','touched_by_name',)
>
> - Karl
>
>
>
> > rapid help greatly appreciated.
>
> > --
> > 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<django-users%2bunsubscr...@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: help with foreign keys in admin

2011-02-03 Thread Bobby Roberts
i've got that added in and ran a syncdb and i'm stuck on this err:

django.core.exceptions.ImproperlyConfigured:
InventoryAdmin.readonly_fields[0], 'BarCode' is not a callable or an
attribute of 'InventoryAdmin' or found in the model 'Inventory'.

but I'm not seeing anything wrong with my readonly list a in my code.

On Feb 3, 12:31 am, Karl Bowden <karlbow...@gmail.com> wrote:
> On 3 February 2011 16:14, Bobby Roberts <tchend...@gmail.com> wrote:
>
>
>
> > considering this model:
>
> > class Inventory (models.Model):
> >        id = models.AutoField (primary_key=True)
> >        Barcode = models.BigIntegerField(blank=False)
> >        Location = models.CharField (max_length=25,blank=False,
> > db_index=True)
> >        Sku = models.CharField (max_length=25,blank=False,
> > db_index=True)
> >        Quantity = models.DecimalField (blank=False, max_digits=7,
> > default=0,decimal_places=2,help_text='Quanity on barcode')
> >        LastAction = models.ForeignKey('AppSettings.InventoryOption',
> > verbose_name=_('Last Action'), related_name='LastAction',blank=False,
> > null=False)
> >        LastTouchedBy = models.ForeignKey(User, unique=False,
> > db_index=True, blank=False)
> >        LastUpdated = models.DateTimeField
> > (auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')
>
> > class InventoryAdmin(admin.ModelAdmin):
> >        list_display =
> > ('Barcode','Sku','Location','LastAction','LastUpdated','User.first_name',)
> >        search_fields = ['Barcode','Location','Sku','LastTouchedBy']
> >        readonly_fields =
>
> > ['BarCode','Location','Sku','Quantity','LastAction','LastTouchedBy','LastUpdated']
> > admin.site.register(Inventory,InventoryAdmin)
>
> > two questions.
>
> > 1) LastTouchedBy is the userid - what do i need to do to print out the
> > firstname+lastname of the user in the list_display. (ie instead of
> > printing out userid 123, I want to print out the user's full name,
> > "john doe"
>
> 2) LastAction - I'm importing AppSettings model further up the page,> how can 
> I print out the text value of
> > (AppSettings.InventoryOption.name) in place of the numerical value
> > stored in LastAction
>
> Hi Bobby,
> You might be able to do this with python property decorators for both these
> questions.
>
> Ie:
> class Inventory(models.Model):
>     @property
>     def touched_by_name(self):
>         return self.LastTouchedBy.get_full_name()
>
>     @property
>     def inventory_option_name(self):
>         return self.AppSettings.InventoryOption.name
>
> class InventoryAdmin(admin.ModelAdmin):
>     list_display
> = 
> ('Barcode','Sku','Location','LastAction','inventory_option_name','LastUpdated','touched_by_name',)
>
> - Karl
>
>
>
> > rapid help greatly appreciated.
>
> > --
> > 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<django-users%2bunsubscr...@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.



help with foreign keys in admin

2011-02-02 Thread Bobby Roberts
considering this model:

class Inventory (models.Model):
id = models.AutoField (primary_key=True)
Barcode = models.BigIntegerField(blank=False)
Location = models.CharField (max_length=25,blank=False,
db_index=True)
Sku = models.CharField (max_length=25,blank=False,
db_index=True)
Quantity = models.DecimalField (blank=False, max_digits=7,
default=0,decimal_places=2,help_text='Quanity on barcode')
LastAction = models.ForeignKey('AppSettings.InventoryOption',
verbose_name=_('Last Action'), related_name='LastAction',blank=False,
null=False)
LastTouchedBy = models.ForeignKey(User, unique=False,
db_index=True, blank=False)
LastUpdated = models.DateTimeField
(auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')

class InventoryAdmin(admin.ModelAdmin):
list_display =
('Barcode','Sku','Location','LastAction','LastUpdated','User.first_name',)
search_fields = ['Barcode','Location','Sku','LastTouchedBy']
readonly_fields =
['BarCode','Location','Sku','Quantity','LastAction','LastTouchedBy','LastUpdated']
admin.site.register(Inventory,InventoryAdmin)



two questions.

1) LastTouchedBy is the userid - what do i need to do to print out the
firstname+lastname of the user in the list_display. (ie instead of
printing out userid 123, I want to print out the user's full name,
"john doe"

2) LastAction - I'm importing AppSettings model further up the page,
how can I print out the text value of
(AppSettings.InventoryOption.name) in place of the numerical value
stored in LastAction


rapid help greatly appreciated.

-- 
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: listpage question

2011-01-18 Thread Bobby Roberts
does modelb.modelavalue need a FK relationship with modela.id or does
django do this automatically?




On Jan 17, 11:15 pm, Vovk Donets <donets.vladi...@gmail.com> wrote:
> 2011/1/18 Bobby Roberts <tchend...@gmail.com>
>
>
>
> > let's say  i have two simple models
>
> > model a
> > id=IntegerField...
> > description = CharField...
>
> > model b
> > id=IntegerField...
> > modelavalue=IntegerField...   (a value form modela.id)
> > description=CharField...
>
> > ok in the /admin listing page for model B, how can i return
> > modela.description  for modelb.modelavalue
>
> you can do it by inserting "modelAvalue__description" in the admin.py in the
> list_display for modelB model.Admin:
>
> class modelBAdmin(admin.ModelAdmin):
>     list_display = ( 'id','modelAvalue__description', 'description')
> admin.site.register(modelB, modelBAdmin)

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



listpage question

2011-01-17 Thread Bobby Roberts
let's say  i have two simple models


model a
id=IntegerField...
description = CharField...


model b
id=IntegerField...
modelavalue=IntegerField...   (a value form modela.id)
description=CharField...


ok in the /admin listing page for model B, how can i return
modela.description  for modelb.modelavalue

-- 
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: help with django comments

2010-11-07 Thread Bobby Roberts
here's my complete code:

{%if allowcomments%}
{% get_comment_count for
galleryview.GalleryPhoto picid as comment_count %}

{%ifequal comment_count 0%}
Be the first to comment.
{%else%}
{{comment_count}}
comment{%ifnotequal comment_count 1%}s{%endifnotequal%}
{%endifequal%}

{% render_comment_list for
galleryview.GalleryPhoto %}
{% render_comment_form for
galleryview.GalleryPhoto%}

{%else%}
{%endif%}


allowcomments is a field in my model.  am i missing something here?  I
thought it was easy to attach comments to any model.


On Nov 7, 9:41 am, Chris Lawlor <lawlor.ch...@gmail.com> wrote:
> Assuming your app is named 'gallery' with a model named 'photo', I
> believe the call should be:
>
> {% get_comment_count for gallery.photo as comment_count %}
>
> On Nov 6, 5:12 pm, Bobby Roberts <tchend...@gmail.com> wrote:
>
> > howdy -
>
> > i'm trying to use comments on my site as follows:
>
> > {% get_comment_count for galleryphoto as comment_count %}
>
> > this generates the following error:
>
> > Caught AttributeError while rendering: 'str' object has no attribute
> > '_meta'
>
> > any idea what this error means?
>
> > I looked in /admin and under comments and in objects, i see "gallery
> > photo" (with a space).
>
> > when i try to use:
>
> > {% get_comment_count for gallery photo as comment_count %}   <<< note
> > the space in gallery photo
>
> > I get this err:
>
> > Third argument in u'get_comment_count' must be in the format
> > 'app.model'
>
> > any help is appreciated on how to address this issue.

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



help with django comments

2010-11-06 Thread Bobby Roberts
howdy -

i'm trying to use comments on my site as follows:

{% get_comment_count for galleryphoto as comment_count %}


this generates the following error:

Caught AttributeError while rendering: 'str' object has no attribute
'_meta'

any idea what this error means?

I looked in /admin and under comments and in objects, i see "gallery
photo" (with a space).

when i try to use:

{% get_comment_count for gallery photo as comment_count %}   <<< note
the space in gallery photo

I get this err:

Third argument in u'get_comment_count' must be in the format
'app.model'


any help is appreciated on how to address this issue.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



/admin list help ASAP

2010-10-20 Thread Bobby Roberts
hi all.  I have two models setup let's call them

Gallery
Photos

photos has a field as such:

GalleryId = models.ForeignKey('Gallery', verbose_name=_('Gallery Id'),
related_name='Gallery_Id',blank=False, null=False, help_text=_("Please
choose the gallery to which you wish to associate this photo."))

Ok now here's the question.

In the listing page for my photos, I want to print Gallery.Title

the two models are related on Photos.GalleryId=Gallery.Id

How do I return Gallery title in the listing page in /admin?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



facebook comments tutorial?

2010-10-03 Thread Bobby Roberts
has anyone gotten the facebook comments plugin to actually post
comments back to facebook?  can you provide instructions on how to do
this?  I've got the plugin working fine on the page but comments never
post back to facebook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Facebook Comments

2010-10-03 Thread Bobby Roberts
what's the purpose of the "post back to profile" checkbox on the
facebook comments plugin if it's not supposed to post back to
facebook?





On Sep 11, 6:10 pm, Sævar Öfjörð <saeva...@gmail.com> wrote:
> Where exactly are you expecting them to be posted?
> I think theFacebookCommentsplugin is only supposed to provide a
> comment feature on individual pages so that you don't have to write
> your own, it's not an external comment box for your FB page.
>
> - Sævar
>
> On Sep 10, 5:41 pm, Bobby Roberts <tchend...@gmail.com> wrote:
>
> > hi i know that this isn't a django related question, but i'm using
> >Facebook'scomment plugin and am having a strange issue.  I've got it
> > installed and you can postcommentsfine but they never get uploaded
> > tofacebook.  Is there something you have to do to get them to post
> > over tofacebook(other than checking the box to do so)?  Has anyone
> > else had this issue?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



sql query: how to

2010-09-26 Thread Bobby Roberts
what is the most efficient way to do the following sql command in
django?


select distinct fieldname from table order by fieldname

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



  1   2   3   4   >