Re: passing request.user.id to a template tag

2009-07-16 Thread Kenneth Gonsalves
On Friday 17 Jul 2009 9:39:41 am James Bennett wrote: > On Thu, Jul 16, 2009 at 11:01 PM, Kenneth > > Gonsalves wrote: > > how do I pass request.user.id to a templatetag. if I do: > > > > {% get_menu request.user.id %} > > > > the string 'request..user.id' gets passed. > >

Re: passing request.user.id to a template tag

2009-07-16 Thread James Bennett
On Thu, Jul 16, 2009 at 11:01 PM, Kenneth Gonsalves wrote: > how do I pass request.user.id to a templatetag. if I do: > > {% get_menu request.user.id %} > > the string 'request..user.id' gets passed. You handle this by using the standard variable-resolution mechanism

passing request.user.id to a template tag

2009-07-16 Thread Kenneth Gonsalves
hi how do I pass request.user.id to a templatetag. if I do: {% get_menu request.user.id %} the string 'request..user.id' gets passed. -- regards kg http://lawgon.livejournal.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Related set need some impovement

2009-07-16 Thread Russell Keith-Magee
On Thu, Jul 16, 2009 at 9:00 PM, Ilya Novoselov wrote: > > I'm sorry if this have been discussed before. > > I have table A, which have foreign key foo to model B. > > When I query B related set trough B.a_set.all(). > When I iterate over b_instance.a_set.all() and

Non-editable (but visible) fields in admin?

2009-07-16 Thread Rubens Altimari
Hello, Is there a way to show model fields in admin, but prevent them from being edited? Using 'editable=False' in the model won't do, since then the field simply is not displayed. Also, on a related topic: is there a simple way to allow the user to set a certain field when *creating* a new

Re: Graphing (Pie Chart, Bar Graphs, Line Plots, etc) in Django?

2009-07-16 Thread carlos
yes man a have various for example : [1] pygooglechart, [2] PyOFC2, and library [3] ReportLab [1]. http://pygooglechart.slowchop.com/ [2]. http://btbytes.github.com/pyofc2/ [3]. http://www.reportlab.org/ good luck 2009/7/16 Keith Pettit > What is the best way to create

Re: Handling Varying Number of Fields in Model Form

2009-07-16 Thread Streamweaver
This seems hacky but it's something I've come up with so far that seems to do what I need it to. I have some issues with permissiosn to display still but I'm working on it. My veiw method is as follows: @login_required @has_perm_or_owner_of('can change release', Release) def

Re: How do you unit test forms

2009-07-16 Thread Russell Keith-Magee
On Fri, Jul 17, 2009 at 9:56 AM, Joshua Partogi wrote: > Hi Russ, > > To expand this question. Do we use unittest for testing forms? Because from > what I see in the code, doctest only tests your model. CMIIW. I shall. I don't know where you got that idea. :-) doctests

Re: How do you unit test forms

2009-07-16 Thread Joshua Partogi
Hi Russ, To expand this question. Do we use unittest for testing forms? Because from what I see in the code, doctest only tests your model. CMIIW. Kind Regards, On Fri, Jul 17, 2009 at 10:11 AM, Russell Keith-Magee < freakboy3...@gmail.com> wrote: > > On Thu, Jul 16, 2009 at 10:46 PM, Joshua

Re: question about the DEBUG setting

2009-07-16 Thread Earl Lapus
> > > > Make the code dependent on checking settings.DEBUG directly? > > Karen > > Oh, I didn't know that my app can get the settings.DEBUG value... I'll try this out, I think this will do. Thanks! -- There are seven words in this sentence. --~--~-~--~~~---~--~~

Re: syncdb and #10706

2009-07-16 Thread Kenneth Gonsalves
On Wednesday 15 Jul 2009 4:54:11 am Kenneth Gonsalves wrote: > I find that syncdb fails silently to create tables for apps that give the > misleading error message described in #10706. I cannot find a ticket for > that. Should one be filed, or have I missed it? since no one has replied I have

Re: Current user in model.save() context

