Re: MEDIA and STATIC in a nutshell?

2011-05-14 Thread Eiji Kobayashi
Exactly. Perhaps we should just ignore MEDIA and STATIC variable setup in the settings file altogether. When I couldn't get the variables to work like how I thought they should work, I just put the following stuff in the Apache vhost config file: Alias /media /Users/eiji/Sites/assets/media Alias

Re: How to choose a license for an app or a project?

2011-05-14 Thread Boštjan Mejak
So if I use the BSD license as Django does, do I need to (according to this license) disclose my source code or not? Which BSD license is Django using anyway? Clause 3? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Jinja2 template loader for django

2011-05-14 Thread Alexander Schepanovski
Not a question, just a piece of code. Feel free to use it. And any feedback will be appreciated. Starting from Django 1.2 you can create your custom template loader that returns your Template object. Doing that you can make django's render_to_response, render_to_string and counterparts render usin

Re: Why is request.session.flush() deleting my objects from DB?

2011-05-14 Thread ekms
I debugged it step by step and the data dissapears from DB in the line of session.flush() The data are three models that I created, and instances of these models are saved in the form. The difference between these models and others saved but not deleted by flush(), is that these 3 models have fore

Re: Why is request.session.flush() deleting my objects from DB?

2011-05-14 Thread ekms
ok, I spot the bug. In one of these models, I have a foreign key to Session model. So, when I do session.flush(), on cascade deleted all the related models. thank you for your time. On May 14, 3:15 pm, ekms wrote: > I debugged it step by step and the data dissapears from DB in the line > of sess

django-jython develop server don't respond

2011-05-14 Thread Amedeo
Hi, I work to a project on my laptop in with I installed django-jython under Archlinux, and all work correctly. After some problem with my project, i try to install django-jython under one other pc in with runs OpenSuse. I installed jython from the installer in the jython web-site. I installed and

[help]django's FloatField can't insert the mysql's double type data.

2011-05-14 Thread Korobase
Hi,all! I use the django admin interface to insert a record to the mysql database, While the field is FloatField in django and the mysql field show a double type, But when I click the save button,it tell me that: Environment: Request Method: POST Request URL: http://localhost:8080/admin/main/lea

Re: Built-in login form via inclusion tag

