Re: attempt to write a readonly database

2020-12-23 Thread Bryan Anderson bautista garcia
hello, I don't know who you are, you're the wrong person

El mié, 23 de dic. de 2020 a la(s) 11:19, Parul. (parul.281...@gmail.com)
escribió:

> OperationalError at /users/
> Request Method: POST
> Request URL: http://localhost:8000/users/
> Django Version: 3.0.3
> Exception Type: OperationalError
> Exception Value:
>
> attempt to write a readonly database
>
> Exception Location: 
> C:\Users\parul\anaconda\envs\MyDjangoEnv\lib\site-packages\django\db\backends\sqlite3\base.py
> in execute, line 396
> Python Executable: C:\Users\parul\anaconda\envs\MyDjangoEnv\python.exe
> Python Version: 3.8.5
> Python Path:
>
> ['C:\\Users\\parul\\Desktop\\Djangoforms\\ProTwo',
>  'C:\\Users\\parul\\anaconda\\envs\\MyDjangoEnv\\python38.zip',
>  'C:\\Users\\parul\\anaconda\\envs\\MyDjangoEnv\\DLLs',
>  'C:\\Users\\parul\\anaconda\\envs\\MyDjangoEnv\\lib',
>  'C:\\Users\\parul\\anaconda\\envs\\MyDjangoEnv',
>  'C:\\Users\\parul\\anaconda\\envs\\MyDjangoEnv\\lib\\site-packages']
>
> Server time: Wed, 23 Dec 2020 16:14:46 +
>
>
>
> ->>> Also, i checked the properties in db.sqlite3, all the
> permissions are checked...write permission also
> can anyone help
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHjHRFoBMq5VCKnBPiCEgSrLvZ7P0vvwd5Ah-_cDOv8kX1oKhg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACs2VvYWAkaOpcVAVTm5TKVixq%2BuUhejD-1ejUaVGrK1V31oUQ%40mail.gmail.com.


Re: Python Django Training

2020-02-02 Thread Bryan Maxx
Hello, I am interested in learning Python with you.

On Sat, Feb 1, 2020, 4:42 PM Srikanth K  wrote:

> Hi,
>
> I am from Hyderabad. I am Python Developer by Profession. I am eager take
> up any Python , Django Training (online Preferrable or Weekends). Members
> who require can contact me or share me  there idea.
>
> Regards,
> Srikanth.K
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACPyz-gXb7wo9E0Uhs_pnxF9X52uA10__Fq1xt4trjXUaN3ehQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKHMJxqXpEHjMMP9owLmRVTT%3DPEyWOpZK-T5z998p%2BR22RzB%3DQ%40mail.gmail.com.


Request for an internship

2020-01-08 Thread Bryan Maxx
I'm looking for an internship in the field of ICT,IT,MEDICINE, and PHYSICS.
Incase you can offer or know of one, kindly inform me. Thank you.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKHMJxqsoiEBApTE9vi65SDifZpU_vw%2BAz7j1EjzCGovJp8zUw%40mail.gmail.com.


New to Django, Tutiorial01 not working,

2018-03-29 Thread Bryan Zimmer
Hello all,

I managed to get Django and mod_wsgi installed OK. I then followed through 
with tutorial01, but even though I tried it twice, on two different 
machines, I have come up blank.

This is the output I am getting for the first cut of Tutorial 01.

I am using Django 2.0.3 with python3.6 and mod_wsgi. 4.6.3:

Page not found (404) 
Request Method: GET 
Request URL: http://localhost:8000/ 

Using the URLconf defined in pollapp.urls, Django tried these URL patterns, 
in this order: 

   1. polls/ 
   2. admin/ 

The empty path didn't match any of these. 

You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page. 


Here is my pollap.urls:

--

$ cat urls.py


