Re: Design decision

2009-10-26 Thread Léon Dignòn
*bump* On 23 Okt., 11:03, Léon Dignòn wrote: > callerlist will MAYBE use a database of another program (not django), > or it uses a database of another django application. This is optional > and I want callerlist to work with or without. For that i decided to > create an

Re: Model design

2009-10-23 Thread Léon Dignòn
The second sounds more logically. On 23 Okt., 15:41, chefsmart wrote: > I would go with your second solution. > > On Oct 23, 5:17 pm, Caisys wrote: > > > > > Hi, > > I have classes for Event, Place and Subplace. Some of the Places are > > divided into different Halls (Subplace) and some have on

Re: Design decision

2009-10-23 Thread Léon Dignòn
engine (I doubt you > need to be a "power user") And then brush up on the > manage.py database subcommands (dumpdata, inspectdb, > and various sql*) and that will help clarify a solution path. > > -Chip > On Oct 16, 10:10 am, Léon Dignòn wrote: > > > > > I

Design decision

2009-10-16 Thread Léon Dignòn
I have a project. Within that project I have the app callerlist. Callerlist is a list of either inbound or outbound phone calls. To each phone call the following information should be written down: own name, name of the caller, subject, message and time. This app has to be coherent. Now, for exam

Re: app model

2009-10-16 Thread Léon Dignòn
User signals: models.py -- def do_something(sender, instance=None, **kwargs): """Does something instance is the user instance. """ if instance is not None: # Do Something post_save.connect(do_something, sender=User) # User is the user model. On 14 Okt.

Re: windows localhost send email

2009-10-16 Thread Léon Dignòn
Download and run "Free SMTP Server": http://www.softstack.com/freesmtp.html No need to configure anything. Your sent e-mails will probably moved in your spam folder. -ld On 16 Okt., 09:47, Angel Cruz wrote: > In your settings.py, make sure you set EMAIL_HOST correctly. > > 1. test if you are a

Archiving Model Instances?

2009-10-16 Thread Léon Dignòn
Hello, I am programming an application where a model instance could be archived if necessary. For example: in gmail I can archive e-mails and they move in the archived folder. The question is: is it only a boolean class-attribute called archived? Or is there more technical know how behind it? I

Re: rendering a table

2009-09-27 Thread Léon Dignòn
Could you post your list and your output please? On Sep 27, 2:04 am, jhugo wrote: > Hi, > > I want to render a table using a list of list. What I do is create a > list for the rows and append another list for the columns. I use two > fors in my template to render the table and as the first loop

Re: Field.blank alternative

2009-09-21 Thread Léon Dignòn
You do this in the validation: http://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other -leond On Sep 21, 11:34 pm, lance wrote: > Newbie question... > > In defining my model, I have two CharFields of a given class. The > business logic

Re: Design question: User vs. UserProfile

2009-09-18 Thread Léon Dignòn
The user model, because the model defined by AUTH_PROFILE_MODULE is intended to be an extension to the actual user model. Namely the profile. Why would you bind something to a user's profile, instead of the user itsself? If you want to "allow records of people without Users", then use blank=True

Passing object through POSTs.

2009-09-17 Thread Léon Dignòn
Hello, I have a Model called 'Skin' with the attributes (1n-relationships) game and car. Game and car stand in a m2m-relationship to each other. Each skin can be either a skin of Game1 or Game2. Each car (car model) can be playable in Game1 and Game2, or only in one of these. I want to create a

Re: Select models based on m2m relationship.

2009-09-16 Thread Léon Dignòn
bump On 15 Sep., 19:36, Léon Dignòn wrote: > Hello, > > I have a m2m relationship like this: > > class Actor(models.Model): >     name = models.CharField(unique=True) > class Movie(models.Model): >     name = models.CharField(unique=True) >     actors = models.Man

Re: How to organize django projects on a productive server?

2009-09-15 Thread Léon Dignòn
roots are configured individually at in the virtual host config: / var/www/site1,site2,…. So /var/www/django is save! On Sep 15, 9:49 pm, orschiro wrote: > Hello Léon Dignòn, > > you told that your projects lie beneath /var/www.. > > So the reason for that is that you might use Apache?