2011-05-14 Thread Gabe
Any advice? Do I have to do new form? Gabe On 13 Maj, 14:55, Gabe wrote: > Hi, > > what I am trying to do is to put a login box which will use > django.contrib.auth.views.login. According to documentation I`ve > crated inclusion tag which works, but it only views form sumbit button > not a whole

Re: [help]django's FloatField can't insert the mysql's double type data.

2011-05-14 Thread Andy McKay
> Exception Type: TypeError at /admin/main/learndjango/add/ > Exception Value: 'float' object is not callable Please paste your model that is having the problem. -- Andy McKay a...@clearwind.ca twitter: @andymckay -- You received this message because you are subscribed to the Google Gr

Re: MEDIA and STATIC in a nutshell?

2011-05-14 Thread Shawn Milochik
It sounds like all your issues with these features are a result of not reading the documentation. Feel free to ignore these optional features and do things the hard way if you feel like it. On the other hand, you could invest a small amount of time in understanding them and get the benefits.

Re: How to choose a license for an app or a project?

2011-05-14 Thread Bjarni Rúnar Einarsson
On Sat, May 14, 2011 at 1:38 AM, Kenneth Gonsalves wrote: > On Fri, 2011-05-13 at 12:23 +, Bjarni Rúnar Einarsson wrote: > > Other random points: Generally speaking, I prefer the more recent, > > modern > > licenses (GPLv3 instead of GPLv2, Apache instead of BSD) because they > > do a > > bett

Re: How to choose a license for an app or a project?

2011-05-14 Thread Bjarni Rúnar Einarsson
Hi Bostjan, I think you are misunderstanding one basic thing. You do not NEED a license for your own code. By default, program code is protected by copyright in most parts of the world. Licenses clarify or renounce some or all of the protections of copyright and patent law, and they only matter

Re: How to choose a license for an app or a project?

2011-05-14 Thread Boštjan Mejak
Say I create an app in Python and wxPython (a Python GUI framework). And then I upload my installation binaries (binaries created with py2exe and setup made with Inno Setup) to, say, Google Code. I don't want to dislose my source code. I just want my users to download the setup program and use my p

Django app models

2011-05-14 Thread augdawg
Hey all, I have a Django project where I need to access another apps models. The problem is that I cannot directly import the model that I need from the app that needs to access it (I'm pretty sure that I need it for a ForeignKey field or similar). Is there any way that I can fix this besides movin

Re: Django app models

2011-05-14 Thread Shawn Milochik
All you should need is for the external app to be somewhere on your PYTHONPATH. Then you can add it to INSTALLED_APPS in settings.py and you'll be all set. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to d

Re: Django app models

2011-05-14 Thread augdawg
I can add it to my PYTHONPATH by doing 'export PYTHONPATH=""' right? -- 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+

Re: Django app models

2011-05-14 Thread Shawn Milochik
On 05/14/2011 04:25 PM, augdawg wrote: I can add it to my PYTHONPATH by doing 'export PYTHONPATH=""' right? Yes, but you might want to just append it to your PYTHONPATH, in case there's already something there you don't want to lose. Like this: export PYTHONPATH=$PYTHONPATH; Maybe even pu

form new versus edit

2011-05-14 Thread Greg Donald
I have a "new" contact form. If I post it, and it has error, I found (while debugging, not documented that I can find) that I can redraw the submitted form data using form.name.data like this: But, if I use that same form model in my "edit" contact form, form.name.data is None. Why is that?

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 05:04 PM, Greg Donald wrote: I have a "new" contact form. If I post it, and it has error, I found (while debugging, not documented that I can find) that I can redraw the submitted form data using form.name.data like this: The problem is that you're doing this at all. You shoul

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 4:08 PM, Shawn Milochik wrote: > On 05/14/2011 05:04 PM, Greg Donald wrote: >> >> I have a "new" contact form.  If I post it, and it has error, I found >> (while debugging, not documented that I can find) that I can redraw >> the submitted form data using form.name.data lik

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 05:14 PM, Greg Donald wrote: On Sat, May 14, 2011 at 4:08 PM, Shawn Milochik wrote: On 05/14/2011 05:04 PM, Greg Donald wrote: I have a "new" contact form. If I post it, and it has error, I found (while debugging, not documented that I can find) that I can redraw the submitted f

Re: form new versus edit

2011-05-14 Thread Daniel Roseman
On Saturday, 14 May 2011 22:14:38 UTC+1, Greg Donald wrote: > > On Sat, May 14, 2011 at 4:08 PM, Shawn Milochik > wrote: > > The problem is that you're doing this at all. You should instead be using > {{ > > form.name }} to put the field in the form. > > > Well that works for the vanilla case b

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 4:22 PM, Daniel Roseman wrote: > Which is what Shawn said. If you follow the pattern described in the > excellent documentation, you'll see that there's no reason to try and > reference the form's data, as the form will re-render itself anyway if > validation fails. And the

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 05:33 PM, Greg Donald wrote: On Sat, May 14, 2011 at 4:22 PM, Daniel Roseman wrote: Which is what Shawn said. If you follow the pattern described in the excellent documentation, you'll see that there's no reason to try and reference the form's data, as the form will re-render itse

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 4:39 PM, Shawn Milochik wrote: > I'm certain there are plenty of reasons that others could chime in with. In > any case, you're free to do it however you like. But if you choose to use > Django, be aware of the fact that a huge amount of thought has gone into the > project,

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 05:47 PM, Greg Donald wrote: On Sat, May 14, 2011 at 4:39 PM, Shawn Milochik wrote: I'm certain there are plenty of reasons that others could chime in with. In any case, you're free to do it however you like. But if you choose to use Django, be aware of the fact that a huge amount

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 4:58 PM, Shawn Milochik wrote: > This isn't a case of "our way rules and if you disagree then you suck." I > just wanted to make sure you don't walk away with that impression. How can I set this same widget value name = CharField( widget=TextInput( attrs={ 'class':'mycla

Re: form new versus edit

2011-05-14 Thread Shawn Milochik
On 05/14/2011 06:09 PM, Greg Donald wrote: On Sat, May 14, 2011 at 4:58 PM, Shawn Milochik wrote: > This isn't a case of "our way rules and if you disagree then you > suck." I just wanted to make sure you don't walk away with that > impression. How can I set this same widget value name =

Re: form new versus edit

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 5:20 PM, Shawn Milochik wrote: > One way: > > class CustomCharField(forms.CharField): > >     def __init__(self, *args, **kwargs): > >     super(CustomCharField, self).__init__(*args, **kwargs) > >     self.widget=forms.TextInput(attrs={ 'class':'myclass' }) > > > c

Re: MEDIA and STATIC in a nutshell?

2011-05-14 Thread Eiji Kobayashi
Thanks Shawn, I didn't read the documentation as thoroughly as I should have. And I know that I should read the English version rather than relying on the outdated, Japanese version. But this is good, as I need to learn English more. I modified the urls.py according to the docs, and the MEDIA_URL,

Am I over-normalizing?

2011-05-14 Thread bendavis78
I have a database of patients ("Patient" model), and a patient can have subordinate accounts which is a self-foreign-key (eg, for family members), We also store multiple addresses for each patient (home, work, billing). I'm pretty sure I need to have an Address model as a many-to-one, because a

Re: Am I over-normalizing?

2011-05-14 Thread Shawn Milochik
On 05/14/2011 06:50 PM, bendavis78 wrote: I have a database of patients ("Patient" model), and a patient can have subordinate accounts which is a self-foreign-key (eg, for family members), We also store multiple addresses for each patient (home, work, billing). I'm pretty sure I need to have a

Re: MEDIA and STATIC in a nutshell?

2011-05-14 Thread Shawn Milochik
Eiji, If you put a folder in each app named 'static' it will automatically be used when you run 'manage.py collectstatic.' You only need to specify additional directories if you want to pull static media from somewhere else, of if you named your static folders something other than 'static' i

existing data failing validation

2011-05-14 Thread Greg Donald
How does one handle non-changing existing data when updating a form? My 'add' form includes several fields my 'edit' form does not. For example once I create a contact and assign it a company_id foreign key, it will never change. So when I implement my edit method in my view, I get errors about

Re: form new versus edit

2011-05-14 Thread br
My HTML guy and designer tend to get together to do some fancy stuff (read: pain in the butt) so sometimes I need to access the data that a model form field represents and can't just let django render it, which is obviously the preferred way and I go that way if possible. I am pretty knew to this,

Re: existing data failing validation

2011-05-14 Thread Shawn Milochik
On 05/14/2011 07:51 PM, Greg Donald wrote: How does one handle non-changing existing data when updating a form? My 'add' form includes several fields my 'edit' form does not. For example once I create a contact and assign it a company_id foreign key, it will never change. So when I implement m

Re: MEDIA and STATIC in a nutshell?

2011-05-14 Thread Shawn Milochik
Eiji, Sorry to hear about the Japanese translation being out-of-date. I just checked and saw that it's extremely old. The development of Django moves too quickly to rely on static documentation. I don't know of any alternatives to the English version if you want to remain current, but in any

Re: existing data failing validation

2011-05-14 Thread Greg Donald
On Sat, May 14, 2011 at 6:56 PM, Shawn Milochik wrote: > If you're using forms.Form objects instead of forms.ModelForm objects then > that would explain it. If you're dealing with a model then you should > probably be using a ModelForm. > > To have a ModelForm that doesn't show certain fields just

Re: existing data failing validation

2011-05-14 Thread Shawn Milochik
On 05/14/2011 08:09 PM, Greg Donald wrote: I have from django.db import models from django.forms import ModelForm class Contact( models.Model ): company = models.ForeignKey( Company ) name = models.CharField( max_length=32 ) class ContactForm( ModelForm ): class Meta:

Re: ajax select box

2011-05-14 Thread gusheng
i've written something similar to Dajax.. but i don't think that's a good solution.. and i'll not use it in my new project.. it goes the opposite of django philosophy..to design url explicitly.. url should be well mantained.. ..and can be used as an api..as similar as possible i thought.. On 5月9日

Inverted checkbox value in modelForm field for BooleanField?

2011-05-14 Thread br
Conceptually, an interface element of my application can either be click through (i.e. requires user interaction) or auto-cycle (no user interaction). So its boolean. But i picked the wrong one when I originally designed the model and now we have existing data and I don't want to change it. So I

Re: [help]django's FloatField can't insert the mysql's double type data.

2011-05-14 Thread Korobase
2011/5/15 Andy McKay > > > Exception Type: TypeError at /admin/main/learndjango/add/ > > Exception Value: 'float' object is not callable > > > Please paste your model that is having the problem. > class MyItem(models.Model): title=models.CharField(max_length=1024) description=models.Char

Re: [help]django's FloatField can't insert the mysql's double type data.

2011-05-14 Thread Andy McKay
On 2011-05-14, at 6:10 PM, Korobase wrote: > price=models.FloatField(default=0.0) You really should really be using a DecimalField for storing prices, not a FloatField. http://docs.djangoproject.com/en/dev/ref/models/fields/#decimalfield http://docs.djangoproject.com/en/dev/ref/models/field

Problems importing model classes that reference each other...

2011-05-14 Thread Contoured Solutions
I am trying to create a simple billing/CRM app for my company. I have create a Django project with the following apps: sales_manager office_manager customer_manager Within, I have models representing things like Customers, Contacts, Projects, Tasks, etc. The problem I am having seems to arise fro

How change field to "unique" in existing mysql database?

2011-05-14 Thread Chris Seberino
I have a typical Django app using MySQL. I've decided to change a model and make some fields unique=True AFTER tables and data exist in MySQL. I noticed that "python manage.py syncdb" doesn't automatically modify MySQL database to make desired fields unique now. Is there some MySQL command line

Re: Problems importing model classes that reference each other...

2011-05-14 Thread Shawn Milochik
If you have two models that need to explicitly refer to each other then they should probably be in the same app. If they need to be in two apps, you can have a foreign key in one and from the other use the RelatedManager to access the first. You'll have to make these decisions based upon what

Re: How change field to "unique" in existing mysql database?

2011-05-14 Thread Shawn Milochik
The best way is to use South. http://south.aeracode.org/ In your current situation, after you install South (pip install then add to INSTALLED_APPS, and syncdb to add the South table) you'll just have to do this: 1. manage.py convert_to_south appname #this will set up the basics, you'll

Re: Inverted checkbox value in modelForm field for BooleanField?

2011-05-14 Thread Andy McKay
On 2011-05-14, at 6:08 PM, br wrote: > However, come interface tweaking time (now), we decided we want to > display a page with a check box "Auto Cycle?" instead of "click- > through", so I basically need to invert the actual value with respect > to this interface . > What is the easiest way to im

Re: [help]django's FloatField can't insert the mysql's double type data.

2011-05-14 Thread Karen Tracey
On Sat, May 14, 2011 at 9:10 PM, Korobase wrote: > > > 2011/5/15 Andy McKay > >> >> > Exception Type: TypeError at /admin/main/learndjango/add/ >> > Exception Value: 'float' object is not callable >> >> >> Please paste your model that is having the problem. >> > > class MyItem(models.Model): >

Re: How change field to "unique" in existing mysql database?

2011-05-14 Thread Chris Seberino
Shawn Thanks! Is South just a script that runs? Can I uninstall after the conversion if desired? Or, does it permanently alter a Django app somehow? cs On May 14, 10:53 pm, Shawn Milochik wrote: > The best way is to use South. > > http://south.aeracode.org/ > > In your current situation, aft

Re: How change field to "unique" in existing mysql database?

2011-05-14 Thread AJ
South is another Django app that you can run on demand when you make a change to your app Models. Why do you want to uninstall South after the alteration? Let it be there and manage your App Models with South. It is better than just syncdb. On Sun, May 15, 2011 at 12:49 AM, Chris Seberino wrot