Re: django + TinyMce
Here's a good reference. http://www.hackedexistence.com/project/django/video4-tinymce.html On Monday, August 20, 2012 2:36:22 PM UTC+8, Владислав Иванов wrote: > > Hello! I am a novice. I want to install TinyMce on Django. I tried a lot > of lessons posted on the Internet, nothing. 3 days can not adjust. Please > tell me a link to a detailed and clear tutorial > -- 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/-/H76sl7cJu_oJ. 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: django + TinyMce
http://www.youtube.com/watch?v=bJeTEDRvGVA. Try this... On Monday, August 20, 2012 2:36:22 PM UTC+8, Владислав Иванов wrote: > > Hello! I am a novice. I want to install TinyMce on Django. I tried a lot > of lessons posted on the Internet, nothing. 3 days can not adjust. Please > tell me a link to a detailed and clear tutorial > -- 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/-/TCzoJ6d0LcoJ. 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: Updating a model instance with extra checks.
As a followup to the suggestion of MyModel.objects.filter(money__gte = value, pk = self.pk).update(F...) Here's an example: We have testapp/models.py: from django.db import models class TestModel(models.Model): balance = models.IntegerField() >>> from django.db.models import F >>> TestModel.objects.create(balance = 5) #Pk will be 1 I just create one. >>> import logging >>> l = logging.getLogger('django.db.backends') >>> l.setLevel(logging.DEBUG) >>> l.addHandler(logging.StreamHandler()) >>> TestModel.objects.filter(balance__gte = 4, pk = 1).update(balance = F('balance') - 4) (0.001) UPDATE "testapp_testmodel" SET "balance" = "testapp_testmodel"."balance" - 4 WHERE ("testapp_testmodel"."balance" >= 4 AND "testapp_testmodel"."id" = 1 ); args=(4, 4, 1) 1 >>> TestModel.objects.filter(balance__gte = 4, pk = 1).update(balance = F('balance') - 4) (0.000) UPDATE "testapp_testmodel" SET "balance" = "testapp_testmodel"."balance" - 4 WHERE ("testapp_testmodel"."balance" >= 4 AND "testapp_testmodel"."id" = 1 ); args=(4, 4, 1) 0 *So this seems to generate a single SQL statement.* * * *I'm not totally familiar with database administration though, so as** Melvyn rightly pointed out, it's always better if you can get the extra security of having an SQL constraint into your dabatase and wrap your queries in a transaction (as you'll probably be adding a line to the statement if the withdrawal succeeds).* * * 2012/8/20 Thomas Orozco > A few suggestions : > > Circumvent the problem with smarter design: don't store the money on the > object, make the user's money the sum of all their transactions (credit - > debit). > You get lesser performance, but you also get history! > > Maybe you could try (not sure about that): > > MyModel.objects.filter(money__gte = value, pk = self.pk).update(F...) > > and inspect the return value (number of updated rows!). > Now, you'd need to make sure django does that in a single statement. > > If that doesn't work, I think update is the way to go anyway, but it might > get a bit messy. > > F... is an F object whose syntax I don't have off the top of my head. > Le 20 août 2012 18:54, "Sebastien Flory" a écrit : > > Hi everyone, >> >> I'm looking for the proper django way to do an update of an attribute on >> my model instance, but only if the attribute current value is checked >> agains't a condition, in an atomic way, something like this: >> >> def use_money(self, value): >> begin_transaction() >> real_money = F('money') >> if real_money >= value: >> self.money = F('money') - value >> self.save() >> end_transaction() >> >> I want to make sure that I avoid race condition so money never goes below >> 0. >> >> Can you help me out? >> >> Thanks, >> >> Sebastien >> >> -- >> 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/-/hr1fBuAcX3kJ. >> 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: [ImageField -Upload a valid image]
I'd you believe PIL is not picking up your libjpeg when it should be, you could give Pillow a shot ; its basically a PIL installer that makes installation easier. Le 20 août 2012 22:30, "Kurtis Mullins" a écrit : > Whenever you compile PIL, make sure that libjpeg is available to it. You > should see a message showing you what is available when you install PIL. > > On Mon, Aug 20, 2012 at 3:33 PM, MN TS wrote: > >> Yes. >> >> Png and GIF are ok. >> >> >> On Mon, Aug 20, 2012 at 8:00 PM, Amyth Arora >> wrote: >> >>> did you try uploading any other images ? >>> >>> >>> On Mon, Aug 20, 2012 at 12:58 AM, MN TS wrote: >>> > Hello everybody. >>> > >>> > I've problem. When i upload image and submit i got follow form error. >>> >- Upload a valid image. The file you uploaded was either not an >>> image or >>> > a corrupted image. >>> > >>> > I reinstall PIL (1.1.7) and setup.py file edit like JPEG_ROOT = >>> > '/usr/lib/i386-linux-gnu/'. >>> > >>> > 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. >>> >>> >>> >>> -- >>> Thanks & Regards >>> >>> >>> Amyth [Admin - Techstricks] >>> Email - aroras.offic...@gmail.com, ad...@techstricks.com >>> Twitter - @a_myth_ >>> http://techstricks.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. >>> >>> >> -- >> 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. > -- 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: Updating a model instance with extra checks.
I think I didn't make what I meant clear enough: What do you think about the following: . Insert record . Calculate balance by summing all records before (including) the one you just inserted (and I think you will agree this is not an extremely complex query) . If balance is positive, it's approved (and you'd probably want to change some status field to reflect that) . If balance is negative, it's refused - and you can change status (or delete, though I wouldn't recommend that) Nothing prevents us from differentiating inserting a record and approving the transaction, right? Depending on whether you use a status field or not, and which transactions you take into account to know whether you will approve, you can get on the safe side. Just assuming that a pending transaction (that is, a transaction that has been inserted but not approved yet) will be approved should prevent approving a withdrawal you should be refusing (but could lead you to refuse one you should be approving if your process is too long) The day performance becomes an issue, you can look into alternate solutions, such as indeed storing the current balance somewhere. Le 21 août 2012 01:26, "Melvyn Sopacua" a écrit : > On 20-8-2012 19:37, Thomas Orozco wrote: > > > Circumvent the problem with smarter design: don't store the money on the > > object, make the user's money the sum of all their transactions (credit - > > debit). > > You get lesser performance, but you also get history! > > This does not circumvent the problem but aggravates it. The problem is > how to determine if a withdrawal is allowed before doing the withdrawal. > Not having the current balance available but instead having to do > complex queries on a possibly huge set of rows, increases the chances of > transactions being OK'd that should not be when multiple withdrawals are > sent in parallel. > > Alexis has mentioned some options, but the real safeguard is to make > current balance field a positive decimal field and propagate this to the > database layer by ensuring a constraint is created. Even if two > transactions in parallel are working with the same initial balance, the > constraint will deny at least one of them. This is also why you should > enclose the entire process (add withdrawal to statement, decrease the > balance) in a single transaction. Possibly the > @transaction.commit_on_success decorator may prove useful. > > -- > Melvyn Sopacua > > -- > 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: Updating a model instance with extra checks.
On 20-8-2012 19:37, Thomas Orozco wrote: > Circumvent the problem with smarter design: don't store the money on the > object, make the user's money the sum of all their transactions (credit - > debit). > You get lesser performance, but you also get history! This does not circumvent the problem but aggravates it. The problem is how to determine if a withdrawal is allowed before doing the withdrawal. Not having the current balance available but instead having to do complex queries on a possibly huge set of rows, increases the chances of transactions being OK'd that should not be when multiple withdrawals are sent in parallel. Alexis has mentioned some options, but the real safeguard is to make current balance field a positive decimal field and propagate this to the database layer by ensuring a constraint is created. Even if two transactions in parallel are working with the same initial balance, the constraint will deny at least one of them. This is also why you should enclose the entire process (add withdrawal to statement, decrease the balance) in a single transaction. Possibly the @transaction.commit_on_success decorator may prove useful. -- Melvyn Sopacua -- 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: django + TinyMce
you are getting the error because you are not register the tinyMCE correctly, the line that is causing this error is: admin.site.register(TinyMCEAdmin) you need to specify a model class as the first argument and then the ModelAdmin class, for example: admin.site.register(TinyMCEModel, TinyMCEModelAdmin) also be sure of the order of the arguments , the first has to be the Model Class and Second one should be a ModelAdmin class. On Mon, Aug 20, 2012 at 9:37 PM, Владислав Иванов wrote: > Thank you all. I used a tutorial Amyth, but I still could not run-error > 'MediaDefiningClass' object is not iterable. The following are my files, > help reshist problem. > admin.py > > from dipkurs.models import Disciplina, Raboty, Tipes > > from django.contrib import admin > > from tinymce.widgets import TinyMCE > > > class RabotyAdmin(admin.ModelAdmin): > > list_display = ('tema', 'predmet', 'tip', 'pub_date') > > list_filter = ['predmet'] > > search_fields = ['tema'] > > > class TinyMCEAdmin(admin.ModelAdmin): > > def formfield_for_dbfield(self, db_field, **kwargs): > > if db_field.name in ('anounce', 'soderz', 'istochnik'): > > return db_field.formfield(widget=TinyMCE( > > attrs={'cols': 80, 'rows': 30}, > > mce_attrs={'external_link_list_url': > reverse('tinymce.views.flatpages_link_list')}, > > )) > > return super(TinyMCEAdmin, self).formfield_for_dbfield(db_field, **kwargs) > > > > admin.site.register(Raboty, RabotyAdmin) > > admin.site.register(TinyMCEAdmin) > > admin.site.register(Tipes) > > admin.site.register(Disciplina) > > > models.py > > #!/usr/bin/env python > > #-*-coding:utf-8-*- > > import os.path > > from django.db import models > > import datetime > > from django.utils import timezone > > > class Disciplina(models.Model): > > predmet = models.CharField(max_length=1000) > > > def __unicode__(self): > > return self.predmet > > > class Meta: > > verbose_name_plural = "Дисциплины" > > > > class Tipes(models.Model): > > tip = models.CharField(max_length=100) > > > def __unicode__(self): > > return self.tip > > > class Meta: > > verbose_name_plural = "Типы работ" > > > > class Raboty(models.Model): > > tema = models.CharField(max_length=300, verbose_name="Тема работы") > > tip = models.ForeignKey(Tipes, verbose_name="Тип работы") > > pub_date = models.DateTimeField('Дата публикации') > > keywords = models.TextField(verbose_name="Ключевые слова") > > predmet = models.ForeignKey(Disciplina, verbose_name="Предмет") > > anounce = models.TextField(verbose_name="Описание работы") > > soderz = models.TextField(verbose_name="Содержание") > > istochnik = models.TextField(verbose_name="Список литературы") > > > class Meta: > > verbose_name_plural = "Работы" > > > def __unicode__(self): > > return self.tema > > > def was_published_recently(self): > > return self.datetime.timedelta(days=1) > > > > > понедельник, 20 августа 2012 г., 17:46:38 UTC+6 пользователь Amyth написал: >> >> Hey there, i could not really find a detailed step by step tutorial on >> setting tinyMCE on django, so i did one for you and for others, you >> can check it out here >> http://techstricks.com/django-tinymce-tutorial-step-by-step/ and feel >> free to ask any question if you face any problems >> >> On Mon, Aug 20, 2012 at 4:40 PM, Aljoša Mohorović >> wrote: >> > HTMLField() is probably the easiest way to use django-tinymce: >> > >> > http://django-tinymce.readthedocs.org/en/latest/usage.html#the-htmlfield-model-field-type >> > >> > let me know if you have any issues. >> > >> > Aljosa >> > -- >> > https://twitter.com/maljosa >> > https://github.com/aljosa >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Django users" group. >> > To post to this group, send email to django...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/django-users?hl=en. >> > >> >> >> >> -- >> Thanks & Regards >> >> >> Amyth [Admin - Techstricks] >> Email - aroras@gmail.com, ad...@techstricks.com >> Twitter - @a_myth_ >> http://techstricks.com/ > > -- > 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/-/JaEEDUuEWfEJ. > > 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. -- Thanks & Regards Amyth [Admin - Techstricks] Email - aroras.offic...@gmail.com, ad...@techstricks.com Twitter - @a_myth_ http://techstricks.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@goo
Re: [ImageField -Upload a valid image]
Whenever you compile PIL, make sure that libjpeg is available to it. You should see a message showing you what is available when you install PIL. On Mon, Aug 20, 2012 at 3:33 PM, MN TS wrote: > Yes. > > Png and GIF are ok. > > > On Mon, Aug 20, 2012 at 8:00 PM, Amyth Arora wrote: > >> did you try uploading any other images ? >> >> >> On Mon, Aug 20, 2012 at 12:58 AM, MN TS wrote: >> > Hello everybody. >> > >> > I've problem. When i upload image and submit i got follow form error. >> >- Upload a valid image. The file you uploaded was either not an >> image or >> > a corrupted image. >> > >> > I reinstall PIL (1.1.7) and setup.py file edit like JPEG_ROOT = >> > '/usr/lib/i386-linux-gnu/'. >> > >> > 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. >> >> >> >> -- >> Thanks & Regards >> >> >> Amyth [Admin - Techstricks] >> Email - aroras.offic...@gmail.com, ad...@techstricks.com >> Twitter - @a_myth_ >> http://techstricks.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. >> >> > -- > 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: [ImageField -Upload a valid image]
Yes. Png and GIF are ok. On Mon, Aug 20, 2012 at 8:00 PM, Amyth Arora wrote: > did you try uploading any other images ? > > > On Mon, Aug 20, 2012 at 12:58 AM, MN TS wrote: > > Hello everybody. > > > > I've problem. When i upload image and submit i got follow form error. > >- Upload a valid image. The file you uploaded was either not an image > or > > a corrupted image. > > > > I reinstall PIL (1.1.7) and setup.py file edit like JPEG_ROOT = > > '/usr/lib/i386-linux-gnu/'. > > > > 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. > > > > -- > Thanks & Regards > > > Amyth [Admin - Techstricks] > Email - aroras.offic...@gmail.com, ad...@techstricks.com > Twitter - @a_myth_ > http://techstricks.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. > > -- 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.
ManyToManyField errors.
Hello I'm new in Django using 1.4version. So got some error. 'myapp.models.AdversiteImages'> has no ForeignKey to * MODEL* class AdversiteImages(models.Model): image = models.FileField(u'Photo' , upload_to='adversiteimage/%Y/%m/%d', null=True, blank=True) class Adversite(models.Model): category = models.ForeignKey(AdversiteCategory, verbose_name=u'Зарын ангилал', related_name='adv_cat', blank=True, null=True) image_many = models.ManyToManyField(AdversiteImages, verbose_name=u'Photos',related_name="photos") title = models.CharField(u'Title', max_length=128) body = models.TextField(u'Description') *ADMIN* class AdversiteImagesInline(admin.TabularInline): model = Adversite.image_many.through extra = 1 class AdversiteAdmin(admin.StackedInline): fieldsets = ((u'Ерөнхий', {'fields':('category','title','body','code')}), (u'Тайлбар', {'fields':('price','phone','email','image1','image2','image3','image4','image5' ,'is_active','is_special','is_premium','start_at','finish_at')})) list_display = ('category','title','code','is_active','is_special') search_fields = ('category','title','code','is_active') model = Adversite.image_many.through Please help 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: ImproperlyConfigured at /
On Mon, Aug 20, 2012 at 5:24 PM, Amyth Arora wrote: > Hey, Thanks for the kind help. > > seems you are using django 1.4. FYI -> Yes, you are right. > django.template.loaders.app_directories.load_template_source has been > deprecated so you should rather use > django.template.loaders.app_directories.Loader I had already added this to my file, but i made a mistake that i did not remove the load_template_source. Thanks again, it works for me. > Just change : > > django.template.loaders.app_directories.load_template_source > TO > django.template.loaders.app_directories.Loader > in the TEMPLATE_LOADERS dictionary in your settings.py file and it > should have it fixed. > > > On Mon, Aug 20, 2012 at 4:30 PM, Satinderpal Singh > wrote: >> I have to deploy osmeditor on my system, and download code from the >> link: http://wiki.openstreetmap.org/wiki/Editors/Django >> The database used in this was postgis, but i have mysql on my system, >> as the tables was successfully made by changing in the settings.py >> file, but on running it in the browser, it gives the following error: >> >> Error importing template source loader >> django.template.loaders.filesystem.load_template_source: "'module' >> object has no attribute 'load_template_source'" >> >> If anybody helps me to solve the problem. Thanks in advance. >> >> -- >> Satinderpal Singh >> http://satindergoraya.blogspot.in/ >> >> -- >> 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. >> > > > > -- > Thanks & Regards > > > Amyth [Admin - Techstricks] > Email - aroras.offic...@gmail.com, ad...@techstricks.com > Twitter - @a_myth_ > http://techstricks.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. > -- Satinderpal Singh http://satindergoraya.blogspot.in/ -- 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: django makemessages doesn't recognize trans in templates
On Mon, Aug 20, 2012 at 8:18 PM, Jojo wrote: > what is the meaning of the fuzzy mark? > > fuzzy is some kind of auto translated field. it may be correct or not. when you are sure that the translation is correct, you remove the fuzzy annotation and then the translation works fine -- --- Nick Apostolakis email:nicka...@oncrete.gr Web Site: http://nick.oncrete.gr --- -- 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: Updating a model instance with extra checks.
A few suggestions : Circumvent the problem with smarter design: don't store the money on the object, make the user's money the sum of all their transactions (credit - debit). You get lesser performance, but you also get history! Maybe you could try (not sure about that): MyModel.objects.filter(money__gte = value, pk = self.pk).update(F...) and inspect the return value (number of updated rows!). Now, you'd need to make sure django does that in a single statement. If that doesn't work, I think update is the way to go anyway, but it might get a bit messy. F... is an F object whose syntax I don't have off the top of my head. Le 20 août 2012 18:54, "Sebastien Flory" a écrit : > Hi everyone, > > I'm looking for the proper django way to do an update of an attribute on > my model instance, but only if the attribute current value is checked > agains't a condition, in an atomic way, something like this: > > def use_money(self, value): > begin_transaction() > real_money = F('money') > if real_money >= value: > self.money = F('money') - value > self.save() > end_transaction() > > I want to make sure that I avoid race condition so money never goes below > 0. > > Can you help me out? > > Thanks, > > Sebastien > > -- > 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/-/hr1fBuAcX3kJ. > 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: Updating a model instance with extra checks.
Al 20/08/12 18:53, En/na Sebastien Flory ha escrit: Hi everyone, I'm looking for the proper django way to do an update of an attribute on my model instance, but only if the attribute current value is checked agains't a condition, in an atomic way, something like this: def use_money(self, value): begin_transaction() real_money = F('money') if real_money >= value: self.money = F('money') - value self.save() end_transaction() I want to make sure that I avoid race condition so money never goes below 0. Take a look at: https://docs.djangoproject.com/en/1.4/topics/db/transactions/ Tying transactions to HTTP requests === The recommended way to handle transactions in Web requests is to tie them to the request and response phases via Django’s TransactionMiddleware. It works like this: When a request starts, Django starts a transaction. If the response is produced without problems, Django commits any pending transactions. If the view function produces an exception, Django rolls back any pending transactions. ... However, if you need more fine-grained control over how transactions are managed, you can use a set of functions in django.db.transaction to control transactions on a per-function or per-code-block basis. HTH -- 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: django makemessages doesn't recognize trans in templates
what is the meaning of the fuzzy mark? Il giorno venerdì 17 agosto 2012 23:11:25 UTC+2, Tomas Neme ha scritto: > > > For example for this link > > > > {% trans "contacts" > %} > > > > I have the msgstr="Contactos". I expect to see "Contactos" in the > browser, > > but I still see "contacts". Any suggestion? > > 1) case-sensitive. Are you sure you haven't translated "Contacts" > instead of "contacts"? > 2) fuzzy-mark. I've noticed that if a translation is marked as > "fuzzy", sometimes gettext doesn't use it > > -- > "The whole of Japan is pure invention. There is no such country, there > are no such people" --Oscar Wilde > > |_|0|_| > |_|_|0| > |0|0|0| > > (\__/) > (='.'=)This is Bunny. Copy and paste bunny > (")_(") to help him gain world domination. > -- 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/-/EFh-U81m-yoJ. 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.
Updating a model instance with extra checks.
Hi everyone, I'm looking for the proper django way to do an update of an attribute on my model instance, but only if the attribute current value is checked agains't a condition, in an atomic way, something like this: def use_money(self, value): begin_transaction() real_money = F('money') if real_money >= value: self.money = F('money') - value self.save() end_transaction() I want to make sure that I avoid race condition so money never goes below 0. Can you help me out? Thanks, Sebastien -- 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/-/hr1fBuAcX3kJ. 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: skip fixtures loading on 'manage.py test myapp'
and, if anyone is interested, here is the answer - http://south.readthedocs.org/en/latest/settings.html#south-tests-migrate On Mon, Aug 20, 2012 at 7:36 PM, Anton Baklanov wrote: > Hi Melvyn! > > Just tested it on dummy project, and you are right - django itself does > not do anything like that. > Problem is in South - when i remove it from INSTALLED_APPS 'manage.py test > myapp' does not load any fixtures except 'initial_data'. > > So, i'm going to south sources now. > > Thanks! > > > On Mon, Aug 20, 2012 at 12:01 PM, Melvyn Sopacua wrote: > >> On 19-8-2012 19:05, Anton Baklanov wrote: >> >> > When I'm running 'manage.py test myapp' it loads all fixtures that are >> in >> > 'myapp/fixtures' directory. >> >> Are you sure about that? I think it only loads what is loaded also with >> syncdb, so initial_data.*. >> >> > And what I want is to find a way to tell django skip this fixtures and >> > instead load some other ones or maybe no fixtures at all for certain >> tests. >> > Is it possible? >> >> Set the fixtures class attribute on your test class. >> >> >> -- >> Melvyn Sopacua >> >> -- >> 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. >> >> > > > -- > Regards, > Anton Baklanov > > -- Regards, Anton Baklanov -- 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: skip fixtures loading on 'manage.py test myapp'
Hi Melvyn! Just tested it on dummy project, and you are right - django itself does not do anything like that. Problem is in South - when i remove it from INSTALLED_APPS 'manage.py test myapp' does not load any fixtures except 'initial_data'. So, i'm going to south sources now. Thanks! On Mon, Aug 20, 2012 at 12:01 PM, Melvyn Sopacua wrote: > On 19-8-2012 19:05, Anton Baklanov wrote: > > > When I'm running 'manage.py test myapp' it loads all fixtures that are in > > 'myapp/fixtures' directory. > > Are you sure about that? I think it only loads what is loaded also with > syncdb, so initial_data.*. > > > And what I want is to find a way to tell django skip this fixtures and > > instead load some other ones or maybe no fixtures at all for certain > tests. > > Is it possible? > > Set the fixtures class attribute on your test class. > > > -- > Melvyn Sopacua > > -- > 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. > > -- Regards, Anton Baklanov -- 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: django + TinyMce
Thank you all. I used a tutorial *Amyth*, but I still could not run-error 'MediaDefiningClass' object is not iterable. The following are my files, help reshist problem. *admin.py* from dipkurs.models import Disciplina, Raboty, Tipes from django.contrib import admin from tinymce.widgets import TinyMCE class RabotyAdmin(admin.ModelAdmin): list_display = ('tema', 'predmet', 'tip', 'pub_date') list_filter = ['predmet'] search_fields = ['tema'] class TinyMCEAdmin(admin.ModelAdmin): def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name in ('anounce', 'soderz', 'istochnik'): return db_field.formfield(widget=TinyMCE( attrs={'cols': 80, 'rows': 30}, mce_attrs={'external_link_list_url': reverse('tinymce.views.flatpages_link_list')}, )) return super(TinyMCEAdmin, self).formfield_for_dbfield(db_field, **kwargs) admin.site.register(Raboty, RabotyAdmin) admin.site.register(TinyMCEAdmin) admin.site.register(Tipes) admin.site.register(Disciplina) *models.py* #!/usr/bin/env python #-*-coding:utf-8-*- import os.path from django.db import models import datetime from django.utils import timezone class Disciplina(models.Model): predmet = models.CharField(max_length=1000) def __unicode__(self): return self.predmet class Meta: verbose_name_plural = "Дисциплины" class Tipes(models.Model): tip = models.CharField(max_length=100) def __unicode__(self): return self.tip class Meta: verbose_name_plural = "Типы работ" class Raboty(models.Model): tema = models.CharField(max_length=300, verbose_name="Тема работы") tip = models.ForeignKey(Tipes, verbose_name="Тип работы") pub_date = models.DateTimeField('Дата публикации') keywords = models.TextField(verbose_name="Ключевые слова") predmet = models.ForeignKey(Disciplina, verbose_name="Предмет") anounce = models.TextField(verbose_name="Описание работы") soderz = models.TextField(verbose_name="Содержание") istochnik = models.TextField(verbose_name="Список литературы") class Meta: verbose_name_plural = "Работы" def __unicode__(self): return self.tema def was_published_recently(self): return self.datetime.timedelta(days=1) понедельник, 20 августа 2012 г., 17:46:38 UTC+6 пользователь Amyth написал: > > Hey there, i could not really find a detailed step by step tutorial on > setting tinyMCE on django, so i did one for you and for others, you > can check it out here > http://techstricks.com/django-tinymce-tutorial-step-by-step/ and feel > free to ask any question if you face any problems > > On Mon, Aug 20, 2012 at 4:40 PM, Aljoša Mohorović > > wrote: > > HTMLField() is probably the easiest way to use django-tinymce: > > > http://django-tinymce.readthedocs.org/en/latest/usage.html#the-htmlfield-model-field-type > > > > > let me know if you have any issues. > > > > Aljosa > > -- > > https://twitter.com/maljosa > > https://github.com/aljosa > > > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > > To post to this group, send email to > > django...@googlegroups.com. > > > To unsubscribe from this group, send email to > django-users...@googlegroups.com . > > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > > > > -- > Thanks & Regards > > > Amyth [Admin - Techstricks] > Email - aroras@gmail.com , > ad...@techstricks.com > Twitter - @a_myth_ > http://techstricks.com/ > -- 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/-/JaEEDUuEWfEJ. 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.
Separating models from proxies conflicts
I'm trying to separate my models from my proxies in order to maintain the functionality more easily. The point is that, as my models.py started to grow over and over, I decided to create a new file in each app (proxies.py) where I'd define my proxies. I used to work like this: # models.py class MyModel(models.Model): prop1 = ... prop2 = ... def f1(self): pass def f2(self): pass However, I wanted to have this structure: # models.py class MyModel(models.Model): prop1 = ... prop2 = ... # proxies.py from myapp import models class MyModel(models.MyModel): def f1(self): pass def f2(self): pass class Meta: proxy = True But, when I tried to make some tests: $ python manage.py shell Python 2.7.3 (default, Apr 20 2012, 22:44:07) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from myapp.proxies import MyModel >>> MyModel So, when I ask for the proxy it gives me the model in models.py. And, of course, it keeps the properties defined on the model but lacks all of the methods in the proxy. Could anybody please tell me WTF is going on here? Thanks for your help :) -- 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/-/gBXn2pb3OTQJ. 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: Need Django experts to explain some of my questions in bay Area, CA
Feel free to call our office and ask for me - (613) 817-5159 On Monday, 20 August 2012 00:05:01 UTC-4, Nirmal Sharma wrote: > > Hi, > I am building a website for non-profit work using Django but i got stuck > at one place. > It would be great if somebody help me in resolving some of my question. > > I need only an hr of you. > > Regards > ~Nirmal > -- 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/-/mp3otO86_E4J. 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.
ANN: eGenix mxODBC Connect - Python Database Interface 2.0.0
ANNOUNCING eGenix.com mxODBC Connect Python Database Interface Version 2.0.0 mxODBC Connect is our commercially supported client-server product for connecting Python applications to relational databases in a truly cross-platform way. This announcement is also available on our web-site for online reading: http://www.egenix.com/company/news/eGenix-mxODBC-Connect-2.0.0-GA.html INTRODUCTION The mxODBC Connect Database Interface for Python allows users to easily connect Python applications to all major databases on the market today in a highly portable, convenient and secure way. Python Database Connectivity the Easy Way Unlike our mxODBC Python extension, mxODBC Connect is designed as client-server application, so you no longer need to find production quality ODBC drivers for all the platforms you target with your Python application. Instead you use an easy to install Python client library which connects directly to the mxODBC Connect database server over the network. This makes mxODBC Connect a great basis for writing cross-platform multi-tier database applications and utilities in Python, especially if you run applications that need to communicate with databases such as MS SQL Server and MS Access, Oracle Database, IBM DB2 and Informix, Sybase ASE and Sybase Anywhere, MySQL, PostgreSQL, SAP MaxDB and many more, that run on Windows or Linux machines. Ideal for Database Driven Client Applications By removing the need to install and configure ODBC drivers on the client side and dealing with complicated network setups for each set of drivers, mxODBC Connect greatly simplifies deployment of database driven client applications, while at the same time making the network communication between client and database server more efficient and more secure. For more information, please have a look at the mxODBC Connect product page, in particular, the full list of available features. For more information, please see the product page: http://www.egenix.com/products/python/mxODBCConnect/ NEWS mxODBC Connect 2.0.0 is a new major release of our successful mxODBC Connect product. Enhanced API * mxODBC Connect Server now uses mxODBC 3.2 internally and makes its API available in the mxODBC Connect Client. This is a major step forward from the mxODBC 3.0 version used in mxODBC Connect Server 1.0. * mxODBC Connect Client comes with all the mxODBC enhancements, including: - connection and cursor objects can be used as context managers - adjustable parameter styles (qmark or named) - connection .autocommit attribute to easily switch on autocommit - adjustable timestamp resolution - new possibilities to set connection and cursor options to adjust the ODBC objects to your application needs, e.g. set a connection read-only or set a query timeout - adjustable decimal, datetime and string formats - adjustable warning format to be able to handle server warnings without client interaction - greatly improved result set scrolling support - Unicode support for all catalog methods - Access to additional result set meta data via cursor.getcolattribute() Updated Compatibility * The server now features all the ODBC driver compatibility enhancements provided by mxODBC 3.2, including improved and updated support for MS SQL Server Native Client, Oracle Instant Client, Sybase ASE, IBM DB2, Teradata and Netezza. * Native Windows x64 builds with signed executables and a tray app rewritten in C are available for Windows 2008R2, Vista and 7 x64, so you can benefit from better performance, fewer UAC dialogs and smaller memory footprint. Asynchronous Execution * mxODBC Connect Client now integrates directly with gevent, allowing client applications to run asynchronous tasks while performing remote database queries. Better Integration * mxODBC Connect now uses the official IANA registered port 6632 for both plain text and SSL-encrypted communication. * mxODBC Connect Client now allows selecting the used SSL module from two available options: Python standard lib ssl module and pyOpenSSL. For the full set of changes, please check the mxODBC Connect change log. http://www.egenix.com/products/python/mxODBCConnect/changelog.html UPGRADING You are encouraged to upgrade to this latest mxODBC Connect release. When upgrading, please always upgrade both the server and the client installations to the same version - even for patch level releases. Customers who have purchased mxODBC Connect 2.0 licenses can request 20% discount co
Re: How to use Django with Apache and mod_wsgi
You would be good to organize your configuration. Try creating a file under /etc/apache2/vhosts.d/ Probably my_domain.com (substitute my_domain.com with your actual domain). And move all the configuration to it: ServerAdmin webmaster@my_domain.com DocumentRoot /usr/local/django/mysite/media/ ServerName my_domain.com ServerAlias www.my_domain.com #WSGIDaemonProcess site-1 user=user-1 group=user-1 threads=25 #WSGIProcessGroup site-1 Alias /media/ /usr/local/django/mysite/media/ Order deny,allow Allow from all WSGIScriptAlias / /home/seyfullah/django/mysite/apache/django.wsgi Order deny,allow Allow from all You can remove the comments after you are sure its working Regards On Mon, Aug 20, 2012 at 2:39 PM, Joris wrote: > The DocumentRoot directive is missing from the httpd.conf, indicating you > did not send all the required data. This may be because your attachment is > incomplete: > > There is an include statement in your httpd.conf: "Include > /etc/apache2/conf.d/*.conf" > All files from that conf.d folder are also processed. Please look in files > located in /etc/apache2/conf.d/ for anything useful. Especially files that > contain a documentroot directive > > Also, it may help if you post the output of > apachectl -S > (note: some distros want apache2ctl instead of apachectl) > > jb > > > > On Monday, August 20, 2012 11:30:49 AM UTC+2, stikic wrote: > >> httpd.conf file is in the attachment. >> >> 2012/8/20, Joseph Mutumi : >> > Hello, >> > >> > Could you post the VirtualHost configuration for Apache? >> > That would greatly help us help you. >> > >> > Regards >> > >> > On Mon, Aug 20, 2012 at 12:30 AM, Seyfullah Tıkıç >> wrote: >> > >> >> Hello, >> >> >> >> I read the article below. >> >> https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/ >> >> >> >> But still http://localhost redirects to >> >> /var/www/localhost/htdocs/index.html. >> >> I want http://localhost/ redirescts to /home/seyfullah/django/mysite. >> >> How can I do this? >> >> >> >> -- >> >> SEYFULLAH TIKIÇ >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups >> >> "Django users" group. >> >> To post to this group, send email to django...@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> django-users...@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...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/django-users?hl=en. >> > >> > >> >> >> -- >> SEYFULLAH TIKIÇ >> > -- > 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/-/KkXJTQwbtYwJ. > > 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: Best way to export data from Django?
Thanks Melvyn. Using model_to_dict I can now see the ID. Tom On Saturday, August 18, 2012 12:15:58 AM UTC+1, Melvyn Sopacua wrote: > > On 17-8-2012 18:41, Tom wrote: > > > I'm able to export the data this way, but I can't get the attributes > > of the full model as I would as if I was using the Django shell. > > Particularly important is the ID of an object, because without that I > > won't know which ID to update on the remote web service. That's why > > I'm only dealing with "created" objects for now. > > Why not? You have full access to the created instance with the instance > argument passed to the post_save signal. > You could for example use: > from django.forms import model_to_dict > data = model_to_dict(instance) > print data > > and you should see the pk there. > > -- > Melvyn Sopacua > -- 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/-/rWI_IZfxXcQJ. 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: Best way to export data from Django?
Hi Kurtis Perhaps I'm doing something wrong – I am looking at the dump in the console (I have debug mode turned on) and in the post data I'm only seeing the following csrfmiddlewaretoken u'pPjBtpAXdODSvuEYjGPNok5WaGDvxQp4' pub_date_0 u'2012-08-17' question u'2011-01-01' pub_date_1 u'12:00:00' _save u'Save' I'm able to access all this data from my remote server but have no idea how to get the ID! The ID appears to be in the URL, i.e. *admin/myapp/poll/6/* Django Celery looks like just the thing that I was hoping would exist! As you say, doing this in a single HTTP Request might cause problems. Many thanks, Tom On Friday, August 17, 2012 11:35:35 PM UTC+1, Kurtis wrote: > > Just curious, which data do you not have available when using signals? You > mentioned the ID but this *should* be available during post_save and > pre_delete hooks, if I'm not mistaken. > Also, I'd recommend caution on performing external server calls during a > single HTTP Request. You might have better luck queuing this up with > something like http://pypi.python.org/pypi/django-celery/ > > On Fri, Aug 17, 2012 at 12:41 PM, Tom >wrote: > >> Hi all, >> >> I'm new to Django, but really enjoying using it so far! >> >> What I'm trying to do is to export data from an admin interface, when a >> record is created or updated. I'm calling another web service to tell it >> the data on site [A] has changed, by using signals. >> >> e.g. >> >> @receiver(post_save, sender=Poll) >> def notify_central_hub(sender, instance, created, **kwargs): >> if created: >> >> #make a string to hold the url of the request >> url = "http://www.example.com/webservice"; >> >> #place POST data in a dictionary >> post_data_dictionary = kwargs >> >> #encode the POST data to be sent in a URL >> post_data_encoded = urllib.urlencode(post_data_dictionary) >> >> #make a request object to hold the POST data and the URL >> request_object = urllib2.Request(url, post_data_encoded) >> >> #make the request using the request object as an argument, store >> response in a variable >> response = urllib2.urlopen(request_object) >> >> >> I'm able to export the data this way, but I can't get the attributes of >> the full model as I would as if I was using the Django shell. Particularly >> important is the ID of an object, because without that I won't know which >> ID to update on the remote web service. That's why I'm only dealing with >> "created" objects for now. >> >> Could someone please advise me whether I'm going about this the right >> way, or if there is actually a better way of doing this? I looked into >> Django middleware but this appears to be more for changing the output at >> the view layer, not the data layer. But if there is a better way of doing >> this, I'd be keen to find out! >> >> Many thanks, >> >> Tom >> >> -- >> 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/-/zystPhngbI0J. >> To post to this group, send email to django...@googlegroups.com >> . >> To unsubscribe from this group, send email to >> django-users...@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 view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/xkslwtX47D4J. 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: [ImageField -Upload a valid image]
did you try uploading any other images ? On Mon, Aug 20, 2012 at 12:58 AM, MN TS wrote: > Hello everybody. > > I've problem. When i upload image and submit i got follow form error. >- Upload a valid image. The file you uploaded was either not an image or > a corrupted image. > > I reinstall PIL (1.1.7) and setup.py file edit like JPEG_ROOT = > '/usr/lib/i386-linux-gnu/'. > > 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. -- Thanks & Regards Amyth [Admin - Techstricks] Email - aroras.offic...@gmail.com, ad...@techstricks.com Twitter - @a_myth_ http://techstricks.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: ImproperlyConfigured at /
Hey, seems you are using django 1.4. FYI -> django.template.loaders.app_directories.load_template_source has been deprecated so you should rather use django.template.loaders.app_directories.Loader Just change : django.template.loaders.app_directories.load_template_source TO django.template.loaders.app_directories.Loader in the TEMPLATE_LOADERS dictionary in your settings.py file and it should have it fixed. On Mon, Aug 20, 2012 at 4:30 PM, Satinderpal Singh wrote: > I have to deploy osmeditor on my system, and download code from the > link: http://wiki.openstreetmap.org/wiki/Editors/Django > The database used in this was postgis, but i have mysql on my system, > as the tables was successfully made by changing in the settings.py > file, but on running it in the browser, it gives the following error: > > Error importing template source loader > django.template.loaders.filesystem.load_template_source: "'module' > object has no attribute 'load_template_source'" > > If anybody helps me to solve the problem. Thanks in advance. > > -- > Satinderpal Singh > http://satindergoraya.blogspot.in/ > > -- > 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. > -- Thanks & Regards Amyth [Admin - Techstricks] Email - aroras.offic...@gmail.com, ad...@techstricks.com Twitter - @a_myth_ http://techstricks.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: Need Django experts to explain some of my questions in bay Area, CA
Hey Nirmal, Could you please post here, what problem are you facing. Thanks On Mon, Aug 20, 2012 at 9:35 AM, Nirmal Sharma wrote: > Hi, > I am building a website for non-profit work using Django but i got stuck at > one place. > It would be great if somebody help me in resolving some of my question. > > I need only an hr of you. > > Regards > ~Nirmal > > -- > 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/-/yLw7kyBX80wJ. > 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. > -- Thanks & Regards Amyth [Admin - Techstricks] Email - aroras.offic...@gmail.com, ad...@techstricks.com Twitter - @a_myth_ http://techstricks.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: django + TinyMce
Hey there, i could not really find a detailed step by step tutorial on setting tinyMCE on django, so i did one for you and for others, you can check it out here http://techstricks.com/django-tinymce-tutorial-step-by-step/ and feel free to ask any question if you face any problems On Mon, Aug 20, 2012 at 4:40 PM, Aljoša Mohorović wrote: > HTMLField() is probably the easiest way to use django-tinymce: > http://django-tinymce.readthedocs.org/en/latest/usage.html#the-htmlfield-model-field-type > > let me know if you have any issues. > > Aljosa > -- > https://twitter.com/maljosa > https://github.com/aljosa > > -- > 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. > -- Thanks & Regards Amyth [Admin - Techstricks] Email - aroras.offic...@gmail.com, ad...@techstricks.com Twitter - @a_myth_ http://techstricks.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: How to use Django with Apache and mod_wsgi
The DocumentRoot directive is missing from the httpd.conf, indicating you did not send all the required data. This may be because your attachment is incomplete: There is an include statement in your httpd.conf: "Include /etc/apache2/conf.d/*.conf" All files from that conf.d folder are also processed. Please look in files located in /etc/apache2/conf.d/ for anything useful. Especially files that contain a documentroot directive Also, it may help if you post the output of apachectl -S (note: some distros want apache2ctl instead of apachectl) jb On Monday, August 20, 2012 11:30:49 AM UTC+2, stikic wrote: > > httpd.conf file is in the attachment. > > 2012/8/20, Joseph Mutumi >: > > Hello, > > > > Could you post the VirtualHost configuration for Apache? > > That would greatly help us help you. > > > > Regards > > > > On Mon, Aug 20, 2012 at 12:30 AM, Seyfullah Tıkıç > > > > wrote: > > > >> Hello, > >> > >> I read the article below. > >> https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/ > >> > >> But still http://localhost redirects to > >> /var/www/localhost/htdocs/index.html. > >> I want http://localhost/ redirescts to /home/seyfullah/django/mysite. > >> How can I do this? > >> > >> -- > >> SEYFULLAH TIKIÇ > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Django users" group. > >> To post to this group, send email to > >> django...@googlegroups.com. > > >> To unsubscribe from this group, send email to > >> django-users...@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...@googlegroups.com. > > > To unsubscribe from this group, send email to > > django-users...@googlegroups.com . > > For more options, visit this group at > > http://groups.google.com/group/django-users?hl=en. > > > > > > > -- > SEYFULLAH TIKIÇ > -- 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/-/KkXJTQwbtYwJ. 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: django + TinyMce
HTMLField() is probably the easiest way to use django-tinymce: http://django-tinymce.readthedocs.org/en/latest/usage.html#the-htmlfield-model-field-type let me know if you have any issues. Aljosa -- https://twitter.com/maljosa https://github.com/aljosa -- 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: django + TinyMce
http://django-tinymce.googlecode.com/svn/tags/release-1.5/docs/.build/html/installation.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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Need Django experts to explain some of my questions in bay Area, CA
Hi, I am building a website for non-profit work using Django but i got stuck at one place. It would be great if somebody help me in resolving some of my question. I need only an hr of you. Regards ~Nirmal -- 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/-/yLw7kyBX80wJ. 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: django + TinyMce
skip step #4, 1-3 should be enough: http://django-tinymce.readthedocs.org/en/latest/installation.html#id2 Aljosa -- https://twitter.com/maljosa https://github.com/aljosa -- 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.
ImproperlyConfigured at /
I have to deploy osmeditor on my system, and download code from the link: http://wiki.openstreetmap.org/wiki/Editors/Django The database used in this was postgis, but i have mysql on my system, as the tables was successfully made by changing in the settings.py file, but on running it in the browser, it gives the following error: Error importing template source loader django.template.loaders.filesystem.load_template_source: "'module' object has no attribute 'load_template_source'" If anybody helps me to solve the problem. Thanks in advance. -- Satinderpal Singh http://satindergoraya.blogspot.in/ -- 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: django + TinyMce
Hi, Try this link https://github.com/aljosa/django-tinymce Regards. On Mon, Aug 20, 2012 at 8:36 AM, Владислав Иванов wrote: > Hello! I am a novice. I want to install TinyMce on Django. I tried a lot > of lessons posted on the Internet, nothing. 3 days can not adjust. Please > tell me a link to a detailed and clear tutorial > > -- > 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/-/C6JhwE-x8PgJ. > 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: deprecation warning from HttpResponseRedirect(reverse(...))
Just importing a function from django.views.generic will trigger the warning. So I'd check your code for imports. I made tracking down the source of these warnings a little easier by putting stacklevel into simple.py: https://code.djangoproject.com/ticket/18780 On Sat, 2012-08-18 at 05:58 -0700, Mike wrote: > > > On Saturday, August 18, 2012 1:31:42 PM UTC+2, Paul Backhouse wrote: > > I seem to be getting a DeprecationWarning when my view hits > this line of > > code: > > > > return HttpResponseRedirect(reverse(results, > args=[query.jobid])) > > > > What does the depreciation warning say? > > > > Here's the full text: > /Users/mike/sieve-django/SIEVEENV/lib/python2.6/site-packages/django/views/generic/simple.py:8: > DeprecationWarning: Function-based generic views have been deprecated; use > class-based views instead. > DeprecationWarning > > -- > 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/-/KvKw7JosFbIJ. > 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: How to use Django with Apache and mod_wsgi
httpd.conf file is in the attachment. 2012/8/20, Joseph Mutumi : > Hello, > > Could you post the VirtualHost configuration for Apache? > That would greatly help us help you. > > Regards > > On Mon, Aug 20, 2012 at 12:30 AM, Seyfullah Tıkıç wrote: > >> Hello, >> >> I read the article below. >> https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/ >> >> But still http://localhost redirects to >> /var/www/localhost/htdocs/index.html. >> I want http://localhost/ redirescts to /home/seyfullah/django/mysite. >> How can I do this? >> >> -- >> SEYFULLAH TIKIÇ >> >> -- >> 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. > > -- SEYFULLAH TIKIÇ -- 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. # Based upon the NCSA server configuration files originally by Rob McCool. # # This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions. # See http://httpd.apache.org/docs-2.0/> for detailed information about # the directives. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # The configuration directives are grouped into three basic sections: # 1. Directives that control the operation of the Apache server process as a # whole (the 'global environment'). # 2. Directives that define the parameters of the 'main' or 'default' server, # which responds to requests that aren't handled by a virtual host. # These directives also provide default values for the settings # of all virtual hosts. # 3. Settings for virtual hosts, which allow Web requests to be sent to # different IP addresses or hostnames and have them handled by the # same Apache server process. # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path. If the filenames do *not* begin # with "/", the value of ServerRoot is prepended -- so "logs/foo.log" # with ServerRoot set to "/usr/lib/apache2" will be interpreted by the # server as "/usr/lib/apache2/logs/foo.log". # ### Section 1: Global Environment # # The directives in this section affect the overall operation of Apache, # such as the number of concurrent requests it can handle or where it # can find its configuration files. # # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # NOTE! If you intend to place this on an NFS (or otherwise network) # mounted filesystem then please read the LockFile documentation (available # at http://httpd.apache.org/docs-2.0/mod/mpm_common.html#lockfile>); # you will save yourself a lot of trouble. # # Do NOT add a slash at the end of the directory path. # ServerRoot "/usr/lib/apache2" # # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. # #LockFile "/var/run/apache2.lock" # # ScoreBoardFile: File used to store internal server process information. # If unspecified (the default), the scoreboard will be stored in an # anonymous shared memory segment, and will be unavailable to third-party # applications. # If specified, ensure that no two invocations of Apache share the same # scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK. # #ScoreBoardFile /var/run/apache2_runtime_status # # PidFile: The file in which the server should record its process # identification number when it starts. # PidFile "/var/run/apache2.pid" # # Timeout: The number of seconds before receives and sends time out. # Timeout 300 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # KeepAlive On # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high,
Re: Distinct Values in ModelChoiceField
On 20-8-2012 0:16, Joseph Mutumi wrote: > That particular field at times appears multiple times in the database. How > do I make it > only have distinct values? > > This is a snippet, drop down will have repeated values if same color is > entered: > > class FavoriteColor(models.Model): > color = models.CharField(max_length=255) > > def __unicode__(self): > return self.color You should invest in fixing the flaw in the design. Set the unique attribute on the color field after you manually remove all duplicates from the database. -- Melvyn Sopacua -- 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: problems in installing django on windows 7
I've also written blog entry about slightly more complicated and more complete guide to get smooth ride with django and windows. http://djangonautlostinspace.wordpress.com/2012/04/16/django-and-windows/ 18.8.2012 6:54, Amyth Arora kirjoitti: If you still face problem you can go through this tutorial right here -> http://techstricks.com/install-django-on-windows-7/ On Sat, Aug 18, 2012 at 7:40 AM, Amyth Arora wrote: You can either create a symlink or add the django directory to your path for it to work, on windows the django files are installed in "C:\Python27\Lib\site-packages\django". You can replace the Python directory according to the version of python you are using. On Fri, Aug 17, 2012 at 11:10 PM, numsontech wrote: Hi! I am new to the Django frameworks and and having difficulties getting it to work on windows 7. I have successfully installed the latest release but when I try to create a new project using the command "python django-admin.py startproject mysite" it displays the following message: can't open file 'django-admin.py': [err 2] no such file or directory. I wish to know how to resolve this. I am also trying to symlink the django-admin.py file but I don't know which path to link it to. Any information will be appreciated Thanks! -- 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/-/EfBa2-sPjMwJ. 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. -- Thanks & Regards Amyth [Admin - Techstricks] Email - aroras.offic...@gmail.com, ad...@techstricks.com Twitter - @a_myth_ http://techstricks.com/ -- Jani Tiainen - Well planned is half done and a half done has been sufficient before... -- 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: skip fixtures loading on 'manage.py test myapp'
On 19-8-2012 19:05, Anton Baklanov wrote: > When I'm running 'manage.py test myapp' it loads all fixtures that are in > 'myapp/fixtures' directory. Are you sure about that? I think it only loads what is loaded also with syncdb, so initial_data.*. > And what I want is to find a way to tell django skip this fixtures and > instead load some other ones or maybe no fixtures at all for certain tests. > Is it possible? Set the fixtures class attribute on your test class. -- Melvyn Sopacua -- 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.