Re: How to organize django projects on a productive server?

2009-09-15 Thread Léon Dignòn
On Sep 15, 9:28 pm, orschiro wrote: > Hello guys, > > first, I know it is not that important how to do this but as I'm > pretty knew and callow I'd like to know how some experienced users do > that. > > At the moment I have just a normal user account besides my root that > stores all my django

makemessages error/problem on Vista

2009-09-15 Thread Léon Dignòn
C:\Users\Leon\Documents\Django\myproject>manage.py makemessages Error: This script should be run from the Django SVN tree or your project or app tree. If you did indeed run it from the SVN checkout or your project or application, maybe you are just missing the conf/ locale (in the django tree) or

Select models based on m2m relationship.

2009-09-15 Thread Léon Dignòn
Hello, I have a m2m relationship like this: class Actor(models.Model): name = models.CharField(unique=True) class Movie(models.Model): name = models.CharField(unique=True) actors = models.ManyToManyField(Actor) class Comment(models.Model): actor = models.ForeignKey(Actor) mov

Re: How to generate po files ?

2009-09-09 Thread Léon Dignòn
I am glad you ask this. I was running in that problem too. I use Windows Vista and I've run 'django-admin.py makemessages' inside the folder I also run 'django-admin.py startproject bestsiteever'. Same error. -leond On Sep 9, 7:28 pm, Mirat Can Bayrak wrote: > Hi, i finished my site in english

Re: Choices of foreign keys?

2009-09-09 Thread Léon Dignòn
> >     categories = models.ManyToManyField(Category, blank=True) > > -Peter > > On Sep 9, 11:54 am, Léon Dignòn wrote: > > > > > Hello, > > > let's assume we have a model for photos with the fields id, user, > > photo. Any user should be able t

Choices of foreign keys?

2009-09-09 Thread Léon Dignòn
Hello, let's assume we have a model for photos with the fields id, user, photo. Any user should be able to categorize his foto with a given number of categories, e.g. person, car, building. In future it's possible that I add more categories. My question is whether the new category field should b

Re: apache2+mod_wsgi: 403 Forbidden

2009-09-09 Thread Léon Dignòn
Regards, > > Matias. > > > On Tue, Sep 8, 2009 at 11:04 AM, Matias wrote: > > > You should use Directory with the real path, not the alias > > > > > > >        Order Allow,Deny > > >        Deny from all > > > > > > > > >        Orde

Re: django unicode user name

2009-09-08 Thread Léon Dignòn
It's easier than that, since the username field is a CharField! Add these lines to your admin.py: -- from django.contrib.auth.forms import UserCreationForm, UserChangeForm # Overrides django.contrib.auth.forms.UserCreationForm and changes # username to accept a wider range of charac

Re: django unicode user name

2009-09-08 Thread Léon Dignòn
It's easier than that, since the username field is a CharField! Add these lines to your admin.py: -- from django.contrib.auth.forms import UserCreationForm, UserChangeForm # Overrides django.contrib.auth.forms.UserCreationForm and changes # username to accept a wider range of charact

Re: apache2+mod_wsgi: 403 Forbidden

2009-09-07 Thread Léon Dignòn
> HTH, > Matias. > > > > > > On Mon, Sep 7, 2009 at 2:55 PM, Léon Dignòn wrote: > > > I get a 403 forbidden. > > > I serve Django with apache2+mod_wsgi. I disabled some plugins I think > > I don't need. Set the listen port to 8000 on localhost on

apache2+mod_wsgi: 403 Forbidden

2009-09-07 Thread Léon Dignòn
I get a 403 forbidden. I serve Django with apache2+mod_wsgi. I disabled some plugins I think I don't need. Set the listen port to 8000 on localhost only. Later I will serve django through reverse proxy on cherokee webserver. But for now, localhost:8000 is returning a 403 forbidden error. Any ide

Re: PostgreSQL or MySQL, What are the +'s and -'s?

2009-09-04 Thread Léon Dignòn
One of many: PostgreSQL supports naive foreign referential-integrity constraints. MySQL (default: myISAM) does it only with InnoDB which leads to other Problems: http://dev.mysql.com/doc/refman/5.0/en/innodb-configuration.html On Sep 4, 10:29 pm, Joshua Russo wrote: > I personally don't have any