2009-07-16 Thread Phil
Hi Josh, unfortunately it seems that there is no way to do so. As you've noticed that correctly you can use request (request.user) in any place but model save. most likely that will be view: --- if form.is_valid(): newObj = form.save(commit=False) newObj.user =

Re: Model save() weird behaviour

2009-07-16 Thread Phil
oh, sorry for that - exampling mistake, should be: class Page(models.Model): title = models.CharField(_(u"Title"), max_length=50) fulltitle = models.CharField(_(u"Full Title"), max_length=50) ... def save(): # title is received from a form, say i've entered 'QWERTY'

Re: How do you unit test forms

2009-07-16 Thread Russell Keith-Magee
On Thu, Jul 16, 2009 at 10:46 PM, Joshua Russo wrote: > > I want to test my forms but I'm not sure the best way to go about it. > It seems like it might be similar to views but I can't find much > discussion of form testing in any of the discussions about unit > testing. >

Re: ModelForm and Form is_bound issue

2009-07-16 Thread Vitaly Babiy
Sorry this was my fault, didn't test my test case. It was a bug in my test code. Thanks any way Vitaly Babiy On Thu, Jul 16, 2009 at 1:23 PM, Karen Tracey wrote: > On Thu, Jul 16, 2009 at 8:53 AM, Vitaly Babiy wrote: > >> Hello everyone, >> [snip] >>

Create Default ManyToManyField Values ?

2009-07-16 Thread thornomad
Hi - Is there a simple way (or maybe, not so simple) to create default values for a ManyToManyField ? My usage is pretty basic (and maybe common, which is why I wonder if it's been explored) ... I want my users to have to "opt-out" of email subscriptions in their UserProfile, rather than

Problem with map widget on admin change page (GIS / OpenLayers)

2009-07-16 Thread intrepidweb
Hi there, I have a model called Locality that has a coordinates field. When I view the admin change form for the model, the mapping widget appears, but the actual map is grayed out. For example, for Atlanta, GA, the coordinates are 33.69132, -84.40137. When the OpenLayers map widget is

Re: Problem sending json objects

2009-07-16 Thread djfis...@gmail.com
Gustavo, I believe this is a problem (feature?) of jquery. It is not serializing your full settings object to a string. Instead, it creates a series of url-encoded key value pairs. It looks like it is just calling .toString() on the value side as well. When .toString() is called on: {"id":

Re: Dict objects are unhashable errors

2009-07-16 Thread Some Guy
good question! I was basing it off the docs (or so I thought) on generic views. django urls.py has never been very intuitive for me, so I rely on copying from the docs pretty heavily. I guess it got mangled at some stage... thanks for the link tho. :) On Jul 16, 2:15 pm, Alex Koshelev

Re: How to access fields of custom intermediary table

2009-07-16 Thread mike
On Jul 16, 12:06 pm, Tom Evans wrote: > > My question is:  How do I access the extra fields stored in my custom > > intermediate table?  In this case that would be the count field.  I > > have search the Django documentation but so far I haven't found any > > examples.

Current user in model.save() context

2009-07-16 Thread Joshua Russo
I think I might be overlooking something simple here. I have a set of 4 fields in almost every table (user create & modified and date create & modified). The date (datetime) is easy with auto_now and auto_now_add options. The user has been much trickier. I can't figure out how (if possible) to

Graphing (Pie Chart, Bar Graphs, Line Plots, etc) in Django?

2009-07-16 Thread Keith Pettit
What is the best way to create Pie Charts, Bar Graphs, Line Plots, etc? I've only seen two Django graph type modules but they seem dead. Are they any Python modules or other type of graphing apps that would work well with Django? Thanks, -- Keith Pettit

Re: Dict objects are unhashable errors

2009-07-16 Thread Alex Koshelev
On Fri, Jul 17, 2009 at 1:07 AM, Some Guy wrote: > > Found out what was causing this error behavior. > > this line was in my urls.py.. commenting it out fixed everything. I > just can't see what's wrong with it :-) > > #(r'^diamond/(?P\d+)/$', 'object_detail', info_dict,

Re: Dict objects are unhashable errors

