Re: adding a summary field to a model
Try to add function 'quota_ore' below. On Aug 19, 3:03 am, djnubbio wrote: > Sorry for wasting your preciuose time. I'm very newby in django. > > I have de following > > class Commessa(models.Model): > commessa = models.CharField(max_length=20) > quota_oraria=models.DecimalField(max_digits=5, decimal_places=2) > ... > def quota_ore(self): self.quota_oraria * sum([d.ore for d in self.diario_set.all()]) > class Diario(models.Model): > data= models.DateField('data inizio') > commessa = models.ForeignKey(Commessa) > ore=models.IntegerField() > ... > > I want to add a column to Commessa containg the result of: > > quota_oraria * sum(ore) > Widoyo -- 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: Need some help with URL layout
It could be better if you omit '_ALL' at URL So: /ranking/de/ # for Germany ranking Nation wide /ranking/ # for all country can put summary of ranking for such URL, instead of list of all ranking nation or all country. Widoyo On Aug 21, 7:35 am, Uwe Schuerkamp wrote: > ranking/de/hf Country: Germany, District: Herford (I'll be using > german number plates here to discriminate among districts > /ranking/de/_ALL Nation-Wide Ranking for Germany > /ranking/gr/agn Agios Nikolaos, Greece: Ranking of observers in > Agios Nik. on Crete, Greece > /ranking/_ALL/_ALL world-wide ranking > -- 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: Enter a field in the database after encryption
refer to this docs: http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#modeladmin-methods Use def save_model(self, ...): mymodel.password = # put your md5 encrypted here ... mymodel.save() Widoyo On Aug 21, 11:05 pm, Amitanshu wrote: > Actually I missed something in my post, writing it again : > > got entered in encrypted format (like md5) "in database".> -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: mutually referential models
Just add quote into your model that you do not defined yet. On Aug 22, 12:26 am, Andy Howell wrote: > > class Computer(models.Model): > name = models.CharField(max_length=80) > description = models.CharField(max_length=80, null=True) > interfaces = models.ManyToManyField(ComputerInterface) > interfaces = models.ManyToManyField('ComputerInterface') Widoyo > class ComputerInterface(Node): > ipAddr = models.IPAddressField(null=True) > mbitsPerSec = models.IntegerField(null=True) ... -- 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: how to prepopulate admin form with default data?
Hello Gondor, If you mean 'admin model' is http://localhost:8000/admin/ (Django Admin page) your problem solution is mentioned in this docs: http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#modeladmin-methods Widoyo On Aug 21, 2:57 pm, gondor wrote: > class Notes(models.Model): > name = models.ForeignKey('name', blank=True, null=True) > text = models.TextField('Text',blank=True) > date = models.DateField(blank=True, default=datetime.date.today()); > > I have a simple admin model for inputting a note with a date into the > database. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Forms: set required value at runtime
On Oct 24, 3:28 am, bobo wrote: > I'd like to do, if I uncheck the 'same' field, then the required for > the post_address change to True. > I tried width the overall clean method, but when I raise > forms.ValidationError, I can't raise the error for the post_address > field. > > Can I change the required value at runtime? It could be easier to do this at Javascript instead of django. -- 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: Subdomain/Accounts
May be this link will help you: http://www.rossp.org/blog/2007/apr/28/using-subdomains-django/ Widoyo On Dec 23, 11:29 am, Parra wrote: > Can someone give me some tips on where to get started with this ?? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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.