Re: How do you configure django+http+ftp?

2009-08-30 Thread Léon Dignòn
And causes new ones. My apache runs other also websites. On Aug 30, 9:12 pm, Mike Ramirez wrote: > On Sunday 30 August 2009 12:04:36 pm Léon Dignòn wrote: > > > > > > > Hello folks, > > > I read through the documentation and got my project up and running. >

How do you configure django+http+ftp?

2009-08-30 Thread Léon Dignòn
Hello folks, I read through the documentation and got my project up and running. But when I try to upload something, I receive the error messages 'permission denied'. I could sloppy fix that problem with chmod, but that is not want I want to do. Since then I am thinking about a good folder hierar

Re: ImageField width_wield

2009-08-29 Thread Léon Dignòn
No, everything is fine. Once you uploaded a file, you can call image.width and image.height (where image is an instance of Image). If you are using ModelForms, you can set editable=False as a parameter for width and height. image = models.ImageField(upload_to='images', height_field='hei

Re: Loose username policy

2009-08-29 Thread Léon Dignòn
UserChangeForm add_form = UserCreationForm admin.site.unregister(User) admin.site.register(User, UserProfileAdmin) On Aug 29, 11:52 am, Léon Dignòn wrote: > Hello, > > I don't find a way to allow additional characters i

Loose username policy

2009-08-29 Thread Léon Dignòn
Hello, I don't find a way to allow additional characters in the username: -'[] {}[]… Sure, I could override the user model, but then my 3rd-party- application won't work anymore. (django-profiles/registration). Any ideas? --~--~-~--~~~---~--~~ You received this m

Help with admin inlines

2009-08-28 Thread Léon Dignòn
Hi, I tried to stack two models in the admin interface. Any ideas why I get this error? issubclass() arg 1 must be a class File "C:\Django\myproject\myapp\admin.py" in 22. admin.site.register(Manufacturer, ManufacturerAdmin) admin.py class Aer

ugettext() and ugettext_lazy() - error and difference

2009-08-27 Thread Léon Dignòn
Hi, I don't exactly understand the difference between ugettext() and ugettext_lazy(). I read the documentation and I've read that ugettext_lazy translates a string on access. Sounds more efficient. But why do I get this error on that code? from django.db import models from django.utils.translati

Re: get an object's model name

2009-08-27 Thread Léon Dignòn
Hello, simply use type() >>> from django.contrib.auth.models import User >>> u = User.objects.get(id=1) >>> u >>> print u leon >>> type(u) -ld On Aug 27, 11:59 am, MIL wrote: > Hello :o) > > I would like to know how to get the model name of an object. > > sort of like object.get_model_name

Fastest http+sql server combination

2009-08-24 Thread Léon Dignòn
Hello, there are plenty of possible combinations out there. The suggested one is apache and mod_wsgi, but in the docs is also mentioned, that fastcgi could be faster if configured properly. Unfortunately it's not mentioned, what properly means. For a site with few users who upload images up to 5

Re: ModelForm and ForeignKeys

2009-08-24 Thread Léon Dignòn
els.Model): >      character = models.IntegerField(primary_key=True) >      ... >      ... > > Even though django accurately assesses the datatypes of these tables, > I want to be able to set CharacterHome.character as a ForeignKey > (Character) and have Character return the "gu

Re: ModelForm and ForeignKeys

2009-08-24 Thread Léon Dignòn
goobee, I am not sure, if I understand you. You have a person with a name, let's say "Max Mustermann". You want to show the ModelForm participant for this particular person? Is this correct? On Aug 24, 9:14 am, goobee wrote: > thanks Léon > > but I need name and firstname from the referenced tab

Re: ImageField woes

2009-08-22 Thread Léon Dignòn
If you need it only for one particular form, you can also override clean_(): --- import Image # PIL class UserProfileForm(ModelForm): class Meta: model = UserProfile # Model UserProfile has an ImageField named avatar. def clean_avatar(self): im

Re: ModelForm and ForeignKeys