2009-07-16 Thread Some Guy
Found out what was causing this error behavior. this line was in my urls.py.. commenting it out fixed everything. I just can't see what's wrong with it :-) #(r'^diamond/(?P\d+)/$', 'object_detail', info_dict, {'template': 'diamond_detail.html'}), On Jul 15, 12:14 pm, Some Guy

Dict objects are unhashable errors (FOUND THE BUG anyone know why?)

2009-07-16 Thread Some Guy
Hi Group, I found a bug that was causing my issue (ref: http://groups.google.com/group/django-users/browse_thread/thread/130f36db5e95bd81) In my urls.py I have a line ... (r'^diamond/(?P\d+)/$', 'object_detail', info_dict, {'template': 'diamond_detail.html'}), If I comment it out it,

Re: Manage Multiple floatfields in admin

2009-07-16 Thread hcsturix74
Great ringemup, I'll try I use stackedinline for other apps, forgot tabular in the meanwhile ;) thanks. On 16 Lug, 21:45, ringemup wrote: > Have you considered using a related model to store all your floats? > Then you could use a tabular inline in teh admin. > > On Jul

Re: New to unit testing, need advice

2009-07-16 Thread Joshua Russo
Great ideas! I've started moving some of my logic that I had in admin.py and views.py into model.py and things are already starting to look easier in terms of testing. My only real hurdle now is testing validation logic on the admin pages and the form creation logic that is the main page to the

Problem sending json objects

2009-07-16 Thread Gustavo Henrique
Hi list! I'm a problem with json and django. My javascript code send all data by ajax but my view don't accept the content [Object Object] like json object. I try using jquery: settings = { model_name: 'Client', cols: {"id": {"label":"", "width":"10px"}, "name": {"label":"Nome",

Handling Varying Number of Fields in Model Form

2009-07-16 Thread Streamweaver
I have a model with a number of attributes (some included as example below): class Release(models.Model): project_fk = models.ForeignKey(Project) title = models.CharField(max_length=30) summary = models.TextField() owner = models.ForeignKey(User) planning_status =

Re: Manage Multiple floatfields in admin

2009-07-16 Thread ringemup
Have you considered using a related model to store all your floats? Then you could use a tabular inline in teh admin. On Jul 16, 2:28 pm, hcsturix74 wrote: > Hi all, > I am creating a model in django containing some (i.e. 100 ) float > values such as: > > class

ordering problem

2009-07-16 Thread onoxo
Hi! I'm having a problem with drag'n'drop ordering of model "PhotoSetPhotoItem". I'm using the solution with jQuery and it's working ok (reordering) when i have a models.CharField where i manualy write unique string (without seting it as PK). when i dont have it reorders visualy but when i save

Re: problems with large data

2009-07-16 Thread Ryan K
I'm starting to see that I too need to participate in Django sprints to help incorperate the features I want in Django and I think we all should and perhaps you do which is great. This is great software there is still a lot of work to be done. Ryan Kaskel http://consulting.ryankaskel.com/ On

.values('model__field')

2009-07-16 Thread notcourage
You can write: ...select_related('model').order_by('model__field') This avoids writing ugly .extra() code. You can't write: ...select_related('model').values('model__field') Does anybody else think this would be nice? On another topic, I'd like to write model methods which invoke custom SQL

Manage Multiple floatfields in admin

2009-07-16 Thread hcsturix74
Hi all, I am creating a model in django containing some (i.e. 100 ) float values such as: class DataMeasure(models.Model): measure_name = models.CharField(max_length=50, verbose_name= (u'name')) measure_type = models.CharField(max_length=50, verbose_name= (u'type'))

Re: problems with large data

2009-07-16 Thread Petry
Hi Ian I had been looking on django source and I changed some attributes on base.py file see this[1] ticket, it is works fine for me! [1] http://code.djangoproject.com/ticket/11487 On 16 jul, 13:15, Ian Kelly wrote: > On Jul 16, 7:51 am, Petry

Re: I need to get psycopg2 installed on Mac OS X 10.5

2009-07-16 Thread Dhruv Adhia
Yep :) also check >>> psycopg2.__version__ '2.0.8 (dec mx dt ext pq3)' (This is on ubuntu, but you should see version if its installed correctly) Dhruv Adhia http://thirdimension.com On Thu, Jul 16, 2009 at 9:46 AM, Dave Everitt wrote: > > I've just done this after

urlize and links in new tabs/windows

2009-07-16 Thread Fish-Guy
Hi, Is there an easy way of making links parsed with urlize open in new tabs/windows? I see in utils/html.py there is call for a NoFollow to be inserted, was not sure if there was an easy way to add this with a function call, or if I had to modify the code there a little to make it work. Thanks.

Re: I need to get psycopg2 installed on Mac OS X 10.5

2009-07-16 Thread Dave Everitt
I've just done this after installing Postgresql (BTW and letting it mess with my OS X memory settings): Added path to .bash_login (or .bash_profile) export PATH="/Library/PostgreSQL/8.4/bin:$PATH" sudo easy_install psycopg2 Password: Searching for psycopg2 Reading

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Tim Chase
> The first problem is that the django server only receives the '/page' > part of the URL. The browser itself holds onto the '#hash' part and > doesn't transmit that to the django server at all, so the > login_required() decorator calls request.get_full_path() and gets '/ > page', so that's what

Re: problems with large data

2009-07-16 Thread Ian Kelly
On Jul 16, 7:51 am, Petry wrote: > Hello, > > I am working on a project where I have to store a large amount of > content, (html) in a record from a table, I am using Oracle as the > database > > What is very strange ... is put a text reasonably small, (around 2000 >

Formsets with many to many relationship

2009-07-16 Thread Justin
I am trying to figure out the best way to have an inline formset with a many to many relationship. Right now I am the relationship is through a intermediate model as shown here in the docs http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships. It

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 4:08 PM, Tom Evans wrote: >> 1: no #section1 in the HTML => Django is losing it, should be fixed > > Re-read the thread. The #part of the URL is not something ever > transmitted beyond the browser. No web application ever sees the #part > of a

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Michael
On Thu, Jul 16, 2009 at 12:00 PM, Javier Guerra wrote: > > On Thu, Jul 16, 2009 at 3:51 PM, Michael wrote: > > This information isn't transmitted to the server in anyway so short of > what > > you described above, Django can't really solve your issue. >

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Tom Evans
On Thu, 2009-07-16 at 16:00 +, Javier Guerra wrote: > On Thu, Jul 16, 2009 at 3:51 PM, Michael wrote: > > This information isn't transmitted to the server in anyway so short of what > > you described above, Django can't really solve your issue. > > but where is it

Re: How to access fields of custom intermediary table

2009-07-16 Thread Tom Evans
On Thu, 2009-07-16 at 08:30 -0700, mike wrote: > Hi, > > I have the following models: > > class Memory(models.Model): > partnum = models.CharField(max_length=30) > size = models.IntegerField() > > def __unicode__(self): > return self.partnum > > class

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 3:51 PM, Michael wrote: > This information isn't transmitted to the server in anyway so short of what > you described above, Django can't really solve your issue. but where is it getting lost? i mean, what does the html looks like? does it have the

Re: Accessing Form Data in Form Object

2009-07-16 Thread Tom Evans
On Thu, 2009-07-16 at 07:37 -0700, clea wrote: > Hello- > So I have the following issue and have not been able to find a > solution to it anywhere! I have the following ModelForm object: > > class OptionForm(ModelForm): > class Meta: > model = Option > > based on the

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Michael
On Thu, Jul 16, 2009 at 11:18 AM, Jumpfroggy wrote: > > On Jul 16, 11:05 am, Javier Guerra wrote: > > maybe urlencode()'ing the '/page#section1' parameter? > > The first problem is that the django server only receives the '/page' > part of the URL.

OneToOneField - IntegrityError: PRIMARY KEY must be unique

2009-07-16 Thread Viktor
Hi, I have the following two models: class AcceptedRoleAbstract(models.Model): ''' Represents a User that should accept a role E.g.: Discussant, Reviewer ''' user = models.ForeignKey(User) accepted = models.NullBooleanField(help_text=_("The reviewer agreed to make the

How to access fields of custom intermediary table

2009-07-16 Thread mike
Hi, I have the following models: class Memory(models.Model): partnum = models.CharField(max_length=30) size = models.IntegerField() def __unicode__(self): return self.partnum class Motherboard(models.Model): name = models.CharField(max_length=20) sockets =

Accessing Form Data in Form Object

2009-07-16 Thread clea
Hello- So I have the following issue and have not been able to find a solution to it anywhere! I have the following ModelForm object: class OptionForm(ModelForm): class Meta: model = Option based on the following Option object: class Option(models.Model): stem =

How to access fields of custom intermediary table

2009-07-16 Thread mike
Hi, I have the following models: class Memory(models.Model): partnum = models.CharField(max_length=30) size = models.IntegerField() def __unicode__(self): return self.partnum class Motherboard(models.Model): name = models.CharField(max_length=20) sockets =

Re: New to unit testing, need advice

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 3:16 PM, Jumpfroggy wrote: > You could put all these functions into the > models.py file if you wanted, you'd just end up with huge models.py > objects, and you might also run into cases where there is not an > obvious place to put a bit of

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Jumpfroggy
On Jul 16, 11:05 am, Javier Guerra wrote: > maybe urlencode()'ing the '/page#section1' parameter? The first problem is that the django server only receives the '/page' part of the URL. The browser itself holds onto the '#hash' part and doesn't transmit that to the django

Re: New to unit testing, need advice

2009-07-16 Thread Jumpfroggy
> besides the testing issues (which are certainly a heated debate!), i have to > say that my Django projects became far better organized and a lot more > flexible when i learned to put most of the code on the models, and not on the > views. This is a pretty interesting topic. Coming from a

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 2:58 PM, Jumpfroggy wrote: > > Currently, the @login_required() decorator does not preserve any #hash > part of the URL.  So if I go to /page#section1 without being logged > in, I'm redirected to /login?next=/page#section1.  After logging in, > I'm

Using the @login_required() decorator with #hash url's

2009-07-16 Thread Jumpfroggy
Currently, the @login_required() decorator does not preserve any #hash part of the URL. So if I go to /page#section1 without being logged in, I'm redirected to /login?next=/page#section1. After logging in, I'm redirected to /page (without the hash part). I read in another thread here that the

Re: New to unit testing, need advice

2009-07-16 Thread Joshua Russo
On Jul 16, 1:35 pm, Javier Guerra wrote: > On Thu, Jul 16, 2009 at 9:27 AM, Joshua Russo wrote: > > What are some examples of mutating operations (and other operations > > for that matter) that you use in your models? > > the most obvious are: > > -

How do you unit test forms

2009-07-16 Thread Joshua Russo
I want to test my forms but I'm not sure the best way to go about it. It seems like it might be similar to views but I can't find much discussion of form testing in any of the discussions about unit testing. Any suggestions are much appreciated. Thanks Josh

Re: QuerySet rendering

2009-07-16 Thread Mihail Lukin
Thanks, Alex! I met something about django-tables somewhere and looks good. I wonder why it is not a part of djangoproject. On Jul 14, 1:55 am, Alex Gaynor wrote: > On Mon, Jul 13, 2009 at 2:48 PM, Mihail Lukin > wrote: > > > > > > > Hello,

Re: New to unit testing, need advice

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 9:27 AM, Joshua Russo wrote: > What are some examples of mutating operations (and other operations > for that matter) that you use in your models? the most obvious are: - 'calculated' fields. the first example is the __unicode__() method, but

[SQL] create a database on the fly

2009-07-16 Thread sebastien requiem
Hi guys, my problem may be python only related but I dare posting here anyway. I try to create databases on the fly according to some user input. After searching on the net, I realized that I can't use the following statement as %s will be replaced by '%s'. And "CREATE DATABASE" statement

Re: [SQL] create a database on the fly

2009-07-16 Thread sebastien requiem
On Thu, Jul 16, 2009 at 4:04 PM, sebastien requiem wrote: > Hi guys, > > > my problem may be python only related but I dare posting here anyway. > > I try to create databases on the fly according to some user input. > After searching on the net, I realized that I can't use

Re: Saving Data To Your DB. Simple?

2009-07-16 Thread Russell Keith-Magee
On Thu, Jul 16, 2009 at 9:27 PM, The Danny Bos wrote: > > So, I'm guessing this is impossible. I'm guessing you need to have a little patience. This is a volunteer list. Sometimes, when you don't get an answer, it's because the people who are in a position to answer your

raw_id_fields, get atribute name and number, how to?

2009-07-16 Thread onoxo
I'm using raw_id_fields in admin.py the question, how could i get the Poll question atribute and the number in admin? number is ok but it would be better if i could get more info than that... can i create a new class atribute in models.py and refer to Poll class? something like this: tempPoll =

problems with large data

2009-07-16 Thread Petry
Hello, I am working on a project where I have to store a large amount of content, (html) in a record from a table, I am using Oracle as the database What is very strange ... is put a text reasonably small, (around 2000 characters) and it works correctly, save without problems, but doubling this

Re: Saving Data To Your DB. Simple?

2009-07-16 Thread The Danny Bos
So, I'm guessing this is impossible. Any ideas would be great ... d On Jul 16, 11:52 am, The Danny Bos wrote: > Hopefully my last question on this, > How do I get back to the page with the form, perhaps with a "Thank > You" message, without having the POST still

Re: question about the DEBUG setting

2009-07-16 Thread Karen Tracey
On Thu, Jul 16, 2009 at 8:22 AM, Earl Lapus wrote: > hi all, > > This is a silly newbie question, so please bear with me :D > > Example: > ... > def DoSomethingAwful(request): > if __debug__: > DoDebugStuff() > ProcessRequest() > ... > > In the example above, I want

Re: ModelForm and Form is_bound issue

2009-07-16 Thread Karen Tracey
On Thu, Jul 16, 2009 at 8:53 AM, Vitaly Babiy wrote: > Hello everyone, > [snip] > Now lets try it with a ModelForm > > class UserForm(forms.ModelForm): > class Meta: > model=User > fields= ('first_name',) > > >>> form = UserForm() > >>> form.is_bound >

Re: __init__() got an unexpected keyword argument 'raw_id_admin'

2009-07-16 Thread onoxo
that's it tnx! On Jul 16, 1:42 pm, Karen Tracey wrote: > On Thu, Jul 16, 2009 at 7:04 AM, onoxo wrote: > > > Hi! > > i'm having problem with raw_id_admin argument in aplication from the > > djangoproject tutorial. only difference from orginal app is

Re: How to save Unicode data to mysql database?

2009-07-16 Thread Vitaly Babiy
Make your your database tables are using utf-8. Here is a great post about the topic http://blog.awarelabs.com/2008/django-tips-utf-8-ascii-encoding-errors-urllib2-and-mysql/ Vitaly Babiy On Thu, Jul 16, 2009 at 1:03 PM, Qixing DU wrote: > > Dear All, > > I need to handle

How to save Unicode data to mysql database?

2009-07-16 Thread Qixing DU
Dear All, I need to handle non-latin code. But encountered an error looking like: "Data too long for column 'user_name' at row 1" The username is: user_name = u'frank' The database is mysql 5.0. I didn't find anything useful via google. Is this a known issue in Django? How to fix it? Thank

Re: Strange Error Related to DjangoUnicodeDecodeError

2009-07-16 Thread Karen Tracey
On Thu, Jul 16, 2009 at 4:59 AM, jfergon wrote: > > Hi, > > I'm working on Django-postgreSQL, and I can't solve a problem. This is > my models.py: > > from django.db import models > from datetime import datetime > > class Event(models.Model): >title =

Related set need some impovement

2009-07-16 Thread Ilya Novoselov
I'm sorry if this have been discussed before. I have table A, which have foreign key foo to model B. When I query B related set trough B.a_set.all(). When I iterate over b_instance.a_set.all() and access foo member, Django doesn't hesitate to make database query to retrieve B again and again.

ModelForm and Form is_bound issue

2009-07-16 Thread Vitaly Babiy
Hello everyone, If you take a form like this: class EmailForm(forms.Form): email = froms.EmailField() >>> form = EmailForm() >>> form.is_bound False >>> form = EmailForm({}) >>> form.is_bound True That works great Now lets try it with a ModelForm class UserForm(forms.ModelForm): class

Re: New to unit testing, need advice

2009-07-16 Thread Alex Robbins
Whenever I do the same query in a couple of different views, I try to pull it out into a manager method[1]. For instance, get all the stories that are marked published from the last two days. I would make this a method on the manager so I can reuse it other places. Then I write a test for that

Re: removable file field?

2009-07-16 Thread Michael Stevens
I found something that's working for me now: http://code.djangoproject.com/ticket/7968 Although I had to modify the save method slightly to add commit. 2009/7/16 Michael Stevens : > Does anyone have a removable file field definition for django 1.1? > > I found

question about the DEBUG setting

2009-07-16 Thread Earl Lapus
hi all, This is a silly newbie question, so please bear with me :D Example: ... def DoSomethingAwful(request): if __debug__: DoDebugStuff() ProcessRequest() ... In the example above, I want django to call DoDebugStuff() *ONLY* if I'm running my app on my development environment. So, my

Re: Model save() weird behaviour

2009-07-16 Thread Karen Tracey
On Thu, Jul 16, 2009 at 7:09 AM, Phil wrote: > > Hi All, > > noticed an interesting behaviour in model save: > > class Page(models.Model): >title = models.CharField(_(u"Title"), max_length=50) >fulltitle = models.CharField(_(u"Full Title"), max_length=50) > ... > >

Re: __init__() got an unexpected keyword argument 'raw_id_admin'

2009-07-16 Thread Karen Tracey
On Thu, Jul 16, 2009 at 7:04 AM, onoxo wrote: > > Hi! > i'm having problem with raw_id_admin argument in aplication from the > djangoproject tutorial. only difference from orginal app is in the > raw_id_admin in Choice model > raw_id_admin was a model field argument in

removable file field?

2009-07-16 Thread Michael Stevens
Does anyone have a removable file field definition for django 1.1? I found http://www.djangosnippets.org/snippets/636/ which is exactly what I want but it seems to have the key flaw of giving server errors on current django. Michael --~--~-~--~~~---~--~~ You

Re: usernames for auth.User are too restrictive for my company's clients

2009-07-16 Thread Phil
Hi Andrew, like just posted that in here: http://groups.google.com/group/django-users/browse_thread/thread/81d856b37b979d0c?hl=en you may allow user to enter name, surname, email using standard Django User class (has email, and lastname, firstname fields) but hide username field and then

Re: email as username, issue with admin page

2009-07-16 Thread Phil
Hi, as a simple idea you may overcome that by prompting user to enter email and then generate username for a User model, if you mean it, yourself. Of course you can leave option to enter username, but leave email as required or allow to enter any of those in the same field. Kind of 'slugify'

Model save() weird behaviour

2009-07-16 Thread Phil
Hi All, noticed an interesting behaviour in model save: class Page(models.Model): title = models.CharField(_(u"Title"), max_length=50) fulltitle = models.CharField(_(u"Full Title"), max_length=50) ... def save(): # title is received from a form, say i've entered 'QWERTY'

__init__() got an unexpected keyword argument 'raw_id_admin'

2009-07-16 Thread onoxo
Hi! i'm having problem with raw_id_admin argument in aplication from the djangoproject tutorial. only difference from orginal app is in the raw_id_admin in Choice model # this is the model.py: from django.db import models class Poll(models.Model): question =

Generating forms question.

2009-07-16 Thread Viacheslav Chumushuk
Hello. I have one problem with forms, which I can't resolve. I was looking at official documentation, searching in web, but didn't found solution. So, problem is next. I have two models: class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model):

Re: syncdb doesn't updated database after adding null=True to an IntegerField

2009-07-16 Thread Ramiro Morales
On Wed, Jul 15, 2009 at 11:33 PM, Ben wrote: > > I'm using the admin site. I noticed that I couldn't leave an > IntegerField empty even when I had "year = models.IntegerField > (blank=True)". I googled and found out I should set null=True as well. > I did this, ran

Re: New to unit testing, need advice

2009-07-16 Thread Joshua Russo
> besides the testing issues (which are certainly a heated debate!), i have to > say that my Django projects became far better organized and a lot more > flexible when i learned to put most of the code on the models, and not on the > views. I find this really interesting because I wanted to

email as username, issue with admin page

2009-07-16 Thread selcukcihan
Hi, i am using email as username. Both username and email fields in User model always have the same value which is an email. >From previous posts and code snippets, i got logins authentication and other stuff working. However, i just can't seem to get the admin page to create/modify user's whose

Re: accessing multiple dbs?

2009-07-16 Thread Emily Rodgers
On Jul 15, 5:43 pm, Alex Gaynor wrote: > On Wed, Jul 15, 2009 at 11:35 AM, Emily Rodgers < > > > > emily.kate.rodg...@googlemail.com> wrote: > > > On Jul 15, 4:19 pm, Emily Rodgers > > wrote: > > > On Jul 15, 2:46 pm, "Richard E.

Strange Error Related to DjangoUnicodeDecodeError

2009-07-16 Thread jfergon
Hi, I'm working on Django-postgreSQL, and I can't solve a problem. This is my models.py: from django.db import models from datetime import datetime class Event(models.Model): title = models.TextField(max_length=50,null=False) celebration =

Re: post_save signal bug

2009-07-16 Thread Ryan K
What I tried to build is stopped by the fact that I am incorrectly assuming that a ManyToMany field is updated at the time Menu.save() is called (or post_save signal handler called in this case). These two methods of customizing what happens after you save an object DO NOT apply to ManyToMany

Re: django-logging and python logging together

2009-07-16 Thread Rodrigue
Am I the only one thinking about using both django-logging and the logging module from the standard library at the same time? I find it useful to not have to dig into a log file while I'm developing or debugging, but I still want to have my logs written to disk on production though. Is there a

Re: Separate QuerySet into different lists inside templates

2009-07-16 Thread Streamweaver
Why do it inside the template? Do it inside the view and pass each resultant queryset to the template. On Jul 16, 1:59 am, ZebraShaSha wrote: > This seems like a simple question, but it's been bugging me for days > now. I have two models, Events and Categories, where

Re: New to unit testing, need advice

2009-07-16 Thread Daniel Roseman
On Jul 16, 1:20 am, Joshua Russo wrote: > I'm in the process of implementing testing (both doc tests and unit > tests) though I'm having some conceptual difficulty. I'm not sure how > far to take the testing. I'm curious what people concider an > appropriate level of

Re: User extension problems

2009-07-16 Thread jagot
No ideas? I've managed to display some data from the user profile in the list_display by using custom methods in the admin class, but that way the fields are unsortable/unsearchable and impossible to filter with, since Django does the sorting on database level. Cheers, Jagot

Re: Done? Database -> Python objects -> JSON -> JavaScript 'class instances'

2009-07-16 Thread jfine
Hello Russell On Jul 16, 12:49 am, Russell Keith-Magee wrote: > Sure, this _could_ be done. You can write and install custom > serializer - you just need to work out exactly how a random database > object is realized as a JavaScript object. The existing serializers >

Separate QuerySet into different lists inside templates

2009-07-16 Thread ZebraShaSha
This seems like a simple question, but it's been bugging me for days now. I have two models, Events and Categories, where Events has a FKF to Categories. I'm using django-Agenda, an add-on that I've modified with the categories model, so all the views/urls are perfect in every other way except

Re: syncdb doesn't updated database after adding null=True to an IntegerField

2009-07-16 Thread chefsmart
>Is syncdb supposed to fully sync the database to the model >definitions? syncdb does not do that. I also often got confused about syncdb, but now I never forget that syncdb currently does not help propagate _modifications_ to models to your database. If you add a new model or delete an existing

Re: Firefox doesn't receive response

2009-07-16 Thread alecs
After switching OFF firepy (!!!) everything works OK. It seems to me that it's a firephp addon bug when it receives great array of data. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

  1   2   >