"""pollapp URL Configuration

The `urlpatterns` list routes URLs to views. For more information please 
see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import:  from my_app import views
2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
1. Add an import:  from other_app.views import Home
2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('polls/',include('polls.urls')),
path('admin/', admin.site.urls),
]
---
The other relevant files, which I edited myself, following along with 
Tutorial01 are included as attachments.


I have scoped and squinted, and it still looks to me as though I didn't 
make any mistakes in editing the source code. 

If I missed something, I'll be embarrassed, but I think I followed the 
instructions entirely the way they were written.


-- 
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/2bf99879-93ea-41cd-ae3a-d7b894fcd9d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from django.urls import path
from . import views


urlpatterns = [
path('', views.index, name='index')
]

from django.shortcuts import render
from django.http import HttpResponse

# Create your views here.


def index(request):
return HttpResponse("Hello, world. You're at the polls index.")



Re: Sudden appearance of DatabaseWrapper Exception

2015-08-21 Thread Bryan Scott
I've come across a similar problem, and I'm pretty curious if you ever 
figured out what caused this for you.  Any help is appreciated.

Thanks
Bryan



On Sunday, April 6, 2014 at 1:02:20 AM UTC-4, Fraser Graham wrote:
>
> I have been running an Django 1.5.1 app under Apache for some time without 
> issue. Today, without any changes to the server I started seeing 500 Errors 
> caused by an Exception in DatabaseWrapper relating to threading, I have no 
> threading behavior in my code so this confuses me. The error affects all 
> routes, although intermittently, roughly every 10th access or so hit this 
> problem. It seems to trigger on first contact with the Database (Postgres 
> 9.2 running on another machine)
>
> Some tracebacks don't touch any of my own code. I restarted Apache and it 
> made no difference, then I stopped Apache completely and started it again, 
> now I am no longer seeing the error. However i'd like to understand why 
> this happened and prevent it from happening again.
>
> Any suggestions on what may have caused this?
>
> Thanks,
> Fraser Graham
>
> An example traceback from one of the API calls:
>
> Traceback (most recent call last):
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/tastypie/resources.py",
>  
> line 217, in wrapper
>response = callback(request, *args, **kwargs)
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/tastypie/resources.py",
>  
> line 468, in dispatch_detail
>return self.dispatch('detail', request, **kwargs)
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/tastypie/resources.py",
>  
> line 486, in dispatch
>self.is_authenticated(request)
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/tastypie/resources.py",
>  
> line 569, in is_authenticated
>auth_result = self._meta.authentication.is_authenticated(request)
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/tastypie/authentication.py",
>  
> line 490, in is_authenticated
>check = backend.is_authenticated(request, **kwargs)
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/tastypie/authentication.py",
>  
> line 194, in is_authenticated
>user = User.objects.get(**lookup_kwargs)
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/django/db/models/manager.py",
>  
> line 143, in get
>return self.get_query_set().get(*args, **kwargs)
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 382, in get
>num = len(clone)
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 90, in __len__
>self._result_cache = list(self.iterator())
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 301, in iterator
>for row in compiler.results_iter():
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
>  
> line 775, in results_iter
>for rows in self.execute_sql(MULTI):
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
>  
> line 839, in execute_sql
>cursor = self.connection.cursor()
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/django/db/backends/__init__.py",
>  
> line 321, in cursor
>self.validate_thread_sharing()
>
>  File 
> "/home/bats/.virtualenvs/bats/lib/python2.7/site-packages/django/db/backends/__init__.py",
>  
> line 154, in validate_thread_sharing
>% (self.alias, self._thread_ident, thread.get_ident()))
>
> DatabaseError: DatabaseWrapper objects created in a thread can only be 
> used in that same thread. The object with alias 'default' was created in 
> thread id 140625758729984 and this is thread id 140625691588352.
>

-- 
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/c478117f-5cb0-4c44-9116-6dfbefcc2ad1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django server serving cached template pages

2015-03-08 Thread Bryan Arguello
I am on the second page of the blog tutorial and am trying to change the 
base-site.html template.  

I make a few small changes, set the permissions to 755, put it in
a subdirectory named 'admin' within a directory called 'template' inside of 
the project directory.  

I also add the template directory path to the TEMPLATE_DIRS variable
in settings.py and restart the server.  

After several hours of trying things suggested in different forums on this 
topic, I decided to just rename the original base_site.html in 
django/contrib/admin/templates/admin and create a blank "blank_site.html".  

After doing this, one would expect to get a blank page if the templates in 
TEMPLATE_DIRS were not found.  However, I am getting the same "Django 
administration" page.  Also, I did go into the manage.py shell and check 
TEMPLATE_DIRS: it is set to the correct directory.  I am starting to think 
this is some kind of Django server cache issue (tried clearing browser 
cache).

I can see that many new-comers to Django have come across this issue and 
none of the suggestions for these users seem to work.  However, I have 
never seen anyone mention a cache being the issue.  Does anyone have any 
suggestions?

-- 
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/1d2b3be2-2dd6-48fa-804c-17e1b83969f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2015-03-08 Thread Bryan Arguello
Have you solved this problem, Andreas?  I am having the same issue and have 
done
everything that the tutorial described as well as everything that people on 
this thread
have suggested.

On Sunday, November 16, 2014 at 12:15:59 PM UTC-6, Andreas Ka wrote:
>
> I am working through 
> https://docs.djangoproject.com/en/1.7/intro/tutorial02
> so far all went fine - but now *templates changes just don't work.*
>
>
>
> I think there must be a flaw in that tutorial, something missing,
> or something different in django 1.7.1 ?
>
> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-the-admin-look-and-feel
>
>
> my versions:
>
> python -c "import django; print(django.get_version())"
> 1.7.1
>
> python --version
> Python 2.7.3
>
>
>
> *SYMPTOM:*
>
> my changes in 
> mysite/templates/admin/base_site.html   
> are simply ignored.
>
>
>
> These are my files:
>
> mysite# tree
> .
> ├── db.sqlite3
> ├── manage.py
> ├── mysite
> │   ├── __init__.py
> │   ├── settings.py
> │   ├── urls.py
> │   └── wsgi.py
> ├── polls
> │   ├── admin.py
> │   ├── __init__.py
> │   ├── migrations
> │   │   ├── 0001_initial.py
> │   │   └── __init__.py
> │   ├── models.py
> │   ├── tests.py
> │   └── views.py
> └── templates
> └── admin
> └── base_site.html
>
>
>
> mysite/settings.py:
>
> TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
>
>
> *Whatever I do, the page*
> *http://myserver:8000/admin/polls/question/ 
> *
> *still keeps the old title 'Django administration'*
>
>
> I want to understand how templates work, because I need them for my real 
> project.
>
> Thanks a lot!
>
>
>

-- 
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/08951132-a2be-4b62-be81-22d4af9e11d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Apache with mod_wsgi not serving static files

2014-02-21 Thread Bryan P
Hello all,

My Django application is not serving my static files (CSS, JS) and keeps 
returning a 404 error. I have set the STATIC_ROOT to the location where I 
collected all my static files with manage.py and set an alias in my 
VirtualHost. 


Here is my Settings.py

Here is my VirtualHost file

Here is the 404 file




and the url it's trying to retrieve them from i

fixtracker.com/static/BugFixTracker/main.css


This is running in production with debug set to False, so it shouldn't be 
relying on Django to distribute the files. Any help is much appreciated. 

-- 
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/d1a06619-f388-4b7f-a687-36e4d2fcbd6f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New to Django

2013-10-15 Thread Bryan Kim Artificio
HI,

good day!

i would like to know id there's a way to connect the postgresSQL with 
django?

regards,

On Tuesday, October 15, 2013 1:55:01 PM UTC+8, Mahantesh U wrote:
>
> Hi All,
>
>   I am new to Django framework. I worked on Flask framework using python. 
> Please share the sites to learn Django easily.
>
> Thanks
> Mahantesh
>

-- 
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/d6099d99-2967-4686-b20a-7be9d2257327%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How can Selenium see a record that I can't find from a debugger?

2012-07-02 Thread Bryan
I'm still stuck regarding how to delete a user from the database directly.

On Tuesday, June 26, 2012 9:59:09 AM UTC-4, Bryan wrote:
>
> I am creating Selenium tests for my App.
> I can create a new user, but I can't seem to figure out how to have it 
> deleted from the database.
>
> After the tests run successfully the first time, subsequent tests fail 
> because the username already exists.
>
> **Why am I not able to query the newly created record in the debugger 
> despite being able to see the new record on the page?**  
>
> **How do I delete a record from the database in a test?**
>
> This is what I have been doing:  
>
> from selenium import webdriver  
> from django.utils import unittest  
> from forum.models import Question, Answer, User  
>   
> class TestOSQAAuthentication(unittest.TestCase):  
> scheme = 'http'  
> host = 'localhost'  
> port = ''  
>  
> def setUp(self):  
> self._driver = webdriver.Firefox()  
> self._driver.implicitly_wait(25)  
>   
>   
> def test_anon_can_create_new_account_manually(self):  
> self._driver.get('
> http://localhost:8000/account/local/register/')  
> 
> self._driver.find_element_by_id('id_username').send_keys('MrManual')  
> self._driver.find_element_by_id('id_email').send_keys('
> t...@gmail.com')  
> 
> self._driver.find_element_by_id('id_password1').send_keys('test')  
> 
> self._driver.find_element_by_id('id_password2').send_keys('test')  
> self._driver.find_element_by_id('bnewaccount').click()   
> # verify MrManual was created  
> self._driver.get('http://localhost:8000/users/')  
> self._driver.find_element_by_link_text('MrManual')  
> # MrManual seems to be created, but I don't see MrManual in 
> the database during debugging with:  
> # import ipdb; ipdb.set_trace()  
> #ipdb> User.objects.all()  
> #[, , ]  
> # here I am trying to delete the user from the database 
> directly.
> User.objects.filter(username="MrManual").delete()  
> """For some reason I can't delete the record from the database 
> from the test.  
> Selenium can find the new user in the browser, but I can't 
> query the database to find it."""
>

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



How can Selenium see a record that I can't find from a debugger?

2012-06-26 Thread Bryan
I am creating Selenium tests for my App.
I can create a new user, but I can't seem to figure out how to have it 
deleted from the database.

After the tests run successfully the first time, subsequent tests fail 
because the username already exists.

**Why am I not able to query the newly created record in the debugger 
despite being able to see the new record on the page?**  

**How do I delete a record from the database in a test?**

This is what I have been doing:  

from selenium import webdriver  
from django.utils import unittest  
from forum.models import Question, Answer, User  
  
class TestOSQAAuthentication(unittest.TestCase):  
scheme = 'http'  
host = 'localhost'  
port = ''  
 
def setUp(self):  
self._driver = webdriver.Firefox()  
self._driver.implicitly_wait(25)  
  
  
def test_anon_can_create_new_account_manually(self):  

self._driver.get('http://localhost:8000/account/local/register/')  

self._driver.find_element_by_id('id_username').send_keys('MrManual')  

self._driver.find_element_by_id('id_email').send_keys('t...@gmail.com')  

self._driver.find_element_by_id('id_password1').send_keys('test')  

self._driver.find_element_by_id('id_password2').send_keys('test')  
self._driver.find_element_by_id('bnewaccount').click()   
# verify MrManual was created  
self._driver.get('http://localhost:8000/users/')  
self._driver.find_element_by_link_text('MrManual')  
# MrManual seems to be created, but I don't see MrManual in the 
database during debugging with:  
# import ipdb; ipdb.set_trace()  
#ipdb> User.objects.all()  
#[, , ]  
# here I am trying to delete the user from the database 
directly.
User.objects.filter(username="MrManual").delete()  
"""For some reason I can't delete the record from the database 
from the test.  
Selenium can find the new user in the browser, but I can't 
query the database to find it."""

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



What is the simplest way to install MySQL-python on Lion 10.7 with Xcode 4.3?

2012-02-27 Thread Bryan
I am setting up Python and Django on os X 10.7 from a virgin install
and Xcode 4.3.

I tried using the default install of Python:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/

$ sudo easy_install MySQL-python
Searching for MySQL-python
Reading http://pypi.python.org/simple/MySQL-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading 
http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/
easy_install-da_8kh/MySQL-python-1.2.3/egg-dist-tmp-CA6FMW
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:329:1: warning: "SIZEOF_SIZE_T"
redefined
In file included from /System/Library/Frameworks/Python.framework/
Versions/2.7/include/python2.7/Python.h:9,
 from pymemcompat.h:10,
 from _mysql.c:29:
/System/Library/Frameworks/Python.framework/Versions/2.7/include/
python2.7/pymacconfig.h:43:1: warning: this is the location of the
previous definition
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:422:1: warning: "HAVE_WCSCOLL"
redefined
In file included from /System/Library/Frameworks/Python.framework/
Versions/2.7/include/python2.7/Python.h:8,
 from pymemcompat.h:10,
 from _mysql.c:29:
/System/Library/Frameworks/Python.framework/Versions/2.7/include/
python2.7/pyconfig.h:891:1: warning: this is the location of the
previous definition
_mysql.c: In function ‘_mysql_server_init’:
_mysql.c:253: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c:278: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c: In function ‘_mysql_ResultObject_Initialize’:
_mysql.c:405: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c: In function ‘_mysql_escape_string’:
_mysql.c:986: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c:988: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c: In function ‘_mysql_string_literal’:
_mysql.c:1016: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c:1025: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c:1027: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c: In function ‘_mysql_escape_sequence’:
_mysql.c:: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c: In function ‘_mysql_row_to_dict’:
_mysql.c:1298: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c:1300: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c: In function ‘_mysql_row_to_dict_old’:
_mysql.c:1336: warning: implicit conversion shortens 64-bit value into
a 32-bit value
_mysql.c:1338: warning: implicit conversion shortens 64-bit value into
a 32-bit value
zip_safe flag not set; analyzing archive contents...
Adding MySQL-python 1.2.3 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-
macosx-10.7-intel.egg
Processing dependencies for MySQL-python
Finished processing dependencies for MySQL-python
#

When I tried to run the server, I got the following Traceback:
Traceback (most recent call last):
  File "/Users/Bryan/work/osqa/forum_modules/mysqlfulltext/
__init__.py", line 8, in 
import MySQLdb
  File "build/bdist.macosx-10.7-intel/egg/MySQLdb/__init__.py", line
19, in 
  File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 7, in

  File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 6, in
__bootstrap__
ImportError: dlopen(/Users/Bryan/.python-eggs/MySQL_python-1.2.3-py2.7-
macosx-10.7-intel.egg-tmp/_mysql.so, 2): Library not loaded:
libmysqlclient.18.dylib
  Referenced from: /Users/Bryan/.python-eggs/MySQL_python-1.2.3-py2.7-
macosx-10.7-intel.egg-tmp/_mysql.so
  Reason: image not found
Traceback (most recent call last):
  File "/Users/Bryan/work/osqa/forum_modules/mysqlfulltext/
__init__.py", line 8, in 
import MySQLdb
  File "build/bdist.macosx-10.7-intel/egg/MySQLdb/__init__.py", line
19, in 
  File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 7, in

  File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 6, in
__bootstrap__
ImportError: dlopen(/Users/Bryan/.python-eggs/MySQL_python-1.2.3-py2.7-
macosx-10.7-intel.egg-tmp/_mysql.so, 2): Library not loaded:
libmysqlclient.18.dylib
  Referenced from: /Users/Bryan/.python-eggs/MySQL_python-1.2.3-py2.7-
macosx-10.7-intel.egg-tmp

Re: Alternatives to celery

2012-01-16 Thread bryan hunt
Gearman only supports a MySql backend for persistent queues - it
doesn't support a real message queue like Rabbitmq.



On Jan 16, 10:33 am, Cherian Thomas  wrote:
> Second Arun’s suggestion on gearman. Pretty solid too.
>
> Regards,
> Cherian
>
>
>
>
>
>
>
> On Mon, Jan 16, 2012 at 3:52 PM, Alec Taylor  wrote:
> > Looking for an alternative to celery? — Have you considered carrot?
>
> > :P
>
> > --
> > 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: What server configuration should I use for a Django site like this?

2011-11-30 Thread bryan hunt
Build it on 512 Linode, upgrade to 1024 if necessary. Linode are so
far ahead of the competition Price/Performance ratio, I wouldn't
bother with anyone else (VPS).

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



Re: How to use CreateView?

2011-05-09 Thread Bryan L


You need to specify "action"... what was the URI for the get form? The
action should be the same.



On Mar 11, 2:41 pm, hassan  wrote:
> Hi,
>
> I am testing django 1.3 class based generic views. I have a model like
> this one:
>
> class Book(models.Model):
>     name = models.CharField(max_length=50)
>     author = models.CharField(max_length=50)
>
> and in views.py:
>
> class BookUpdateView(CreateView):
>     model = Book
>     template_name = "create_book.html"
>
> and in create_book.html
> 
> ...
> 
> 
>
> But when i press the save button it form it does nothing!
> What's wrong with me?

-- 
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 with manytomany field

2011-05-03 Thread Bryan
"Maybe what I need is something like OneToMany relationship"
You need a ManyToMany field: multiple people may have worked for the
same company previously, correct?

As for your original question, I would make a ModelForm for your
Person model (or whatever it is) and another one for your Company
model and then use a formset to allow them to enter the companies
they've worked for. This should get part of the way there:
http://docs.djangoproject.com/en/1.3/topics/forms/formsets/#using-more-than-one-formset-in-a-view

Hope that helps.

On May 2, 6:37 pm, Daniel França  wrote:
> anyone?
> Maybe what I need is something like OneToMany relationship, i guess, but
> there's no such thing in django
>
> 2011/5/2 Daniel França > Hi all,
> > I'm trying to create a form from a model with ManyToManyField,
> > I want something like this: You fill some fields from the referenced table
> > and you click at 'Add' and this appears at a table below the fields, so when
> > I click
> > "Save" all the added items save (includind the new manytomany items)
>
> > Example:
>
> > *Name [                              ]*
> > *Email [                              ]*
>
> > *Add Companys you've Worked for:*
> > *Company [                               ]  Telephone [
> >              ]   (ADD Button)*
> > *
> > --- 
> > -
> > *
> > *Company                    Telephone*
> > *Company XYZ              555 0123*
> > *Company ABC              123 4567*
> > *
> > *
> > *(Save Form Button)*
> > *
> > *
>
> > I hope you can understand this... there's some easy way to implement this
> > using Django?
>
> > Best Regards,
> > Daniel França

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



Upgrade to Django-1.3 seeing AttributeError: 'NoneType' object has no attribute '_info'

2011-04-27 Thread Bryan
I just downloaded and installed Django 1.3, I can't seem to run the
console or server with this error:

AttributeError: 'NoneType' object has no attribute '_inf


$ python manage.py shell
Traceback (most recent call last):
  File "manage.py", line 13, in 
execute_manager(settings)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/
__init__.py", line 438, in execute_manager
utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/
__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/
base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/
base.py", line 209, in execute
translation.activate('en-us')
  File "/usr/local/lib/python2.7/site-packages/django/utils/
translation/__init__.py", line 100, in activate
return _trans.activate(language)
  File "/usr/local/lib/python2.7/site-packages/django/utils/
translation/trans_real.py", line 202, in activate
_active.value = translation(language)
  File "/usr/local/lib/python2.7/site-packages/django/utils/
translation/trans_real.py", line 186, in translation
current_translation = _fetch(language,
fallback=default_translation)
  File "/usr/local/lib/python2.7/site-packages/django/utils/
translation/trans_real.py", line 149, in _fetch
res._info = res._info.copy()
AttributeError: 'NoneType' object has no attribute '_info'

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



Re: how does this not work????

2011-04-07 Thread Bryan Reed

On 04/07/2011 11:50 AM, MikeKJ wrote:

  45 try:
  46 checkview =
UserAccount.objects.all().filter(user_id=check.id).filter(video_id=pid).order_by('-datestamp',)[0]
  47 except UserAccount.DoesNotExist:
  48 checkview = None

and I get list index out of range on line 46, the whole point of the try
except is I expect the queryset to not evaluate


I think you're confusing filter and get.

   UserAccount.objects.get(user_id=check.id)

will raise a DoesNotExist if the user_id matching check.id is not found.

   UserAccount.objects.filter(user_id=check.id)

will return an empty queryset.

So as you expect,  your not finding anything with your query.  It's 
returning and empty queryset and  slicing it is causing the index out of 
range.


--
Bryan K. Reed  bkr...@hackboy.com
'And sanity is really just a one trick pony, anyway.  I mean, all you
 get is one trick, RATIONAL THINKING!  But when you're good and crazy,
 the sky's the limit!'   -- The TICK

--
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: Authentication system

2011-04-04 Thread Bryan
http://docs.djangoproject.com/en/1.3/topics/auth/#limiting-access-to-logged-in-users

You can either put the @log_required decorator on each of the views
you want protected, or you can do it the raw way (see link), which may
offer more flexibility.

On Apr 4, 5:22 am, GOUTAM KUMAR RANA  wrote:
> How to port authentication system to every page so that only logged in
> will able to view the pages or else it shall redirect to the login
> page giving error that user should be logged in first.
>
> for a custom project is the djangos admin used for login features or
> we can have our own.
> please help me if there is a different custom auth system

-- 
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: validate_unique not checking parents of parents' fields?

2011-04-02 Thread Bryan
Ah perfect thanks! I looked to see if something had been submitted,
but couldn't find it.

On Apr 2, 3:26 pm, Karen Tracey  wrote:
> On Sat, Apr 2, 2011 at 4:37 PM, Bryan  wrote:
> > Is this a bug?
>
> Yes:http://code.djangoproject.com/ticket/15321
>
> Karen
> --http://tracey.org/kmt/

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



validate_unique not checking parents of parents' fields?

2011-04-02 Thread Bryan
As far as I can tell, if one has three models, GrandparentModel,
ParentModel, and ChildModel, in which GrandparentModel defines a
unique field unique_field, Childmodel.validate_unique() will not check
the uniqueness of unique_field.

The fields to check are determined by ChildModel._get_unique_checks(),
which looks at ChildModel._meta.local_fields and then looks at each of
ChildModel's parent models' local fields (namely
ParentModel._meta.local_fields). But
GrandparentModel._meta.local_fields doesn't appear to be checked.
Since unique_field only appears in
GrandparentModel._meta.local_fields, it is left out of the check.

The code in question is: 
http://code.djangoproject.com/browser/django/trunk/django/db/models/base.py#L648

Am I reading this correctly? I could very much be wrong. In the app
I'm currently working, I verified that the analogue of unique_field is
not returned by ChildModel._get_unique_check(), though there's a
chance something else is going wrong. I know the field is returned by
both ParentModel._get_unique_check() and
GrandparentModel._get_unique_check(). In my case, full_clean()
succeeds when testing field duplication, but save() fails with:

IntegrityError: column unique_field is not unique

Is this a bug?

Thanks!

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



Extending UserManager and PAM-based authentication

2010-11-04 Thread Bryan Bishop
Hey all,

I am trying to implement PAM-based authentication in django. I am
using the dpam (django-pam) module which provides an entry for
AUTHENTICATION_BACKENDS in settings.py, but I don't have to be using
this. Anyway, I would like to fix django.contrib.auth.models.User so
that create_user & friends actually create_user via PAM as well.

My first guess is that I should be extending UserManager or User. How
do I go about doing this? I would prefer to make modifications that
stay in my webapp's directory, instead of editing the actual
UserManager class.

Any ideas?

Thank you,

- Bryan
http://heybryan.org/
1 512 203 0507

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



Using all project URLs when using TestCase.urls?

2010-08-20 Thread Bryan
I've been trying to add the django-lean app to my project.

I have not been able to get the tests to pass because of
NoReverseMatch errors for named urls defined in other apps.

It seems the issue is that the TestCase defines a value for urls:

 urls = 'django_lean.experiments.tests.urls'

As best as I can tell, the tests are only getting the urls located @
'django_lean.experiments.tests.urls', but not
the urls from the rest of the project.

This is causing error messages like:

NoReverseMatch: Reverse for 'index' with arguments '()' and
keyword arguments '{}' not found.

These are triggered by {% url %} template tags in the project.

How can I make sure that the all the urls of the project are available
for the tests?

I'm running Python 2.7 with Django 1.2.1

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



URL template tags fail in Tests but work in Dev and Production ( Django 1.2.1 )

2010-08-17 Thread Bryan
I've been trying to add the django-lean app to my project.

I have not been able to get the tests to pass. It took me a few days
with a debugger to determine what the problem was.

It seems that all the URL template tags fail in Test mode, but not in
Production nor Developement.

Failure happens is in django.template.defaulttags.URLNode.render()
line 366:
url = reverse(self.view_name, args=args, kwargs=kwargs,
current_app=context.current_app)

The error message is:
NoReverseMatch: Reverse for 'index' with arguments '()' and keyword
arguments '{}' not found.

If I replace the URL template tag with a relative link, the test just
fails the next time a URL node is encountered.

I have confirmed that:
reverse('index') call works in the shell.

What could be going wrong?

I'm running Python 2.7 with Django 1.2.1

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



How can reverse('opensearch') work in the shell, but fail in a Test?

2010-08-13 Thread Bryan
I'm trying to install django-lean into my application.

Open search is used in my app App.

I can reverse('opensearch') in the Python shell. However, in the test,
reverse('opensearch') * NoReverseMatch: Reverse for 'opensearch' with
arguments '()' and keyword arguments

In [47]: reverse('opensearch')
Out[47]: '/opensearch.xml'
In [48]: response = client.get('/opensearch.xml')
In [49]: response.status_code
Out[49]: 200

This is an attempt to do the same from the Test, stopped by
pdb.set_trace()

No fixtures found.
> /usr/local/lib/python2.7/site-packages/django_lean-0.15-
py2.7.egg/django_lean/experiments/tests/
test_tags.py(72)doTestIntegration()
-> response = client.get("confirm_human") # this is where the
Client can't find the url
(Pdb) reverse('opensearch')
*** NoReverseMatch: Reverse for 'opensearch' with arguments '()'
and keyword arguments '{}' not found.

Here is the code from urls.py:

url(r'^opensearch\.xml$', app.meta.opensearch, name='opensearch'),

Finally, here is the traceroute for the failing test:

 
==
ERROR: testIntegrationWithRegisteredUser
(django_lean.experiments.tests.test_tags.ExperimentTagsTest)
 
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/django_lean-0.15-
py2.7.egg/django_lean/experiments/tests/test_tags.py", line 55, in
testIntegrationWithRegisteredUser
client_factory=create_registered_user_client)
  File "/usr/local/lib/python2.7/site-packages/django_lean-0.15-
py2.7.egg/django_lean/experiments/tests/test_tags.py", line 71, in
doTestIntegration
response = client.get(confirm_human_url)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/test/client.py", line 290, in get
response = self.request(**r)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/test/client.py", line 230, in request
response = self.handler(environ)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/test/client.py", line 74, in __call__
response = self.get_response(request)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/core/handlers/base.py", line 142, in get_response
return self.handle_uncaught_exception(request, resolver,
exc_info)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/core/handlers/base.py", line 181, in
handle_uncaught_exception
return callback(request, **param_dict)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/views/defaults.py", line 24, in server_error
return http.HttpResponseServerError(t.render(Context({})))
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/template/__init__.py", line 173, in render
return self._render(context)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/test/utils.py", line 29, in instrumented_test_render
return self.nodelist.render(context)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/template/__init__.py", line 796, in render
bits.append(self.render_node(node, context))
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/template/__init__.py", line 809, in render_node
return node.render(context)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/template/loader_tags.py", line 125, in render
return compiled_parent._render(context)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/test/utils.py", line 29, in instrumented_test_render
return self.nodelist.render(context)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/template/__init__.py", line 796, in render
bits.append(self.render_node(node, context))
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/template/__init__.py", line 809, in render_node
return node.render(context)
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-
py2.7.egg/django/template/defaulttags.py", line 378, in render
raise e
NoReverseMatch: Reverse for 'opensearch' with arguments '()' and
keyword arguments '{}' not found.

 
--
Ran 1 test in 1736.834s


Finally, here is the test: class ExperimentTagsTest(TestCase): urls =
'django_lean.experiments.tests.urls'

def setUp(self):
self.experiment = Experiment(name="test_experiment")
self.experiment.save()
self.experiment.state = Experiment.ENABLED_STATE
self.experiment.save()

self.other_experiment = Experiment(name="other_test_experiment")
self.other_experiment.save()
s

Help with Formset (I think it is formset I need)

2010-06-20 Thread Bryan A
Hello:

I am trying to create a form with a check box list for Tags associated
with an Appointment.

Form:
Please list tags for this Appoingmen _ Work
 _ School
 _ Other

I need to design this so users can add additional tags later.

Appoitnemts and Tags are M2M related:

class Appointment(models.Model):
name=   models.CharField(max_length=64)

class Tag(models.Model):
name=   models.CharField(max_length=64, unique=True)
appointments=   models.ManyToManyField(Appointment)

My Forms Class:

class TagForm(forms.Model.Form):
tags=   
forms.ModelMultipleChoiceField(queryset=Tag.objects.all(),

widget=forms.CheckboxSelectMultiple() )

class Meta:
model = Tag

In my view I have also tried:

TagFormSet  =   modelformset_factory(Tag, form=TagForm)
tag_form = Tag  =  TagFormSet(query =
Tag.object.all())

This looks right when the form is displayed, exepct the form is
duplicated once for each Tag in my Db, and clearly this is not pulling
or saving to the Db correctly.

I have looked through the Django documentation, but cannot figure out
how to implement the formset correctly (I think it is a formset I need
here).

Any help would be greatly appreciated.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Django v1.2 TestCase doesn't seem to load fixtures except 'initial_data'

2010-05-27 Thread Bryan
I just checked this again.

I changed the fixtures name to:

$ ls forum/fixtures
forum_fixtures.json

class UserProfileTestCases(TestCase):
"""These are tests to verify that refactoring of UserProfile is
correct"""
fixtures = ['forum_fixtures.json']

$ python manage.py test
Creating test database 'default'...
<>
No fixtures found.

I don't know why this is happening, but it is. :-(

Bryan

On May 27, 8:33 am, Karen Tracey  wrote:
> On Wed, May 26, 2010 at 4:28 PM, Bryan  wrote:
> > I am using Django v1.2
>
> > The fixture I defined "forum_fixtures.json" don't seem to be loading
> > when I run tests.
>
> > from django.test.client import Client
> > from django.test import TestCase
> > from utils import *
> > from forum.models import *
> > from forum import auth
> > from django.contrib.contenttypes.models import ContentType
>
> > class UserProfileTestCases(TestCase):
> >    """These are tests to verify that refactoring of UserProfile is
> > correct"""
> >    fixtures = ['forum_fixtures.json'] ## @ forum/fixtures/
> > forum_fixtures.json
> >    def setUp(self):
> >        self.client = Client()
> >        if self.client.login(username='DickCheney', password='test'):
> >            print "client.login DickCheney successful";
> >        else:
> >            print "client.login FAILED"
>
> >    def test_set_new_email(self):
> >        orig_email = User.objects.get(username='DickCheney')
> >        response = self.client.post('changeemail',
> > {u'email':'cockgobb...@nwo.gov '})
>
> > self.assertNotEqual(User.objects.get(username='DickCheney').email,
> > orig_email)
>
> > I ran the tests verbosely:
> > python manage.py test --verbosity=2
>
> > Django only looked for fixtures named 'initial_data'. Not once was
> > there are search for 'forum_fixtures.json'
>
> > I changed the fixture name to 'initial_data.json' and it now works.
>
> > I just thought I'd post the work around.
>
> Loading of non-initial-data fixtures during testing does work in 1.2. I've
> just confirmed it with one of my own projects. If this did not work I'd
> expect we'd quickly hear of it from multiple sources and I'm pretty sure a
> number of Django's own tests would fail.
>
> Diagnostics for the case where a file specified in a TestCase fixtures
> attribute is not found are poor. If I change the name of my test fixture
> file on disk without changing the test that refers to it, there is nothing
> in the test output, even at verbosity 2, other than errors from the failing
> tests cases that require the fixture, to indicate the problem. There is
> exhaustive output regarding trying to load initial_data fixtures, but
> nothing for the fixtures specified on an individual test case. I thought
> there had been a ticket that addressed this fairly late in the 1.2 cycle but
> I must be mis-remembering because I don't see any better diagnostics here
> with 1.2 than I did with earlier versions.
>
> Are you absolutely sure the name of the file on disk matched what you had
> listed in the TestCase fixtures line?
>
> Karen
> --http://tracey.org/kmt/

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



Django v1.2 TestCase doesn't seem to load fixtures except 'initial_data'

2010-05-26 Thread Bryan
I am using Django v1.2

The fixture I defined "forum_fixtures.json" don't seem to be loading
when I run tests.

from django.test.client import Client
from django.test import TestCase
from utils import *
from forum.models import *
from forum import auth
from django.contrib.contenttypes.models import ContentType


class UserProfileTestCases(TestCase):
"""These are tests to verify that refactoring of UserProfile is
correct"""
fixtures = ['forum_fixtures.json'] ## @ forum/fixtures/
forum_fixtures.json
def setUp(self):
self.client = Client()
if self.client.login(username='DickCheney', password='test'):
print "client.login DickCheney successful";
else:
print "client.login FAILED"

def test_set_new_email(self):
orig_email = User.objects.get(username='DickCheney')
response = self.client.post('changeemail',
{u'email':'cockgobb...@nwo.gov'})
 
self.assertNotEqual(User.objects.get(username='DickCheney').email,
orig_email)

I ran the tests verbosely:
python manage.py test --verbosity=2

Django only looked for fixtures named 'initial_data'. Not once was
there are search for 'forum_fixtures.json'

I changed the fixture name to 'initial_data.json' and it now works.

I just thought I'd post the work around.

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



Sorting by a GenericRelation Causes Result Oddities

2010-02-08 Thread Bryan Veloso
Alright, let's see if I can explain this:

I have an Artist model and artists get positionally ranked. It has a
GenericRelation to another model that stores scores from that ranking.
I wanted to be able to sort Artists by their score using that
GenericRelation. Here's an example (ran this in the interpreter) of a
list of artists ranked by a specific user.

>>> items
[, , ,
, , , , , ,
, , ,
, , ]
>>> items.order_by('overall_child__score')
[, , ,
, , , , , , , , , , , , , ]
>>> items.order_by('overall_child__score').distinct()
[, , ,
, , , , , , , , , , ,
, , ]
>>> items.count()
15
>>> items.order_by('overall_child__score').count()
15

As you can see,  and  are
duplicated, but the .count() doesn't reflect that. Here's the kicker,
in the table that the GenericRelation is linked to, those two records
occur twice. I had some friends test my application last night the
number of duplicates was equal to the number of people that included
that specific artist in their ranking.

It's an OUTER JOIN, but I don't know if that has anything to do with
it, but it seems to ignore any type of filtering that I'm trying to do
to it. Hopefully that makes some kind of sense. I don't know if
there's a way around it, or if it's a bug that needs to be fixed. But
any insight would be great. :)

Cheers,
Bryan

-- 
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: are django applications portable?

2009-09-26 Thread Bryan

It is definitely possible to "install" django-tagging on your project
path if you really wanted to.  I did this for a while and it worked
just fine.  You could export the latest version from source control or
alternatively do the install and then move files from the python
packages directory to your project directory.  Installing it on your
python path is definitely the preferred method though.

On Sep 25, 1:17 pm, Brian McKeever  wrote:
> I'm not familiar with the plugin, but I would guess that it's trying
> to add itself to the python path. That way it's easily available for
> any django project without having to include it in an individual
> project.
>
> I would bet that it'd work just fine included manually in your project
> without running the install script.
>
> But again, it depends on the plugin.
> On Sep 25, 10:59 am, dijxtra  wrote:
>
>
>
> > Hi everybody,
>
> > Django applications, as I understood them should be pluginable on
> > project basis. That is, I should be able to install them to my
> > *project*, not to my django installation. So I downloaded django-
> > tagging and run the python setup.py install. And it failed:
> > n...@rilmir:~/code/my_project/django-tagging-0.3$ python setup.py
> > install
> > [...]
> > creating /usr/local/lib/python2.6/dist-packages/tagging
> > error: could not create '/usr/local/lib/python2.6/dist-packages/
> > tagging': Permission denied
>
> > Now, why is django-tagging trying to mess with my python directory?
> > Does that mean that when I commit my project to my repository and
> > checkout it on a different django installation django-tagging won't
> > work untill I install django-tagging on that machine? I thought that
> > when I install an django app, then I install it in my project and my
> > project is still portable. But, if django-tagging is putting files in
> > directories outside my project directory, doesn't that make my project
> > un-portable?
>
> > Could someone please clear this up for me?
>
> > Thanks,
> > nick.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is this a sane way to show total number of objects in pagination?

2009-09-25 Thread Bryan

I can't think of a reason, if nothing else its a matter or taste/
preference.  He said "I would probably...", so he may have been
implying that there was a technical reason but most likely he was just
stating his preference.

On Sep 25, 5:03 am, Chris Withers  wrote:
> Jani Tiainen wrote:
> > Chris Withers kirjoitti:
> >> Brian McKeever wrote:
> >>> .count is definitely the way to go. Although, I would probably pass it
> >>> to your template instead of determining it there.
> >> What difference does it make?
>
> > len(qs) evaluates queryset - thus pulling in _every_ object from DB to
> > Python - which you might not want specially if queryset is large.
>
> > .count() executes count query on DB side returing only single scalar
> > value to Python.
>
> > Figure out which one is faster...
>
> Er, I was asking what the difference was between calling .count in the
> view and in the template. I can't think why it would make a difference,
> but Brian suggested it did...
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
>             -http://www.simplistix.co.uk
--~--~-~--~~~---~--~~
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: Custom User Model and the Django Admin Site

2009-08-29 Thread Bryan

Thanks for your help.  Perhaps I should have been more clear and
included more information, because that is exactly what I was asking
about.  I was hoping that someone had already solved this problem and
could fill me in on how they got it working.  Btw, my first post was
written in pieces while distracted and working entirely from memory,
so please forgive me for any nonsensical or incorrect statements.  I
don't have an excuse today though :P

This is what I eventually did:
When I first tried to override the fieldsets I recieved an error
telling me that my custom fields could not be found.  This happened
because the UserAdmin class also specifies custom forms for editing
(as well as adding), which are bound to the User model.  I subclassed
the user form classes in order to override the meta class and tell
them to use my custom model instead of the User model (and also add in
some extra fields on my custom model).  I could have just used model
forms, but I decided to subclass the user forms for two reasons:  1)
it won't feel like I am "short-circuiting" any framework code and if
changes/enhancements are made to the user form classes I can also take
advantage of them (or they may break me, but thats another story) and
2) the add form includes extra logic that I didn't want to duplicate.
This got me what I wanted, an edit form with all of my custom fields
as well as a working change password form.  I noticed that the add
form didn't work though.  It only included the username and password
(with confirmation), so I added my fields to the form class and copied
the admin create user form (/auth/user/add_form.html) into my project
directory and added my custom fields.  I'm not entirely happy about
having to do that.  It seems like little thought has been put into
custom user models in regards to the admin site.  Ideally all that I
would have to do is inherit from UserAdmin and override the fieldsets,
but maybe I'm asking too much.

On Aug 28, 3:23 pm, Karen Tracey  wrote:
> On Fri, Aug 28, 2009 at 10:20 AM, Bryan  wrote:
>
> > So, my "solution" was to duplicate this logic in my admin class, and
> > it works just fine now.  Anyone have any better ideas?
>
> Base your admin class on the UserAdmin class. Inherit whatever you need from
> it and override whatever you want to customize yourself.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom User Model and the Django Admin Site

2009-08-28 Thread Bryan

Hi All,

Just a quick query to see if anyone has any ideas on this one.

I have a model in my application that inherits from the django User
model.  In the admin site, without any extra configuration (just using
ModelAdmin), I get a standard edit form with the custom model's fields
as well as the django User fields.

The problem that I have is that a "change password" link is generated
(which is desirable), but the url is not routed properly - resulting
in an error.  The url looks like "/CustomModel/id/password".  Digging
around in /contrib/auth/admin.py (working off of memory :P) it looks
like UserAdmin does some voodu magic to hijack the request and execute
some "view logic" in the case of a url that looks like a password
change request.

It looks something like this (psuedocode):

 // inside of __call__ method
 if url is a password url:
  return result of change password method call on UserAdmin
object
 else
  delegate to base class

I can get the change password form to work by simply using the
UserAdmin class, but it explicitly defined the fieldsets (which of
course don't include my custom fields).  As a side note, might it be
possible to define the fieldsets in __init__?  I was under the
impression that the fieldsets are metadata for the class not the
instance.  Even if this is the case I believe I would still have to
duplicate the User model fieldsets.

Multiple inheritance doesn't seem to work (not surprisingly), and I
wouldn't be thrilled about that approach anyway.

So, my "solution" was to duplicate this logic in my admin class, and
it works just fine now.  Anyone have any better ideas?
--~--~-~--~~~---~--~~
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: TypeError: execute() takes at most 3 arguments (4 given)

2009-08-23 Thread Bryan

Daniel is right on.  And for future reference, it says "3 arguments"
which may seem misleading, but keep in mind that the cursor object
itself is the first argument.

On Aug 22, 4:14 pm, kevin  wrote:
> cursor.execute("SELECT a,b,c FROM Table_Name WHERE a = %s AND b = %s ",
> [string1],[string2])
>
> gives me the following error:
>
> TypeError: execute() takes at most 3 arguments (4 given)
>
> Where did i go wrong?

--~--~-~--~~~---~--~~
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: mod_python problem

2009-08-20 Thread Bryan Fordham

> Is the page truly blank? Ie., have you gone 'View Source' in the
> browser to see what is returned. Are you sure you haven't stuffed up
> something in global HTML template whereby missing a closing '>' for
> HTML.

Yup, view source shows it's blank, as in nothing is in the source at all.

> Since now using mod_wsgi, try wrapping the WSGI application for Django
> in the LoggingMiddleware examples described in:
>
>  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
>
> The second of those can be used to capture all the response direct out
> of the WSGI application and may assist in helping you see what is
> actually returned before the web server does anything with it.
>

I'll give that a shot, thanks

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



Re: mod_python problem

2009-08-20 Thread Bryan Fordham

Also tried switching to wsgi, just to see if it would make a
difference. It didn't.

I'm seriously stumped

On Thu, Aug 20, 2009 at 3:56 PM, Bryan Fordham wrote:
>>
>> Don't forget the comma after the absolute path. For example,
>>
>> '/home/bfordham/websites/bfordham/trunk/bfordham/blog/templates',
>> < comma
>
> Tried that, no change.
>
> Changed the template path to an invalid path, same thing. Very weird
> --
> Thanks
> --B
>



-- 
Thanks
--B

--~--~-~--~~~---~--~~
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: mod_python problem

2009-08-20 Thread Bryan Fordham

>
> Don't forget the comma after the absolute path. For example,
>
> '/home/bfordham/websites/bfordham/trunk/bfordham/blog/templates',
> < comma

Tried that, no change.

Changed the template path to an invalid path, same thing. Very weird
-- 
Thanks
--B

--~--~-~--~~~---~--~~
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: mod_python problem

2009-08-20 Thread Bryan Fordham

> The default template is not loading correctly. Check and verify your
> settings.py and make sure it is pointing to the absolute path e.g.,
> TEMPLATE_DIRS ="/home/users/templates",

You're right. Changed the index view to just return an HttpResponse,
skipping the template, and it worked.

So, gotta chase down why. Thanks for the pointer

--B

--~--~-~--~~~---~--~~
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: mod_python problem

2009-08-20 Thread Bryan Fordham

> The default template is not loading correctly. Check and verify your
> settings.py and make sure it is pointing to the absolute path e.g.,
> TEMPLATE_DIRS ="/home/users/templates",

It seems right

>From settings.py:


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

And it exists and permissions seem ok:

$ ls -l /home/bfordham/websites/bfordham/trunk/bfordham/blog/templates
total 8
drwxrwxr-x 3 bfordham www-data 4096 2009-08-20 00:36 blog
drwxrwxr-x 3 bfordham www-data 4096 2009-08-20 00:24 feeds

(www-data is the apache group)

-- 
Thanks
--B

--~--~-~--~~~---~--~~
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: mod_python problem

2009-08-20 Thread Bryan Fordham

It's at http://bfordham.org/

The project runs from the root. It was set that way on the development
server, too, with no problem

On Thu, Aug 20, 2009 at 11:11 AM, Mario wrote:
>
> Bryan,
>
> Can you post your project url? Also try changing from 
> to 
>
> _Mario
>
> On Aug 20, 12:33 pm, Bryan Fordham  wrote:
>> I'm sure this is something simple, but I'm a bit stumped. It's been a
>> while since i've don't this, and obviously I'm missing something
>>
>> I have my django app installed on server. When I go to any URL that
>> matches something in the urls.py file, I get a blank page. As in the
>> server is returning a 200, but there is no data at all in the page
>> that's returned.
>>
>> What's weird is, if I request a URL that's not in urls.py, I get the
>> usual Django error page about it. Also, it will redirect properly from
>> /foo to /foo/
>>
>> Any ideas? Here's the appropriate part from my apache config file:
>>
>> 
>>     SetHandler python-program
>>     PythonHandler django.core.handlers.modpython
>>     SetEnv DJANGO_SETTINGS_MODULE bfordham.settings
>>     PythonDebug On
>>     PythonPath "['/home/bfordham/websites/bfordham/trunk/'] + sys.path"
>> 
>>
>> --
>> Thanks
>> --B
> >
>



-- 
Thanks
--B

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



mod_python problem

2009-08-20 Thread Bryan Fordham

I'm sure this is something simple, but I'm a bit stumped. It's been a
while since i've don't this, and obviously I'm missing something

I have my django app installed on server. When I go to any URL that
matches something in the urls.py file, I get a blank page. As in the
server is returning a 200, but there is no data at all in the page
that's returned.

What's weird is, if I request a URL that's not in urls.py, I get the
usual Django error page about it. Also, it will redirect properly from
/foo to /foo/

Any ideas? Here's the appropriate part from my apache config file:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE bfordham.settings
PythonDebug On
PythonPath "['/home/bfordham/websites/bfordham/trunk/'] + sys.path"


-- 
Thanks
--B

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



Problems with creating formsets with Dynamic initial values

2009-06-26 Thread Bryan Wheelock
I'm completely confused why I'm getting this error:
__init__() got an unexpected keyword argument 'questions'

when I try to initiate CustomBaseFormSet.

I've been trying to hack together a Poll with dynamic Questions and Choices.
This has been much more difficult than I expected.

I started with the examples here:
http://www.pointy-stick.com/blog/2009/01/23/advanced-formset-usage-django/
but now I'm at a loss for how to resolve this.

thanks for any help,
Bryan


Django 1.1 beta 1
# # models.py
class Product(models.Model):
   # manufacturer = models.ForeignKey(Manufacturer)
   name = models.CharField(max_length=100)
   pub_date = models.DateTimeField('date published')

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

class Poll(models.Model):
product = models.ForeignKey(Product)
name = models.CharField(max_length=100)

def __unicode__(self):
return self.name

class Question(models.Model):
poll = models.ForeignKey(Poll)
name = models.CharField(max_length=100)

def __unicode__(self):
return self.name

class Choice(models.Model):
question = models.ForeignKey(Question)
order = models.IntegerField(null=True, blank=True)
name = models.CharField(max_length=200)

def __unicode__(self):
return self.name

class Answer(models.Model):
poll = models.ForeignKey(Poll)
question = models.ForeignKey(Question)
user = models.ForeignKey(User)
text = models.CharField(max_length=100)
pub_date = models.DateTimeField('date published')

class AnswerForm(forms.Form):
poll_id = forms.IntegerField()
question = forms.IntegerField()
# answer = forms.RadioSelect()
text = forms.ChoiceField(widget=forms.RadioSelect())

def __init__(self, *args, **kwargs):
# for some reason this is giving an unscripable error
question = kwargs.pop('question')

super(AnswerForm, self).__init__(*args, **kwargs)

choices = question.choice_set.order_by('order')
self.fields['text'].choices = [(i, choice.name) for i, choice in
enumerate(choices)]
  # self.fields['text'].choices = [(0, u'Poor'), (1, u'Acceptable'), (2,
u'Excellent')]

from django.forms import formsets
# this is being called with:
# PollFormSet(data, questions=questions)
# error = __init__() got an unexpected keyword argument 'questions'
class CustomBaseFormSet(formsets.BaseFormSet):
def __init__(self, *args, **kwargs):

self.questions = kwargs["questions"]
self.extra = len(self.questions)

super(CustomBaseFormSet, self).__init__(*args, **kwargs)

# this is to be deleted I'm just trying to initiate the debugger where I
think the error is happening
# The set_trace() is not being called
# this is called in the __init__ statement of BaseFromSet
def _construct_forms(self):
# instantiate all the forms and put them in self.forms
self.forms = []
# I tried to setup
import pdb; pdb.set_trace()
for i in xrange(self.total_form_count()):
self.forms.append(self._construct_form(i))

def _construct_form(self, i, **kwargs):
kwargs['question'] = self.questions[i]
return super(CustomBaseFormSet, self)._construct_form(i, **kwargs)

PollFormSet = formsets.formset_factory(AnswerForm, CustomBaseFormSet)

##
# views.py

def poll_detail(request, poll_id):
"""
displays poll detail for the person to answer the questions in the Poll.
if the request is a POST then process the form
"""

if request.method == 'POST':
 formset = create_poll_formset(quiz_id, request.POST)
 if formset.is_valid():
 answers = [str(int(f.is_correct())) for f in formset.forms]
 return HttpResponseRedirect('%s?a=%s'
 % (reverse('result-display', args=[poll_id]),
 ''.join(answers)))
else:
 formset = create_poll_formset(poll_id)

return render_to_response('products/poll_detail.html', {'formset':
formset})

def create_poll_formset(poll_id, data=None):
questions = Question.objects.filter(poll=poll_id)
if not questions:
# No poll found, must be a bad poll_id
raise Http404("Invalid poll_id")

return PollFormSet(data, questions=questions)

-- 
The best marketing related articles are at
http://www.InstantDirectMarketing.com

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



conventions for adding pluggable apps to Django

2009-04-21 Thread Bryan Wheelock
I have a question about using Pluggable apps with Django.

My question is about best practices.
If you have pluggable apps, do you put the entire app ( e.g. django-survey
or django-ads ) into a subdirectory and then add each app individually to
the python path?

$ ls apps
django-survey  django-ads

$ ls apps/django-survey/
docs examples setup.py survey

$ ls apps/django-ads/
ads  examples project

Then add each app to the python path individually:
  e.g.
  sys.path.insert(0, os.path.join(PROJECT_ROOT, 'apps/django-survey/'))
  sys.path.insert(0, os.path.join(PROJECT_ROOT, 'apps/django-ads/'))

OR

do you just include the working directory ( in this case
django-survey/survey ) in the apps/ directory so that the they can be found
in apps/survey ?

$ ls apps
survey   ads

Python path is:
  sys.path.insert(0, os.path.join(PROJECT_ROOT, 'apps'))

I think the urlpatterns would be the same in both cases:
  urlpatterns = patterns('',
  (r'^admin/(.*)', admin.site.root),
  (r'^survey/', include('survey.urls')),
  (r'^ads/', include('ads.urls')),
  )

I would imagine there are several ways to do this; however, I guess I wanted
to learn if there was a convention for adding pluggable apps.

thanks,
Bryan

-- 
The best marketing related articles are at
http://www.InstantDirectMarketing.com

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



Re: problem enabling the admin interface

2008-11-19 Thread Bryan Oakley

Thank you. That was certainly part of the problem. I also discovered I
needed to add django.contrib.auth. And oddly, a problem where I had an
admindocs (plural) directory but the admin site was looking for
admindoc (singular).

Eventually, with your help and some educated guesses I'm finally up
and running. It's been surprisingly difficult, but I'm not tuned in to
the django world so maybe these are all known issues.

Thanks again!

On Nov 19, 2:49 pm, Ben Eliott <[EMAIL PROTECTED]> wrote:
> installed apps needs 'django.contrib.sessions',
>
> http://docs.djangoproject.com/en/dev/topics/http/sessions/#topics-htt...
>
> On 19 Nov 2008, at 19:42, Bryan Oakley wrote:
>
>
>
> > I inherited a django app and I'm trying to enable the admin interface
> > without much luck. When I try to access the admin interface I see this
> > at the end of the error log:
>
> > OperationalError: no such table: django_session
>
> > Sure enough, it's not in my (sqlite) database. If I create a new
> > database from scratch that table is not being created:
>
> > $ python manage.py syncdb
> > Creating table tests_testinfo
> > Creating table dashboard_testresult
> > Creating table django_admin_log
> > Creating table django_content_type
> > Installing index for tests.TestInfo model
> > Installing index for dashboard.TestResult model
> > Installing index for admin.LogEntry model
> > $
>
> > My settings.py includes this:
>
> > MIDDLEWARE_CLASSES = (
> > 'django.middleware.common.CommonMiddleware',
> > 'django.middleware.gzip.GZipMiddleware',
> >'django.contrib.sessions.middleware.SessionMiddleware',
> >'django.contrib.auth.middleware.AuthenticationMiddleware',
> > #'django.middleware.doc.XViewMiddleware',
> > )
>
> > INSTALLED_APPS = (
> >  'web.tests',
> >  'web.dashboard',
> >  'django.contrib.admin',
> >  'django.contrib.contenttypes',
> > )
>
> > Anyone have advice for what I might be doing wrong?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



problem enabling the admin interface

2008-11-19 Thread Bryan Oakley

I inherited a django app and I'm trying to enable the admin interface
without much luck. When I try to access the admin interface I see this
at the end of the error log:

 OperationalError: no such table: django_session

Sure enough, it's not in my (sqlite) database. If I create a new
database from scratch that table is not being created:

$ python manage.py syncdb
Creating table tests_testinfo
Creating table dashboard_testresult
Creating table django_admin_log
Creating table django_content_type
Installing index for tests.TestInfo model
Installing index for dashboard.TestResult model
Installing index for admin.LogEntry model
$

My settings.py includes this:

MIDDLEWARE_CLASSES = (
 'django.middleware.common.CommonMiddleware',
 'django.middleware.gzip.GZipMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
#'django.middleware.doc.XViewMiddleware',
)

INSTALLED_APPS = (
  'web.tests',
  'web.dashboard',
  'django.contrib.admin',
  'django.contrib.contenttypes',
)

Anyone have advice for what I might be doing wrong?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: New Project : Django Sites Integration

2008-04-27 Thread Bryan Veloso

Hey Mike,

I can add this to the Django Plugables directory if you'd like. Let me
know. :)

Cheers,
Bryan

On Apr 27, 10:36 am, Mike H <[EMAIL PROTECTED]> wrote:
> Oh, and it automatically filters the model's querysets by the current  
> site. Kinda important that it does that, and I forgot to mention it,  
> heh.
>
> Cheers,
>
> Mike
>
> On 27 Apr 2008, at 18:29, Mike H wrote:
>
>
>
> > Hi all,
>
> > I've been putting together a site using projects from
> > djangopluggables.com. It's been going great, except in one area. My
> > site is going to run across various subdomains, and you will see
> > different groups, forums, blog etc. depending on which subdomain you
> > go to (it's like a create-your-own-community style thing). So I've got
> > a site for each subdomain, and a settings file that sets each one up
> > correctly. I wanted to use django-forum, coltrane and a couple of
> > other things with those sites, but I didn't want to go round modifying
> > their code to be aware of the sites.
>
> > So I wrote an app that lets you register each model you want filtered
> > by site. It automatically adds a site attribute, alters your unique
> > constraints, and sets the current site on save. Now I can use the
> > great code in those third party apps across all my subdomains, without
> > modification!
>
> > The project is athttp://code.google.com/p/django-sites-integration/
>
> > I know it's probably going to be of limited appeal, but it was very
> > useful for me, so hopefully someone else will have use for it.
>
> > Cheers,
>
> > Mike H
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: get_or_create and DoesNotExist

2008-03-31 Thread Bryan Veloso

Sure thing Bruno,

Model: http://dpaste.com/hold/42454/
Flickr Importer: http://dpaste.com/hold/42455/

I think that's all that's involved.

Cheers,
Bryan


On Mar 31, 1:22 pm, "Bruno Tikami" <[EMAIL PROTECTED]> wrote:
> Hi Bryan,
>
> would you post your model and view code too? As you didn't send the view
> code, it's quite hard to say what's wrong. I *guess* result is your QuerySet
> object created by the get_or_created call . If so, did you save() the
> created object ?
>
> Regards,
>
> Tkmhttp://djangopeople.net/brunotikami/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



get_or_create and DoesNotExist

2008-03-31 Thread Bryan Veloso

Hi all,

I mostly just need a tap in the right direction for this one. I'm sure
I'm missing something that's obvious. Anyway, I'm trying to run django-
syncr, and it's telling me that "Photo matching query does not exist."
But if it doesn't exist, shouldn't it create it? I'm thinking that
something is either preventing the instance from being created. The
really odd thing is that it created one instance and then stopped,
when I asked for it to import my photos from the last 7 days.

All-in-all, I'm stumped. Any help would be appreciated!

Cheers,
Bryan

==

Traceback (most recent call last):
  File "", line 1, in 
  File "/home/bryan/Projects/avalonstar.com/applications/media/
importers/flickr.py", line 212, in syncRecentPhotos
    photo_list = self._syncPhotoXMLList(result.photos[0].photo)
  File "/home/bryan/Projects/avalonstar.com/applications/media/
importers/flickr.py", line 165, in _syncPhotoXMLList
photo_list.append(self._syncPhoto(photo_result))
  File "/home/bryan/Projects/avalonstar.com/applications/media/
importers/flickr.py", line 153, in _syncPhoto
defaults=default_dict)
  File "/usr/lib/python2.5/site-packages/django/db/models/manager.py",
line 72, in get_or_create
return self.get_query_set().get_or_create(**kwargs)
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 295, in get_or_create
return self.get(**kwargs), False
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 263, in get
raise self.model.DoesNotExist, "%s matching query does not exist."
% self.model._meta.object_name
DoesNotExist: Photo matching query does not exist.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django hosting website

2008-03-24 Thread Bryan Veloso

>Lots more flexibility, but when things break its your fault.

Well at least you're able to rebuild instead of begging customer
service to do it for you. I'll definitely submit my +1 for Slicehost.

-Bryan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



more info when serializing

2007-11-17 Thread Bryan L. Fordham

So, say I have a model something like this:

class Bar(models.Model):
user = models.ForeignKey(User)
name = models.CharField(maxlength=50)
description = models.TextField()

where user is tied to a django.contrib.auth.models.User entity. When I 
serialize this to json, I get:
[{"pk": "1", "model": "foo.bar", "fields": {"description": "", "user": 
1, "name": "Phone"}}]

Which is fine, but I need both the username and user id on the front 
end. Is there a simple way to get this info all in one shot that I'm 
just missing?

Ideally, it would return something like: ..."user": 
{"username":"bfordham", "pk":1}...

I'm using the django-rest-interface, if that makes a difference one way 
or the other.

Thanks
--B

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: spam

2007-11-06 Thread Bryan L. Fordham


> About all you can do is mark it as spam and let that train Google's spam 
> filter.
>
>   
A mail client that doesn't automatically show images will help, too.

--B

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error loading MySQLdb module

2007-07-06 Thread Bryan L. Fordham

looks like you need to install MySQLdb: 
http://sourceforge.net/projects/mysql-python
Jalil wrote:
> I keep getting this below error when I try to sync my database. 
> I am using python2.3. Any ideas?
>
>
>
> [no job set:~/dev/mysite] 113% python2.3  manage.py syncdb
> Traceback (most recent call last):
>   File "manage.py", line 11, in ?
> execute_manager(settings)
>   File "/usr/lib/python2.3/site-packages/django/core/management.py", 
> line 1672, in execute_manager
> execute_from_command_line(action_mapping, argv)
>   File "/usr/lib/python2.3/site-packages/django/core/management.py", 
> line 1571, in execute_from_command_line
> action_mapping[action](int(options.verbosity), options.interactive)
>   File "/usr/lib/python2.3/site-packages/django/core/management.py", 
> line 486, in syncdb
> from django.db import connection, transaction, models, 
> get_creation_module
>   File "/usr/lib/python2.3/site-packages/django/db/__init__.py", line 
> 11, in ?
> backend = __import__('django.db.backends.%s.base' % 
> settings.DATABASE_ENGINE, {}, {}, [''])
>   File 
> "/usr/lib/python2.3/site-packages/django/db/backends/mysql_old/base.py", 
> line 12, in ?
> raise ImproperlyConfigured, "Error loading MySQLdb module: %s" % e
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb 
> module: No module named MySQLdb
> bykergrove [no job set:~/dev/mysite] 114%


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Slug (w/o using SlugField) Problems

2007-07-06 Thread Bryan Veloso

> You might need to adopt a different approach to URL construction that is
> reversible (writing your own version of slugify, possibly?).

Thanks for the help Malcolm. Using Jeff Croft's "I'm not a programmer"
excuse, would it be too much trouble to request a small example of a
reversible slugify? I think that's probably my best bet since other
options included adding more models and custom save methods. I've
searched around and have only found a few examples of a rewritten
slugify, other than that I'm completely clueless about how to write
one myself.

If not, then I'll just have to use one of those other ways then.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Slug (w/o using SlugField) Problems

2007-07-06 Thread Bryan Veloso

Alright, well let me get the information out of the way first:

models.py
--
char_id = models.IntegerField('Character ID',
primary_key=True)
name= models.CharField('Name', maxlength=90)

def get_absolute_url(self):
return "/characters/%s/" % (slugify(self.name))
--

urls.py
--
character_detail_dict = {
'queryset': Character.objects.all(),
'template_object_name': 'character',
'template_name': 'characters/character_detail.html',
'slug_field': 'name',
}

(r'^characters/(?P[-\w]+)/$', object_detail,
dict(character_detail_dict)),
--

So, the problem. This is an existing database (ran inspectdb to get
it) so obviously I can't add a SlugField to the Character model. Now
I've only been able to get this to work if the character's name is one
word, without hyphens. Once you start throwing hyphens in there, it
throws a 404. I know I'm messing something up, but it's either way too
late for me to think straight, or I just have no idea what to fix. The
thing that bothers me is that `name` isn't really a `slug_field` as it
hasn't been slugified, and the only place I slugify is up there with
the absolute URL. I don't think slug_field can be a property either
correct?

Thanks in advance.

~ Bryan


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cross Importing Model Problem

2007-07-05 Thread Bryan Veloso

Oh also, I thought OneToOneFields were discouraged in favor of
ForeignKeys with unique=True as per
http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cross Importing Model Problem

2007-07-05 Thread Bryan Veloso

Thanks for the help guys. Splitting the models up was mostly a
cosmetic thing for the admin, but these problems quickly kicked me out
of that state. Anyway, yes, the database design is really bad, mostly
because that's not what the game developers are experts at
unfortunately.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Cross Importing Model Problem

2007-07-04 Thread Bryan Veloso

I don't know if this is even possible, since I've had so many errors
thrown at me, but I wanted to ask here so I can get a clear picture.

I have 2 models for an MMORPG control panel I'm building. Each set of
data is within it's own app with related models, etc. So here's my
example. It's run off an existing database so I really can't change
any of the database fields.

I have a Character model that imports the Guild model.

class Character(models.Model):
char_id = models.IntegerField('Character ID',
primary_key=True)
account = models.ForeignKey(Account, unique=True,
db_column='account_id')
char_num= models.IntegerField('Character Slot')
name= models.CharField('Name', maxlength=90)
guild   = models.ForeignKey('Guild',
db_column='guild_id') 

But the app that contains Guild has another model that is linked to
the Character model.

class GuildMember(models.Model):
guild   = models.ForeignKey(Guild,
db_column='guild_id', unique=True, primary_key=True)
account = models.ForeignKey(Account,
db_column='account_id', unique=True)
character   = models.ForeignKey(Character,
db_column='char_id', unique=True) 

So when I run it, it says it can't import Character & Guild. Which
makes sense because I'd be importing a model onto itself. Is there any
way to get around this? I thought if you called a model that it would
only import the dependencies related to the model being imported,
rather than all the dependencies in models.py.

My apologies if I totally botched up the explanation, but that's the
best I can manage.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Random string template tag

2007-07-03 Thread Bryan Veloso

> If you want to hardcode the availability of the 'classes' variable in
> every context (so you don't have to remember to define it every time),
> you could write a context processor. See
> django.core.context_processors for examples.

That's probably what I'll need since it'll always have to be there.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Random string template tag

2007-07-03 Thread Bryan Veloso

> One option is to use the 'random' filter; your context would need to
> define the list of possible strings:
>
> Context({
>'classes': ['class1','class2','class3','class4']
>
> })
>
> but then your template could use:
>
> {{ classes|random }}

Can you serve Context to the base template?
I thought of that earlier, but I couldn't think of how to give it
Context.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Random string template tag

2007-07-03 Thread Bryan Veloso

I don't know if this exists or not, but I'd like to insert a tag (much
like cycle) that allows the random selection of a string. I'm trying
to randomly assign a class to a  to simulate "random image
rotator" type functionality. Something like...



Any ideas?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



augmenting admin delete

2007-07-03 Thread Bryan

Is there an easy way to augment deleting from the admin page.
Specifically, I'm uploading an image and as part of saving the image
model I make a thumbnail (which isn't part of the model). The admin
delete will remove the uploaded image but not the thumbnail, so I'd
like to basically say, whenever you delete the image also delete the
thumbnail.

I know I can override the admin delete to do whatever I want but I
just want to augment it with one tiny thing, so I'm hoping there is a
clean way.

Any ideas?

Thanks.


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



Re: Could you please share your django-based website source code with me?

2007-07-02 Thread Bryan L. Fordham


oh wow, I don't know how I managed to send that to this list. That was a 
reply to a private email, having nothing to do with Django. Obviously.

Sincere apologies

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Could you please share your django-based website source code with me?

2007-07-02 Thread Bryan L. Fordham

I don't know that I ever listened to his message at the mormon tabernacle.

http://www.rzim.org/radio/archives.php?p=JT&v=detail&id=784 is the first 
part

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Password Logistics Help Needed

2007-06-27 Thread Bryan Veloso

> The original poster suggested adding a field called password_md5 to a
> model that is an extension of User. It was never indicated that such a
> field already existed.

Ah, my bad. I misinterpreted.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Password Logistics Help Needed

2007-06-27 Thread Bryan Veloso

Alright. I tried looking in the actual source for any mention of
password_md5... and it no longer exists. So I'm sure I just can't call
the field. I'd have to recreate it or something correct?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Password Logistics Help Needed

2007-06-27 Thread Bryan Veloso

> The usual route I go with when trying to extend on the User model is
> to create a new model and link it to the User model. For example:
>
> class UserExt(models.Model):
> user = models.ForeignKey(User)
> # ... other fields that you need here
>
> def __init__(self, user):
> self.user = user
> # ... other stuff that you need to do here
>
> # ... other methods you need here
>
> In your case, you can just create a UserExt model, add a password_md5
> field, set that field when creating or updating a user record and save
> the user_ext object.

Awesome, well I'm already extending the user model, so I can just add
that. So password_md5 still exists? Sweet, if so, I can just override
save() and have that save in the account table right? Things are
looking a lot clearer now, thanks Nimrod.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Password Logistics Help Needed

2007-06-27 Thread Bryan Veloso

Alright, I did about 2 hours of searching today and I'm beginning to
think that the above is an impossibility. Which probably means that
I'm going to have to bypass Django authentication and make my own, but
I don't even know where to start on that, so I'm at quite a loss. :/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Password Logistics Help Needed

2007-06-27 Thread Bryan Veloso

Long story short, I'm building a control panel + backend to an MMORPG.
It runs off of a mySQL database, I used inspectdb, and all of that
worked perfectly. However, now I have some duplicate data, the User
model (since I'm using django-registration) and the account table of
the inspected database. I'm sure I could just assign the applicable
values from the User model to the account table while creating the
user's profile via profile_callback(), but the only problem I can't
seem to get my head around is the password one.

At the moment, the game can only read md5 or plain-text passwords, and
I know that Django has the hash$salt$hash (or something. :P) way of
doing it. So I can't just copy the password from the User model to the
account table since the game will choke on that data. So is there any
way I can store two sets of the password? One in the user model that
gets copied as md5 or plain-text to my accounts table?

Thanks in advance, please let me know if I have to explain things a
bit more. :)

Cheers,
Bryan V.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: looking for calender and a message board

2007-06-23 Thread Bryan Veloso

I just found this a few minutes ago: http://code.google.com/p/beastly/

On Jun 23, 9:16 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> If by message board you mean a forum, a la VBulletin and the like,
> Zyons is the only Django one I know of:http://zyons.com/
>
> As for calendar, I wasn't able to find an existing generic calendar
> app, and have been working on rolling my own for my project. I'd
> share, but it is most definitely not going to be worthy of sharing
> because I am a novice at Django and Python. The code I'm using to
> display the calendar came from djangosnippets.org.
>
> On Jun 23, 1:37 pm, Carl Karsten <[EMAIL PROTECTED]> wrote:
>
> > I am going to build a site that needs a calender and a message board, plus 
> > some
> > specialized things that will 'integrate' with those two features.  So it 
> > would
> > be good if the whole site used the same glue.
>
> > Anyone have any suggestions?
>
> > Carl K


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ticket #3297 & Newforms Image Uploading

2007-06-23 Thread Bryan Veloso

On Jun 23, 2:41 pm, Bryan Veloso <[EMAIL PROTECTED]> wrote:
> > for n in range(0, MAX_NUM_UPLOADS):
> > img_manip = ImageAttachment.AddManipulator()
> > img_obj = img_manip.save()
> > uploaded = clean_data['img_fld%d' % n]
> > obj.save_image_file(uploaded['filename'], uploaded['content'])
>
> What library did you have to import to get ImageAttachment to work?

Hah, sorry my bad... didn't know ImageAttachment was your model 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ticket #3297 & Newforms Image Uploading

2007-06-23 Thread Bryan Veloso

> for n in range(0, MAX_NUM_UPLOADS):
> img_manip = ImageAttachment.AddManipulator()
> img_obj = img_manip.save()
> uploaded = clean_data['img_fld%d' % n]
> obj.save_image_file(uploaded['filename'], uploaded['content'])

What library did you have to import to get ImageAttachment to work?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ticket #3297 & Newforms Image Uploading

2007-06-22 Thread Bryan Veloso

> Can't paste the code from the actual app (am under NDA) but the logic
> in saving the image from form data is here:
>
> http://dpaste.com/12731/

The only problem with this, and probably why I'm looking to use #3297
(which actually didn't work too well anyway), is because I have as
many as 15 file upload fields on one page. All the examples I've seen
only take care of one image on a certain form at a time and I don't
want to duplicate the code up to 15 times.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Introducing DjangoSites.Org

2007-06-22 Thread Bryan L. Fordham


> still havent got the mail, but the login is working
>
>   
I created a login for bfordham the other day, never got an email, 
account isn't working.

--B

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ticket #3297 & Newforms Image Uploading

2007-06-21 Thread Bryan Veloso

> You can always write the code to process File/Image fields in the view
> or just extend your form to handle them properly. I have managed to do
> so either by processing in the view or extending the form. As of now,
> all processing of all forms occur in the view and validation for file
> and image fields in a method of the form.
>
> This is what I did for the field validationhttp://dpaste.com/12715/
> the code to save the field data is in the view that uses this form.
>
> There is also a recent thread discussing this very same issue. There
> are also good solutions there so check them out.
>
> HTH.

Thanks Nimrod. I'll check that out. But your code looks like something
I'd use too. :)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Ticket #3297 & Newforms Image Uploading

2007-06-21 Thread Bryan Veloso

RE: http://code.djangoproject.com/ticket/3297

I'm wondering if anybody has actually used this patch for a production
site. If not, then I'll put off a certain feature of my site until
later. The patch is really tempting though, so I wanted to get a
better outlook of experiences before taking the leap.

Thanks!
Bryan V.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pagination

2007-06-21 Thread Bryan L. Fordham


> I don't understand. If you're one /foo/bar/baz/page1/, then why can't
> you write  as the link? It will work, is a
> well-formed URL and is independent of the prefix. Note that you must
> ensure your URLs are canonicalised if you use this system, though:
> always ending with a trailing slash, so that the "../" will go to the
> right place.
>   
that will work of the first page is /foo/bar/baz/page1/  and not 
/foo/bar/baz/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL query with LIKE statement

2007-06-21 Thread Bryan L. Fordham


> This should be writable in a slightly more Djangoic (I suppose if 
> Python code is Pythonic, Django code is Djangoic?  Djanonic? 
> Djangonical?  Djangoish?) fashion:
>   
my vote would be to user "superfly," as in:
This should be writable in a slightly more superfly fashion
>entries = Journal.objects.filter(note__startswith = q)
>entries = entries.extra(where='length(note) > 0')
>   
I've spent some time recently rewriting some of my custom managers to 
use the extra method, and I highly recommend it. I know it may not be 
possible in all circumstances, but for things like sorting and using 
generic views it made my life a lot easier. I do suggest spending time 
playing with it in the shell to get the hang of it.

So, nothing of real substance to impart here, just to encourage you to 
check out the extras() method.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Hypothetical: Customizable Member Pages

2007-06-20 Thread Bryan Veloso

> Not really sure if it's a good idea to
> allow users to enter arbitrary HTML code. I mean, just look at what
> happened to MySpace and Friendster :) It's better to just allow users
> to select from a set of predesigned templates and then allow them to
> customize the CSS stylesheets.

Believe me, I feel ya, I'll try and get away with as little MySpace-
ness as possible. :)


> It should be relatively easy; look at Chapter 12 of the Django book,
> which covers extending the auth system with a custom profile model.
> You'll want to develop a model which includes the ability for users to
> specify whatever styles/customizations are needed (along with any
> other information you want to collect), and use that as the profile
> model. Then the 'get_profile()' method on each User will return the
> appropriate object which you can look at to determine how to display
> the user's customized page.

So that's all it is eh? I don't know why I was thinking it would be so
difficult to do. I guess because I thought of template tags first, of
them placing our content in their code rather than have them place
code around our content.. if that makes any sense. I guess my best
example of what I'd want done is Virb, but from a database standpoint
it definitely makes sense.

Thanks for the quick responses guys. :)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Hypothetical: Customizable Member Pages

2007-06-20 Thread Bryan Veloso

I'd like to build a site in which members have the ability to
customize the look of their profile using HTML, CSS and template tags
that we'd provide to the member. So, I want to know if Django supports
this or not, as well as how difficult it would be to implement. Best
case scenario would be a customization experience like that of
Geocities or Yahoo!Pages, but experiences that parallel to say,
Wordpress.com or MySpace would work too.

This feature is a show-stopper, since the market I'll be gearing this
to almost requires features like this to be there.  So am I dreaming
that this can be done? Has anybody else attempted something like this
yet?

Thanks. :)

~ Bryan


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Development times

2007-06-20 Thread Bryan Veloso

I've only developed two sites, a blog and a dynamic scoreboard, having
no prior python experience.

The blog took about 4 weeks, with a lot of help, and it's still not
done due to some limitations I've hit with the framework (or
limitations in my own knowledge).
The scoreboard I just finished an "alpha" of, and that took me less
than 2 weeks. :)

On Jun 20, 2:00 pm, Eugene Morozov <[EMAIL PROTECTED]> wrote:
> Hello,
> I'm interested how much time it took to develop some Django sites.
> Just curious to compare my performance against others.
>
> Currently, I have developed only a single Django site (it is very
> complex and is actually only 90% ready). It took two months to
> develop, I have detailed log created using beautiful gtimelog program.
> Although I've started using it in the middle of the project, so I
> don't have exact data how much time I spent on models, logic or HTML
> layout (the lest interesting and most time-consuming part of the
> project).
> Eugene


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Introducing DjangoSites.Org

2007-06-20 Thread Bryan L. Fordham

[EMAIL PROTECTED] wrote:
> A week ago I posted about a project I was working on, Djangosites.org.
> It's intended to be a showcase of what's out there in Django Land.
>   
Very nice.

A few minor things:
One the register page, since the "Terms of Service" link is in the label 
for the checkbox, when I clicked it to read the TOS it checked the box 
before going to the page.

In the 2 item on the TOS page, it says "We're aiming for an audience of 
"G" and above." I know what you mean but, what's below G? 8)

I don't think these would really confuse anyone, or affect the sites 
use, but there ya go anyway

--B

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SelectDateWiget Problem

2007-06-20 Thread Bryan Veloso

I was looking through the code today and saw this:
http://code.djangoproject.com/browser/django/trunk/django/newforms/extras/widgets.py

def value_from_datadict(self, data, name):
y, m, d = data.get(self.year_field % name),
data.get(self.month_field % name), data.get(self.day_field % name)
if y and m and d:
return '%s-%s-%s' % (y, m, d)
return None

Does that have anything to do with my problem?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SelectDateWiget Problem

2007-06-18 Thread Bryan Veloso

Yep, the other fields are populated correctly.

My Form:
class ProfileForm(forms.Form):
name= forms.CharField(required=False)
avatar  = forms.Field(widget=forms.FileInput,
required=False)
photo   = forms.Field(widget=forms.FileInput,
required=False)
city= forms.CharField(max_length=50, required=False)
state   = forms.CharField(min_length=2, required=False)
country = forms.CharField(required=False)
zip = forms.CharField(max_length=10, required=False)
latitude= forms.DecimalField(max_digits=11,
decimal_places=6, required=False)
longitude   = forms.DecimalField(max_digits=11,
decimal_places=6, required=False)
display_on_map  = forms.BooleanField(required=False)
primary_mii = forms.CharField(required=False)
favorite_game   = forms.ChoiceField(choices=[(1, 'Baseball'), (2,
'Bowling'), (3, 'Boxing'), (4, 'Golf'), (5, 'Tennis')],
widget=forms.Select)
friend_code = forms.CharField(min_length=16, max_length=19,
required=False)
gender  = forms.ChoiceField(choices=[('N', 'Neither'),
('M', 'Male'), ('F', 'Female'), ('B', 'Both')], widget=forms.Select)
birthday=
forms.DateField(widget=SelectDateWidget(years=range(today.year,
1900,-1)), required=False)
homepage= forms.URLField(required=False,
verify_exists=True)
icq = forms.CharField(required=False)
aim = forms.CharField(required=False)
yahoo   = forms.CharField(required=False)
google  = forms.EmailField(widget=forms.TextInput,
required=False)
msn = forms.EmailField(widget=forms.TextInput,
required=False)
interests   = forms.CharField(required=False)
occupation  = forms.CharField(required=False)


My View:
def edit_profile(request, slug=None):
"""
Allows a Player to edit their profile.
"""

from django.views.generic.create_update import update_object
try:
if slug:
auth_user = User.objects.get(username=slug)
elif request.user:
auth_user = request.user
except(User.DoesNotExist):
raise Http404

user_id = auth_user.id
username = auth_user.username
instance = Player.objects.get(player=user_id)
profileform = form_for_instance(instance, form=ProfileForm)
form = profileform(instance.__dict__)

if request.method == 'POST':
form = profileform(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect("/players/%s/" % username)
else:
form = profileform(instance.__dict__)

return update_object(
request,
model=Player,
extra_context={ 'form' : form },
object_id=user_id,
login_required=True,
template_name="players/player_edit_form.html",
)



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



SelectDateWiget Problem

2007-06-18 Thread Bryan Veloso

birthday=
forms.DateField(widget=SelectDateWidget(years=range(today.year,
1900,-1)), required=False)

I have this in my forms.py, and it defaults to January 1, 2007. So, I
set my birthday, save, come back and it's back to that default, so if
I were to save the form without changing that value, it'll save my
birthday as 01/01/07. Shouldn't the widget automatically inherit the
database value like the rest of the form fields?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin: Hiding fields from certain user groups

2007-06-15 Thread Bryan Chow

We have done this before by creating a second model with a different
fields definition in the Admin class, and then assigning the model to
the same database table by specifying db_table in the Meta class. This
allowed us to specify separate access permissions on each model, even
though both models were manipulating the same table.

Kind of a hack, but it worked.

(This was actually the impetus for submitting 
http://code.djangoproject.com/ticket/1766
)


On Jun 15, 10:04 am, andyhume <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> Other than writing a new view for the change form, is there anything I
> can do to stop certain users or user groups from being able to edit a
> particular field of the model in the admin?
>
> Cheers,
> Andy.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Help Wanted at CritterWatch.Org

2007-06-14 Thread Bryan L. Fordham

As I announced recently, I'm currently working on a project at 
www.critterwatch.org. The overall goal is to provide people with 
up-to-date information on how their state represenatives and senators 
are voting, as well as data on legislation. Long term goals include an 
API to make this information available to other projects.

The near term goal, however, is to load all the data for all 50 states 
into the database, and keep it updated. That's where you can come in:

If you're interested in helping this project by writing some scripts to 
get the information for your state, please reply to me off-list. I 
haven't worked everything out just yet, but essentially you'd be 
screen-scraping your state legislature's website and putting the 
information into a standard format, which would be loaded into the database.

Another way to help is to suggest new features. You can also be my BFF 
if you submit ideas on how to make the interface look better.

As always, any feedback at all is appreciated.

Thanks
--B

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: new Django site: critterwatch.org

2007-06-13 Thread Bryan L. Fordham

Michael Trier wrote:
> Nice work. You need someone to spice up the UI, but the content rocks.
>  Great job.
>
>   
Thanks

And yeah, I'm not a UI design guy. Given a design I can code it, but I 
suck at coming up with the design from scratch.

So if anyone on this list wants to donate a nice design, feel free 8)

--B

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: new Django site: critterwatch.org

2007-06-13 Thread Bryan L. Fordham

Jeremy Dunck wrote:
> Nice.  Screen-scraping the votes, or is there actually an API?
>   
Screen scraping, I'm afraid. Georgia was easy, which is nice since it 
was the logical place for me to start (I'm near Savannah, Ga.). Some 
other states, for instance South Carolina, have their Senate/House 
journals online, where I have to go through everything and find the votes.

One of my goals is to make a usable API for this stuff available.
> Consider mentioning on the GovTrack mailing list; there are people
> there interested in political transparency and a few that have
> specifically wanted to work on state-level legislatures.
>   
Nice, thanks. Didn't know that even existed.

Thanks
--B

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: new Django site: critterwatch.org

2007-06-13 Thread Bryan L. Fordham

Udi wrote:
> If I were you I'd get my hands on pictures of all of the "critters"
> and put them next to their names.  It'd spice up the UI a bit.
Good idea. I've considered it, but now I think I definitely will.

Thanks
--B

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



new Django site: critterwatch.org

2007-06-12 Thread Bryan L. Fordham

Not officially launched yet, but I'd appreciate some people banging on 
critterwatch.org and telling me what breaks.

It's a site to track how you state senators and congressmen vote. Right 
now it only has information for Georgia, but I'm working on adding the 
next state (namely, South Carolina) right now.

Thanks
--B

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Uploading Image, Marking a Field as True

2007-06-10 Thread Bryan Veloso

> I think you need to work on your workflow a little more. You will
> definitely need to play with views; I'm not sure what you think
> signals will acheive.
>
> You need to think in terms of "what HTML pages can I present to the
> user, in what order; and what conditions must be met to move from page
> 1 to page 2".
>
> The other red flag that is waving to me is the 'baseball_approved'
> attribute. From the description of your workflow, it isn't obvious
> that you actually want to/need to store unapproved objects in the
> database. If you don't need to, drop that flag, and just refrain from
> saving the model until you have an 'approvable' set of data.

Alright, let me explain it a little better without being so catious
about the nature of the app. This app will be storing scores from the
Wii game Wii Sports. So I essentially had thought that all 5 sports
would be on one page and people could input their scores and upload a
screenshot. Now, the reason the approved attribute is there is so if a
person's score is reported as fake (e.g., no screenshot or fake
screenshot), then I could it in the admin and the score would then be
taken out off the rankings page and marked to the user accordingly.

So it isn't so much a step 1, step 2, so much as each sport will have
it's own line with two fields, score and screenshot upload. This is
really the only way I could think of doing it (not being a programmer
by trade mind you). Thanks for the help so far though Russ.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Uploading Image, Marking a Field as True

2007-06-06 Thread Bryan Veloso

Alright, example model:

# Baseball
baseball = models.PositiveIntegerField('Baseball Skill Level',
blank=True, null=True, maxlength=4)
baseball_approved = models.BooleanField('Approved', default=False)
baseball_proof = models.ImageField('Proof', upload_to="/images/proof/
baseball", height_field='baseball_height',
width_field='baseball_width', blank=True)
baseball_width = models.IntegerField(blank=True, null=True,
editable=False)
baseball_height = models.IntegerField(blank=True, null=True,
editable=False)

Workflow is this:

1) Person inputs score.
2) Score isn't "valid" (meaning it won't show up on standings) if
'baseball_approved' is false. In order for the score to be approved,
they have to upload an image.
3) Person uploads an image.
4) 'baseball_approved' is marked true.

So, I'm thinking you need to play with views or signals or something
to do this. Any guidance?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: QuerySet Question - Selecting a Single Field

2007-06-05 Thread Bryan Veloso

> This will grab _all_ score objects, and sort them by baseball score.
> If there isn't a baseball score, then 'baseball' will have a value of
> None, which is still a sortable value.

Alright, so just to be safe, I really shouldn't be showing the values
for all players, since that risks showing values for the other sports
as well? Grabbing and sorting like this isn't an expensive task is it?

Would I use the same order_by functionality if I wanted to say...
compare a person's score to the highest? Like a percentile thing?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: QuerySet Question - Selecting a Single Field

2007-06-05 Thread Bryan Veloso

> Score.objects.order_by('-baseball')
>
> will return all the objects in reverse order.

Does this only grab the baseball scores? Or grabs all of them and THEN
sorts them by score?
(Just for future reference.)

> However, it looks like your table is intended to be at least partially
> sparse (i.e., every score  object doesn't have all the values). If
> this is the case, you may want to exclude some data from the list of
> objects:
>
> Score.objects.filter(baseball__isnull=False).order_by('baseball')
>
> will get all the objects that have a baseball score (i.e., the
> baseball score _isn't_ None), and orders them by the value of the
> baseball field.

This looks like what I need, I'll try it out! Thanks Russell!


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



QuerySet Question - Selecting a Single Field

2007-06-05 Thread Bryan Veloso

Alright, new problem for you guys. Here's an example model in an app
called "scores", which contains all the scores for a particular
player:

# Baseball
baseball= models.PositiveIntegerField('Baseball Skill
Level', blank=True, null=True, maxlength=4)
# Bowling
bowling = models.PositiveIntegerField('Bowling Skill
Level', blank=True, null=True, maxlength=4)
# Boxing
boxing  = models.PositiveIntegerField('Boxing Skill
Level', blank=True, null=True, maxlength=4)

(etc.)

Now, right now all the scores are lumped within this model. My
question comes in when trying to call these items in my views. Say if
I want to gather all the baseball scores and sort them. What would the
queryset call for that be? I've found things such as order_by and
such, but I usually just see ".all()", so would an easier way to do
this include splitting these up into separate models (which then
boggles my mind when I'm thinking of showing all of the inputs for
every model on a single page)?

This seems like my only roadblock before really getting somewhere with
this. So any and all help is apprecaited!


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Case insensitive urls

2007-06-02 Thread Bryan Chow

URLs should be unambiguous, i.e any logical piece of content should
have one and only one definitive URL, with any alternatives acting as
a permanent redirect.
http://simonwillison.net/2007/Feb/4/urls/

Therefore, rather than configuring urls.py to ignore case, a better
solution would be to use mod_rewrite to map the "wrong case" URLs to
the correct ones.

For example, you could configure mod_rewrite to convert all URLs to
lowercase.

RewriteEngine on
RewriteMap lowercase int:tolower
RewriteRule ^/(.*)$ /${lowercase:$1}

Hope this helps.

Bryan


On Jun 1, 6:35 pm, Ramashish Baranwal <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I would like to makeurlsof my sitecase-insensitive. As I
> understand, by default the url matching iscase-sensitive. Is there a
> way to specify in myurls.py that I want acase-insensitive match?
>
> Thanks,
> Ram


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MySQLdb Error

2007-05-15 Thread Bryan Veloso

It looks like you're using version 1.2.2. Try using 1.2.1_p2 and see
if that works, I had a problem similiar to yours and downgrading to
that version fixed my problem.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Feed Displaying Odd Dates

2007-05-13 Thread Bryan Veloso

That worked, -and- I learned something too!
Thank you for the advice. :D

Cheers,
Bryan


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How well should I know Python before using Django?

2007-05-10 Thread Bryan Veloso

> To use Django, a developer should have an  exceptionally strong
> knowledge of the following area(s) of Python: __
>
> dictionaries

Amen. Those things still baffle me a bit. Other than that, I'd say #1.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Feed Displaying Odd Dates

2007-05-10 Thread Bryan Veloso

> The secret is to look in the syndication documentation and search for
> the word "pubdate". There, it talks about the item_pubdate() method that
> can be used to generate the date for a single item.

I tried that, it'd be...

def item_pubdate(self)
return Entry.pub_date

But it'd give me errors about things being stupid. o_O;
Okay, errors about the object not having an attribute of pub_date.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   3   >