2009-08-22 Thread Léon Dignòn
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form Good luck! -ld On Aug 21, 3:49 pm, goobee wrote: > hi there > > I'm in dire need of a good idea. django drives me crazy with its > foreignkey-resolver. > > class person(models.Model): >     name

Re: How to validate image dimensions?

2009-08-22 Thread Léon Dignòn
Thank you! I will youse TiNo's solutions. The resize feature is huge! On Aug 21, 6:10 pm, Alex Gaynor wrote: > On Fri, Aug 21, 2009 at 3:50 AM, TiNo wrote: > > On Fri, Aug 21, 2009 at 10:40, Léon Dignòn wrote: > > >> Hello, > > >> in my ModelForm I try to

How to validate image dimensions?

2009-08-21 Thread Léon Dignòn
Hello, in my ModelForm I try to allow only images (for avatar) smaller than 64*64 pixels. I've done this by overriding clean_avatar(). But how can I check the dimensions? The instance is an InMemoryUploadedFile which has no width or height. Any help regarding this? class UserProfileForm(ModelFor

Why using ForeignKey and not OneToOne to extend the user profile?

2009-08-18 Thread Léon Dignòn
Hello, in the authentication documentation is written that the user profile should be extended with a foreign key. - http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users "If you'd like to store additional information related to your users, Django provide

Re: How to extend Auth/User in admin view?

2009-08-18 Thread Léon Dignòn
ProfileAdmin.list_display[5], 'user_is_public' is not a callable or an attribute of 'UserProfileAdmin' or found in the model 'User'. Please help :o) -LD On Aug 18, 11:16 am, Léon Dignòn wrote: > Hi Daniel, > > I have trouble doing this: > > 1. admin.s

Re: How to extend Auth/User in admin view?

2009-08-18 Thread Léon Dignòn
) except admin.sites.NotRegistered: pass admin.site.register(User, MyUserAdmin) -LD On Aug 17, 10:04 am, Daniel Roseman wrote: > On Aug 17, 8:06 am, Léon Dignòn wrote: > > > Hello, > > > I use an extendedUserModel and like to display these fields in the > >adminvie

How to extend Auth/User in admin view?

2009-08-17 Thread Léon Dignòn
Hello, I use an extended User Model and like to display these fields in the admin view at Auth/User. Can anybody show me how this works? Thanks -LD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" gro

Re: Question about URLs

2009-08-15 Thread Léon Dignòn
At this point I always love to refer to http://rubular.com, which is a very good regular expression editor and tester. leon On Aug 11, 1:42 am, Tim Chase wrote: > > If i have a URL such as: > > >  (r'^(?P\w+)/blog/', include('foo.urls.blog')), > > > what are the whats the purpose of the w and t

Re: optional username registration

2009-08-15 Thread Léon Dignòn
Sorry, I assumed you used django-registration. But the idea is the same until you did not set up an own user model. :) On Aug 15, 3:11 pm, Léon Dignòn wrote: > django-registration uses the django.contrib.auth module which includes > the models.User model. in this model it is necessary to

Re: optional username registration

2009-08-15 Thread Léon Dignòn
django-registration uses the django.contrib.auth module which includes the models.User model. in this model it is necessary to supply a username, but not an e-mail address. I assume you want to authenticate users via the e-mail address, then you'd simply copy the e-mail address into the username

Re: ManyToMany Model.py and the shell..

2009-08-15 Thread Léon Dignòn
Hello rh0dium, Client.objects.filter() returns you a QuerySet instance which you have to iterate to get all objects. Thus the commented line will generate an error, I think so. Instead you should use Client.objects.get() to get the model instance. A QuerySet is a list of model instances. > Can

Re: user profiles and the admin

2009-08-15 Thread Léon Dignòn
Hey Chris, have you found a solution? On Jul 29, 2:43 pm, Chris Curvey wrote: > Drat.  That's not it.  I'll keep trying. > > On Jul 28, 5:01 pm, Asinox wrote: > > > > > im new , but i think that u need this part: > > > class UserProfileAdmin(UserAdmin): > >     inlines = [UserProfileInline]

Re: Override __init__()

2009-08-15 Thread Léon Dignòn
initial=instance.user.last_name def save(self, *args, **kwargs): p = super(ProfileForm, self).save() p.user.first_name = self.cleaned_data['first_name'] p.user.last_name = self.cleaned_data['last_name'] p.user.save() On Aug 15, 12:58 am

Re: Override __init__()

2009-08-15 Thread Léon Dignòn
easy. On Aug 15, 12:58 am, Daniel Roseman wrote: > On Aug 14, 6:44 pm, Léon Dignòn wrote: > > > Yeah! this is working very well! > > > Now my last question. How can I change the initial-value of first_name > > and last_name I defined in my class (look at first post)?

Re: Newbie - question - Django Tutorials 2

2009-08-14 Thread Léon Dignòn
As it sais it's an indentation error. Instead you must write: > inlines = [ChoiceInline] > list_display = ('question','pub_date') #line 16 > > admin.site.register(Poll, PollAdmin) On Aug 14, 10:53 pm, koko wrote: > Dear All, > > I just start Django today and very enjoy with Django.

Re: Override __init__()

2009-08-14 Thread Léon Dignòn
On Aug 14, 3:50 pm, Léon Dignòn wrote: > > > Hi Emily, > > > thanks so far! > > > unfortunately this line: > > > > instance = getattr(kwargs, 'instance') > > throws this error: > > > Exception Value: 'dict' object has no attrib

Re: Override __init__()

2009-08-14 Thread Léon Dignòn
Hi Emily, thanks so far! unfortunately this line: > instance = getattr(kwargs, 'instance') throws this error: > Exception Value: 'dict' object has no attribute 'instance' what next? On Aug 14, 1:52 pm, Emily Rodgers wrote: > On Aug 14, 12:14 pm, Léon D

Override __init__()

2009-08-14 Thread Léon Dignòn
Hi, I try override a ModelForms init to claim the variable instance. After that I call super.__init__(). It's almost working, but there is no form shown in the browser. Any ideas what might be wrong? class ProfileForm(ModelForm): first_name = forms.CharField(required=False, max_length=30)

Re: override save()

2009-08-09 Thread Léon Dignòn
ssing??? On Aug 10, 3:23 am, Malcolm Tredinnick wrote: > On Sun, 2009-08-09 at 13:35 -0700, Léon Dignòn wrote: > > Hi, > > > I have a ModelForm of my UserProfile model with two additional fields. > > I need to override save(), to save the additional fields to the > > d

Re: 2 Questions about feeds

2009-08-09 Thread Léon Dignòn
Please try to change the Sitename in the backend at /admin/sites/site/ Per default its example.com On Aug 8, 8:46 pm, When ideas fail wrote: > Hi, i'm developing a feed but i still have a couple of questionss. > > 1. I have this in my models: > > def get_absolute_url(self): >         return "/bl

override save()

2009-08-09 Thread Léon Dignòn
Hi, I have a ModelForm of my UserProfile model with two additional fields. I need to override save(), to save the additional fields to the django.contrib.auth.model.User model. I tried to do that with a subclass of my UserProfile model class to have the code separated. But I get a NameError: name

Re: import problem

2009-08-09 Thread Léon Dignòn
Thank you all! :) On Aug 9, 9:35 pm, "J. Cliff Dyer" wrote: > On Sun, 2009-08-09 at 11:59 -0700, Léon Dignòn wrote: > > In my myproject/urls.py I want to pass the class to a function. > > Because my urls.py is full of imports, I do not want another import > > li

Re: import problem

2009-08-09 Thread Léon Dignòn
which _is_ in the project I am currently using. For that I have to ask this: Do I really need 'import myproject' in myproject/urls.py when I'd like to write somewhere in the urls.py 'myproject.myapp.models.MyModel'??? On Aug 9, 8:50 pm, Daniel Roseman wrote: > On A

import problem

2009-08-09 Thread Léon Dignòn
Hello, some times I'd like not to import a class but just write it down. Instead of from myproject.myapp.models import MyModel I'd like to use myproject.myapp.models.MyModel But I get a NameError: name 'myproject' is not defined Also myapp.models.MyModel raises a NameError: name 'myapp' is no

Re: django-registration and RegistrationFormUniqueEmail subclass

2009-08-09 Thread Léon Dignòn
Thank you On Jul 22, 7:42 pm, Dan Harris wrote: > The stuff in the brackets are the optional arguments passed to the > "register" view. > > You can read the documentation about the view at: > > http://bitbucket.org/ubernostrum/django-registration/src/b360801eae96... > > Alternatively you can che

Re: How to change the option text in a form's select-tag?

2009-08-09 Thread Léon Dignòn
I solved it with __unicode__ in the model class. On Aug 7, 1:38 pm, Léon Dignòn wrote: > Hello, > > I installed django-profiles and added an extended UserProfile. One > template displays all fields which are necessary to edit a users > profile. Every user can choose a favorite a

django-profiles: exclude field from edit form

2009-08-08 Thread Léon Dignòn
I wonder why the avatar field is still display in the form after passing another form class. Still the built-in form is used. What's wrong? -- forms.py from django.forms import ModelForm from profiles import utils class _ProfileForm(ModelForm): class Meta: model = utils.get_prof

django-profiles/registration and conditional redirect

2009-08-07 Thread Léon Dignòn
Hello, I struggle with the start of a little conditional request. I installed django-profiles and got django-profiles working and I have a small login form based on the django documentation. django-profiles covers the accounts/login url in its urls.py. So I only had to create the registration/l

Re: Django documentation site is SLOW

2009-08-07 Thread Léon Dignòn
Without it's better, but still now good enough for three colors and a little bit of text. On Aug 7, 2:09 pm, Mirat Bayrak wrote: > without javascript ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Django documentation site is SLOW

2009-08-07 Thread Léon Dignòn
I have an Intel C2D E2200 with 4 GB RAM. The Django docs are killing my browser, it feels like FireSLUG instead of Firefox 3.5 . Hate it! On Aug 7, 1:46 pm, Jo wrote: > Surely can't only be me that finds the main Django site painfully > slow? There is some javascript in there or something

How to change the option text in a form's select-tag?

2009-08-07 Thread Léon Dignòn
Hello, I installed django-profiles and added an extended UserProfile. One template displays all fields which are necessary to edit a users profile. Every user can choose a favorite aeroplane. Every aeroplane is built by one manufacturer. I print the edit form in the template with {{ form }}. The

Re: django-registration and RegistrationFormUniqueEmail subclass

2009-07-22 Thread Léon Dignòn
gt; Before that, you need to import RegistrationFormUniqueEmail > > from registration.forms import RegistrationFormUniqueEmail > > Léon Dignòn ??: > > > > > > > Hey folks, > > > I don't know how to implement the RegistrationFormUniqueEmail > > subcla

django-registration and RegistrationFormUniqueEmail subclass

2009-07-22 Thread Léon Dignòn
Hey folks, I don't know how to implement the RegistrationFormUniqueEmail subclass. I have a new project and installed django-registration. I got some templates wich work well. Now I want, that E-Mail addresses are unique. For that in the forms-documentation is mentioned, that there is a subclass

Re: How to design a new website? (about apps)

2009-07-21 Thread Léon Dignòn
I found it, it's really really great!! http://www.youtube.com/watch?v=A-S0tqpPga4 On Jul 22, 12:30 am, Javier Guerra wrote: > On Tue, Jul 21, 2009 at 10:19 PM, Léon Dignòn wrote: > > These questions I would love to see answered: > > - Do I create an app for the additional

How to design a new website? (about apps)

2009-07-21 Thread Léon Dignòn
Ok, I have finished the tutorials and learned a lot about Django. I created a polls application and tuned the admin site, etc. Now I want to continue in a bigger application. After some successful coding I ran into a big problem not covered by any piece of documentation out there: 1. Do I need a

Re: django profiles :: choices form?

2009-07-21 Thread Léon Dignòn
You might take a look at this: http://docs.djangoproject.com/en/dev/ref/models/fields/#ref-models-fields models.py class Foo(models.Model): GENDER_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) gender = mo

MEDIA_ROOT and file uploads

2009-07-20 Thread Léon Dignòn
Hello everybody, I created an upload form with the help of the docs. http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#topics-http-file-uploads But the handle_uploaded_file() bugs me a little bit. I set MEDIA_ROOT (MR) in the settings.py to an existing directory. I thought that file