template problem with login.html
Hi, I built a site with django. Now i have a stupid (i couldnt understand) problem. Everything works perfect but when i try to login and registration/login.html is rendered, there is a margin at the top of the login.html. And the font size increases 1 or 2 points. Font family and other css elements remains same... Any idea? Thanks to all, Ozgur -- 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.
minimum system requirements
Hi, I'm developing a project by django 1.2.3. Now it's time to bring the project to production. I'm looking for dedicated servers but i dont know the minimum hardware requirements. There are dedicated options with P4 cpus. Is there any information about requirements? Thanks all, -- 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.
django admin css problem
Hi, Yesterday i moved my site to a linux solution. Everything is going fine, except admin site. When i go to url example.com/admin, the template doesnt work. When i look at the source, i see these: But i dont have any urls or files on example.com/media/css/base.css or example.com/media/css/login.css How can i fix this problem? When working on localhost with "runserver", these CSS files are NOT missing. Do you have any idea? 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-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: django admin css problem
I found the answer. The problem was about the apache (httpd) configuration. When i add the following to httpd config, the problem is solved: AllowOverride None Options None Order allow,deny Allow from all Alias /media/ "Path-to-Python/Lib/site-packages/django/contrib/admin/media/" 2010/12/2 ozgur yilmaz : > Hi, > > Yesterday i moved my site to a linux solution. Everything is going > fine, except admin site. When i go to url example.com/admin, the > template doesnt work. When i look at the source, i see these: > > > > > But i dont have any urls or files on example.com/media/css/base.css > > or > > example.com/media/css/login.css > > How can i fix this problem? When working on localhost with > "runserver", these CSS files are NOT missing. > > Do you have any idea? > > 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-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.
How to build this query
Hi all, I hope i can explain my query problem well. Think you have 3 classes: class City( models.Model ): ... ... class Brand( models.Model ): ... ... class Shop( models.Model ): brand = models.ForeignKey( Brand ) city = models.ForeignKey( City ) ... ... class Discount( models.Model ): brand = models.ForeignKey( Brand ) ... ... Think a Shop sell products of a single Brand. I have lots of Discount records. But i'm interested in Discounts at Shops in Paris. Is there any? Can you help me? 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.
Re: How to build this query
But Brand doesnt have a city field. Shop class has a city field. 2012/11/9 Jirka Vejrazka : > paris_discounts = Discount.objects.filter(brand__city__name='Paris') ? > > Note that these are always *double* underscores and I had to make a guess > that your City has an attribute "name". > > HTH > > Jirka > > > > On Fri, Nov 9, 2012 at 9:12 AM, ozgur yilmaz wrote: >> >> Hi all, >> >> I hope i can explain my query problem well. Think you have 3 classes: >> >> class City( models.Model ): >> ... >> ... >> >> class Brand( models.Model ): >> ... >> ... >> >> class Shop( models.Model ): >>brand = models.ForeignKey( Brand ) >>city = models.ForeignKey( City ) >> ... >> ... >> >> class Discount( models.Model ): >>brand = models.ForeignKey( Brand ) >> ... >> ... >> >> Think a Shop sell products of a single Brand. I have lots of Discount >> records. But i'm interested in Discounts at Shops in Paris. Is there >> any? >> >> Can you help me? >> >> 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. >> > > -- > 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: How to build this query
Maybe: paris_discounts = Discount.objects.filter( brand__shop__city__name = 'Paris' ).distinct('id') What do you think? 2012/11/9 ozgur yilmaz : > But Brand doesnt have a city field. Shop class has a city field. > > 2012/11/9 Jirka Vejrazka : >> paris_discounts = Discount.objects.filter(brand__city__name='Paris') ? >> >> Note that these are always *double* underscores and I had to make a guess >> that your City has an attribute "name". >> >> HTH >> >> Jirka >> >> >> >> On Fri, Nov 9, 2012 at 9:12 AM, ozgur yilmaz wrote: >>> >>> Hi all, >>> >>> I hope i can explain my query problem well. Think you have 3 classes: >>> >>> class City( models.Model ): >>> ... >>> ... >>> >>> class Brand( models.Model ): >>> ... >>> ... >>> >>> class Shop( models.Model ): >>>brand = models.ForeignKey( Brand ) >>>city = models.ForeignKey( City ) >>> ... >>> ... >>> >>> class Discount( models.Model ): >>>brand = models.ForeignKey( Brand ) >>> ... >>> ... >>> >>> Think a Shop sell products of a single Brand. I have lots of Discount >>> records. But i'm interested in Discounts at Shops in Paris. Is there >>> any? >>> >>> Can you help me? >>> >>> 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. >>> >> >> -- >> 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.
dynamic form with popup
Hi, I have a problem. I have two models: class CheckOut(models.Model): models.DateField() class Product(models.Model): checkout = models.ForeignKey( CheckOut ) name = models.CharField() price = models.FloatField() With these models, i want to contruct a CheckOut form, and select multiple products, calculate the amount ( price * item_number ). What is the most popular or best way to achieve this thought? I want to use popup windows to select a product and item number for checkout. If i can use a "add product" link in the form, and show a popup window to select the product and number, and return the values to the form, i would be glad. Thanks for your help, -- 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: dynamic form with popup
thats not the answer. you can add item to basket by clicking a button "add to basket" on every item page. My purpose is to fill a single form, with 1 or many products. Than a single button, saves a checkout object and many product object. 23 Ağustos 2011 00:12 tarihinde Yaşar Arabacı yazdı: > I don't know the answer, but you may want to check this > out: http://www.satchmoproject.com/ > > 2011/8/23 ozgur yilmaz >> >> Hi, I have a problem. >> >> I have two models: >> >> class CheckOut(models.Model): >> models.DateField() >> >> class Product(models.Model): >> checkout = models.ForeignKey( CheckOut ) >> name = models.CharField() >> price = models.FloatField() >> >> With these models, i want to contruct a CheckOut form, and select >> multiple products, calculate the amount ( price * item_number ). >> >> What is the most popular or best way to achieve this thought? >> >> I want to use popup windows to select a product and item number for >> checkout. If i can use a "add product" link in the form, and show a >> popup window to select the product and number, and return the values >> to the form, i would be glad. >> >> Thanks for your help, >> >> -- >> 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. >> > > > > -- > http://yasar.serveblog.net/ > > -- > 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: dynamic form with popup
thanks, but i think i have to use a suitable js for adding a new product. am i wrong? 2011/8/23 Shawn Milochik : > On 08/22/2011 05:21 PM, ozgur yilmaz wrote: >> >> thats not the answer. you can add item to basket by clicking a button >> "add to basket" on every item page. My purpose is to fill a single >> form, with 1 or many products. Than a single button, saves a checkout >> object and many product object. > > Use formsets, or dynamically generate HTML input fields with prefixes in the > names and, in your view, dynamically instantiate ModelForm instances with > each prefix and save them. > > > -- > 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: dynamic form with popup
Ok. Thank you so much. So, formset is a suitable way to achieve this. But, is it the most django-oriented way? Is there any alternative way? Maybe using popup window to select a product, and handle the return value of popup, then use a hiddenvalue to hold the return value. And repeat this for many times, to add multiple product? Is it a common way? Thanks again, 2011/8/23 Shawn Milochik : > On 08/22/2011 05:33 PM, ozgur yilmaz wrote: >> >> thanks, >> >> but i think i have to use a suitable js for adding a new product. am i >> wrong? >> > > To do it the way you want you'll have to use JavaScript, but it's easy > (especially with jQuery) to dynamically add elements to your form. No > refreshing necessary. Then handle the contents of request.POST appropriately > in your view. > > -- > 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: dynamic form with popup
Thanks Shawn, I think i satisfied with this way. It seems a suitable way for Django. I'll use it. Thanks again, 2011/8/23 Shawn Milochik : > On 08/22/2011 05:44 PM, ozgur yilmaz wrote: >> >> Ok. Thank you so much. So, formset is a suitable way to achieve this. >> But, is it the most django-oriented way? Is there any alternative way? >> Maybe using popup window to select a product, and handle the return >> value of popup, then use a hiddenvalue to hold the return value. And >> repeat this for many times, to add multiple product? Is it a common >> way? Thanks again, >> > > Given that a Django formset is a feature of Django, I'd say it's a pretty > django-oriented way. However, the way I suggested doesn't require formsets. > > Briefly: > > 1. Have JavaScript on your page that can dynamically add elements to your > HTML form. > > 2. Ensure that your JavaScript attaches a unique prefix to each set of > elements that belong together. Example, if you'll have a product ID and > quantity, you need to make sure that each pair share the same prefix and no > other elements share that prefix. > Example: > > > > > > > 3. In your view, get a list of the prefixes from your request.POST. > > 4. For each prefix, create a ModelForm instance passing the prefix kwarg > with the prefix and request.POST as the data kwarg. > > From there it's straightforward. > > Shawn > > -- > 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: Django Development environment
Windows XP and windows 7. Notepad++. Mysql. South. 2011/8/23 Shawn Milochik : > On 08/22/2011 06:07 PM, Stephen Jackson wrote: >> >> I am new to the world of Django. I would like to hear from other django >> developers describe their dev environment (tools, os, editors, etc.). > > Ubuntu, virtualenv, Komodo Edit, vim, git > > Must-haves: > Development: > South, pyflakes, selenium > Deployment: > supervisord, gunicorn > > -- > 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.
A problem about get_absolute_url()
Hi all, I have 4 classes and i want to build a get_absolute_url() for a class, querying other 3 classes. But i get "list index out of range" error for the FILTER row. Any ideas? class Aaa( models.Model ): ... ... class City( models.Model ): ... ... class Bbb( models.Model ): aaa = models.ForeignKey( Aaa ) city = models.ForeignKey( City ) ... ... class Ccc( models.Model ): aaa = models.ForeignKey( Aaa ) ... ... def get_absolute_url(self): bbbs = Bbb.objects.filter( aaa = self.aaa ) city = City.objects.get( id = bbbs[0].city.id ) return "/" + city.name + "/" + str(self.id) -- 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.
A question about template fragment caching
Hi all, I'm using template fragment caching in my project. I'm wondering what the view function do when template fragment caching is active? Are queries in the view function be executed? Or bypass the queries and read the cached fragment? Thanks, -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: A question about template fragment caching
Thank you for information:) 2013/2/16 Christophe Pettus : > > On Feb 16, 2013, at 9:16 AM, Christophe Pettus wrote: > >> >> On Feb 16, 2013, at 8:50 AM, ozgur yilmaz wrote: >> >>> I'm using template fragment caching in my project. I'm wondering what >>> the view function do when template fragment caching is active? Are >>> queries in the view function be executed? Or bypass the queries and >>> read the cached fragment? >> >> The view function is not bypassed when template fragment caching is active. >> Thus, if you do a bunch of expense queries to populate the context, those >> queries will still happen; the only step that is skipped is the actual >> rendering of the template. It's often a good idea to have those expense >> queries be done on-demand in a callable that is invoked by the template, so >> they are only called when the template is actually rendered. > > Of course, QuerySets are (usually) lazy, so if you pass them in to the > template via the context unevaluated, and that fragment of the template is > cached, the query won't be executed. > > -- > -- Christophe Pettus >x...@thebuild.com > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
A query question
Hi all, I have to build a query, if possible an inexpensive query: Model A: ... ... Model B: ForeignKey( Model A ) Date ... Model B is an activity with a date field. I want to find which Model A objects didnt join an activity between specific dates. What are the appropriate ways to find this result? Any ideas? Thanks, -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: A query question
Hi, Actually my question is not about the date range. i'm planning to use __lte and __gte filters. My problem is to solve the query (getting A objects using B objects) inexpensively. Thanks anyway, I used: b_objects = B.objects.filter( activity_date__gte = specific_start_date , activity_date__lte = specific_end_date ) a_objects = A.objects.exclude( kisi__in = b_objects ) Is it enough? 2013/2/26 carlos : > Hi, maybe use DateField__range(date1,date2) > > Cheers > > > On Tue, Feb 26, 2013 at 5:43 AM, ozgur yilmaz wrote: >> >> Hi all, >> >> I have to build a query, if possible an inexpensive query: >> >> Model A: >> ... >> ... >> >> Model B: >> ForeignKey( Model A ) >> Date >> ... >> >> Model B is an activity with a date field. I want to find which Model A >> objects didnt join an activity between specific dates. >> >> What are the appropriate ways to find this result? Any ideas? >> >> Thanks, >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: A query question
Thanks for the replies. I should use exclude, to find A objects, so should try this i think: ModelB.objects.exclude(modelA__fielddate__range(date1,date2)) 2013/2/26 Ronan Foucher : > ModelB.objects.filter(modelA__fielddate__range(date1,date2)) > > Based on the db backend and the number of column you can add an index on > fielddate ( check explain output to see if it's useful since it depends on > db backend/ dbengine/structure of the table to make it 'inexpensive' ) > > ~ Ronan > > > On Tue, Feb 26, 2013 at 9:59 AM, ozgur yilmaz wrote: >> >> Hi, >> >> Actually my question is not about the date range. i'm planning to use >> __lte and __gte filters. My problem is to solve the query (getting A >> objects using B objects) inexpensively. Thanks anyway, >> >> I used: >> >> b_objects = B.objects.filter( activity_date__gte = specific_start_date >> , activity_date__lte = specific_end_date ) >> >> a_objects = A.objects.exclude( kisi__in = b_objects ) >> >> Is it enough? >> >> 2013/2/26 carlos : >> > Hi, maybe use DateField__range(date1,date2) >> > >> > Cheers >> > >> > >> > On Tue, Feb 26, 2013 at 5:43 AM, ozgur yilmaz wrote: >> >> >> >> Hi all, >> >> >> >> I have to build a query, if possible an inexpensive query: >> >> >> >> Model A: >> >> ... >> >> ... >> >> >> >> Model B: >> >> ForeignKey( Model A ) >> >> Date >> >> ... >> >> >> >> Model B is an activity with a date field. I want to find which Model A >> >> objects didnt join an activity between specific dates. >> >> >> >> What are the appropriate ways to find this result? Any ideas? >> >> >> >> Thanks, >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> >> Groups >> >> "Django users" group. >> >> To unsubscribe from this group and stop receiving emails from it, send >> >> an >> >> email to django-users+unsubscr...@googlegroups.com. >> >> To post to this group, send email to django-users@googlegroups.com. >> >> Visit this group at http://groups.google.com/group/django-users?hl=en. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "Django users" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to django-users+unsubscr...@googlegroups.com. >> > To post to this group, send email to django-users@googlegroups.com. >> > Visit this group at http://groups.google.com/group/django-users?hl=en. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > > -- > Cordialement / Best Regards > > Ronan FOUCHER > IS / IT > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
change extension of uploaded image
Hi, I want to change the filetype of any uploaded image to JPG. What is the most efficient way for this? I think i surely do this before save(). Any ideas? 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.
Re: change extension of uploaded image
My solution is: def save( self ): if self.image1: original = Image.open( self.image1 ) if original.mode not in ('L', 'RGB'): original = original.convert('RGB') cp_image = original.copy() cp_image_handle = StringIO() cp_image.save( cp_image_handle, 'JPEG', quality=100 ) cp_image_handle.seek(0) cp_image_upload = SimpleUploadedFile(os.path.split(self.image1.name)[-1],cp_image_handle.read(), content_type='image/jpeg') self.image1.save( "changed_extension.jpg", cp_image_upload, save=False) super( MyModel , self ).save() 2011/4/15 ozgur yilmaz : > Hi, > > I want to change the filetype of any uploaded image to JPG. What is > the most efficient way for this? I think i surely do this before > save(). Any ideas? > > 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.
nested template tags
Hi, I want to use an expression like this: {{ i }} The first {{ i }} is in another tag. is there any way to manage this problem? 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.
Re: nested template tags
TemplateSyntaxError at /the/url/ qstring_set requires 1 arguments, 0 provided 2011/5/26 Nikhil Somaru : > Could you detail the error raised when you visit the page? > > On Thu, May 26, 2011 at 12:38 PM, ozgur yilmaz wrote: >> >> Hi, >> >> I want to use an expression like this: >> >> {{ i }} >> >> The first {{ i }} is in another tag. is there any way to manage this >> problem? >> >> 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. >> > > > > -- > Yours, > Nikhil Somaru > > -- > 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: nested template tags
thanks for your help... template tag: @register.filter(name='get_page') def get_page(var, name): return u"%s=%d" % (name,var) template: {% with i|get_page:'page' as xxx %} i {% endwith %} yes, i was planning to use snippet at http://djangosnippets.org/snippets/553/ for get parameters. 2011/5/26 Andreas Rammhold : > Heya, > I'm not 100% sure if this solves the problem for you (or if it's even > intended to do what you want) but: > > {% with old_i=i %} > {{ i }} > {% endwith %} > > Haven't tried that yet but could be worth a shot. > > https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#with > > > On Thu, May 26, 2011 at 9:08 AM, ozgur yilmaz wrote: >> Hi, >> >> I want to use an expression like this: >> >> {{ i }} >> >> The first {{ i }} is in another tag. is there any way to manage this problem? >> >> 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. >> >> > > -- > 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.
howto remove request.GET parameter
Hi, I have a custom templatetag function like this: @register.filter(name='rem_get_request') def rem_get_request(getrequest,name): req = getrequest.copy() for get_item in name.split('&'): if get_item in req and req[get_item]: get_item = get_item.strip() del req[get_item] if req: return u"?%s" % (req.urlencode()) return u"" "getrequest" parameter is request.GET and "name" parameter is the parameters to be removed, splitted by '&' (ampersand) (ie "min_price&max_price" ) The problem is: If request.GET has more than 1 parameter ( ?tag=mytag&min_price=1000&max_price=1500 ) i can remove one or more parameters. But if request.GET contains only one parameter ( ?tag=mytag ) then it doesnt work. the "if" statement works, but "del" doesnt work. i cannot remove this last parameter. What am i doing wrong? Thanks for your information. -- 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: howto remove request.GET parameter
I realized that, there's nothing wrong with the removing code. The problem is the return statement. when the dictionary req is empty the def returns u"" and somehow old request.GET remains unchanged. So i should return a specific value, when the dictionary req is null. 2011/6/2 ozgur yilmaz : > Hi, > > I have a custom templatetag function like this: > > @register.filter(name='rem_get_request') > def rem_get_request(getrequest,name): > req = getrequest.copy() > > for get_item in name.split('&'): > if get_item in req and req[get_item]: > get_item = get_item.strip() > del req[get_item] > > if req: > return u"?%s" % (req.urlencode()) > return u"" > > "getrequest" parameter is request.GET > and "name" parameter is the parameters to be removed, splitted by '&' > (ampersand) (ie "min_price&max_price" ) > > The problem is: > If request.GET has more than 1 parameter ( > ?tag=mytag&min_price=1000&max_price=1500 ) i can remove one or more > parameters. But if request.GET contains only one parameter ( > ?tag=mytag ) then it doesnt work. the "if" statement works, but "del" > doesnt work. i cannot remove this last parameter. What am i doing > wrong? > > Thanks for your information. > -- 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.
Start to get error after modifying models
Hi, After i modified some models, i started to get following errors: Traceback (most recent call last): File "C:\Python26\lib\site-packages\django\core\servers\basehttp.py", line 280, in run self.result = application(self.environ, self.start_response) File "C:\Python26\lib\site-packages\django\core\servers\basehttp.py", line 674, in __call__ return self.application(environ, start_response) File "C:\Python26\lib\site-packages\django\core\handlers\wsgi.py", line 241, in __call__ response = self.get_response(request) File "C:\Python26\lib\site-packages\django\core\handlers\base.py", line 141, in get_response return self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "C:\Python26\lib\site-packages\django\core\handlers\base.py", line 165, in handle_uncaught_exception return debug.technical_500_response(request, *exc_info) File "C:\Python26\lib\site-packages\django\views\debug.py", line 58, in technical_500_response html = reporter.get_traceback_html() File "C:\Python26\lib\site-packages\django\views\debug.py", line 109, in get_traceback_html frames = self.get_traceback_frames() File "C:\Python26\lib\site-packages\django\views\debug.py", line 228, in get_traceback_frames pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name) File "C:\Python26\lib\site-packages\django\views\debug.py", line 209, in _get_lines_from_file context_line = source[lineno].strip('\n') IndexError: list index out of range -- First of all, i deleted *.pyc files and restarted the server. But nothing changed. Do you have any suggestions? 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.
www prefix in sitemap.xml
Hi, I'm using sitemap with django. But because of the django_site config in DB, sitemap.xml displays domain without WWW prefix. If i use PREPEND_WWW = True, when i use IP address in browser, the setting prepend www to the IP, so address looks like: www.11.111.11.111. Is there any solution method for this problem? Should i change django_site field value in DB? 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-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.
Model Formset Pre-Filled Problem
Hi, I'm trying to use model formsets. At first, everything is normal. But when i open the form page for the second time, i see that the formset is pre-filled with the previous values. Here is my code: models.py --- class FooModel( models.Model ): a_field = models.FloatField() b_field = models.FloatField() def __unicode__( self ): return self.a_field class CooModel( models.Model ): c_field = models.CharField( blank=True,null=True,max_length = 100 ) def __unicode__( self ): return u"%s" % ( smart_unicode(self.c_field)) forms.py --- from django.forms.models import modelformset_factory FooFormSet = modelformset_factory(FooModel) class CooModel_Form(ModelForm): class Meta: model = CooModel views.py --- def new_func(request): if request.method == 'POST': formset = FooFormSet(request.POST, request.FILES, prefix='foo_prefix' ) if formset.is_valid(): formset.save() return HttpResponseRedirect( '/true/' ) else: return HttpResponseRedirect( '/false/' ) else: formset = FooFormSet(prefix='foo_prefix') variables = RequestContext( request , { 'formset':formset , } ) return render_to_response('yeni_alis_irsaliyesi.html' , variables ) template {% csrf_token %} {% for form in formset.forms %} {{ form.a_field }} {{ form.b_field }} {% endfor %} {{ formset.management_form }} -- 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.
django using wrong python???
Hi, I'm on centos and have two pythons 2.5 and 2.6. I tried in models.py: from fractions import Fraction and got the error: No module named fractions But when i use shell and type "from fractions import Fraction" it's OK, it uses python2.6 installation. How can i modify django installation to use python2.6??? I already defined alias in bash_profile for python2.6, but it seems it doesnt work for django. 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-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: django using wrong python???
I have Centos, and it comes with python2.4(sorry, not 2.5). I installed python2.6 and django is under: /usr/lib/python2.4/site-packages/django /usr/lib/python2.6/site-packages/django i defined alias in bash_profile, so when i give "python" command from shell, python2.6 works... 2010/12/30 Robbington > Why/how have you two versions of Python installed? > > Where is Django installed? > > Rob > > -- > 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. > > -- 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.
Charfield, limiting acceptable characters
Hi there, I want to limit the characters for a charfield with [a-z\-] (characters from a to z (lowercase) and '-' ) Is there any way you know? 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.
Re: Charfield, limiting acceptable characters
It was possible in the past with validator_list. Like: regex = r'^[A-z][\w-]{2,31}$' name = models.CharField(max_length=32, unique=True , validator_list=[validators.MatchesRegularExpression(regex)] ) But with what code to override the clean method? Is there any sample or built in function for this purpose? Thanks, 2011/2/4 Shawn Milochik > The easiest thing to do is override the clean on your form. > > Shawn > > -- > 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: Charfield, limiting acceptable characters
Yes, i know overriding field cleand method, but i couldnt get a start point for character match code. 2011/2/4 Shawn Milochik > > On Feb 4, 2011, at 2:47 PM, ozgur yilmaz wrote: > > It was possible in the past with validator_list. Like: > > regex = r'^[A-z][\w-]{2,31}$' > > name = models.CharField(max_length=32, unique=True , > validator_list=[validators.MatchesRegularExpression(regex)] ) > > > But with what code to override the clean method? Is there any sample or > built in function for this purpose? > > > If your field is named name, then you add a function to your form called > clean_name and put whatever you want in it. > > http://docs.djangoproject.com/en/1.2/ref/forms/validation/ > > Shawn > > -- > 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: Charfield, limiting acceptable characters
Maybe RegexValidator can solve this problem. But i couldnt manage to use it: from django.core.validators import RegexValidator alias = models.CharField( max_length = 100, unique = True, validators=[RegexValidator('[a-z]')] ) 2011/2/4 ozgur yilmaz > Yes, i know overriding field cleand method, but i couldnt get a start point > for character match code. > > 2011/2/4 Shawn Milochik > >> >> On Feb 4, 2011, at 2:47 PM, ozgur yilmaz wrote: >> >> It was possible in the past with validator_list. Like: >> >> regex = r'^[A-z][\w-]{2,31}$' >> >> name = models.CharField(max_length=32, unique=True , >> validator_list=[validators.MatchesRegularExpression(regex)] ) >> >> >> But with what code to override the clean method? Is there any sample or >> built in function for this purpose? >> >> >> If your field is named name, then you add a function to your form called >> clean_name and put whatever you want in it. >> >> http://docs.djangoproject.com/en/1.2/ref/forms/validation/ >> >> Shawn >> >> -- >> 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: Charfield, limiting acceptable characters
Ok, solved the problem. Thanks Lukasz and thanks to all... from django.core.validators import RegexValidator import re namespace_regex = re.compile(r'^[a-z\-]+$') alias = models.CharField( max_length = 100, unique = True, validators=[RegexValidator(regex=namespace_regex)] ) 2011/2/4 ozgur yilmaz > Maybe RegexValidator can solve this problem. But i couldnt manage to use > it: > > from django.core.validators import RegexValidator > alias = models.CharField( max_length = 100, unique = True, > validators=[RegexValidator('[a-z]')] ) > > > > 2011/2/4 ozgur yilmaz > > Yes, i know overriding field cleand method, but i couldnt get a start point >> for character match code. >> >> 2011/2/4 Shawn Milochik >> >>> >>> On Feb 4, 2011, at 2:47 PM, ozgur yilmaz wrote: >>> >>> It was possible in the past with validator_list. Like: >>> >>> regex = r'^[A-z][\w-]{2,31}$' >>> >>> name = models.CharField(max_length=32, unique=True , >>> validator_list=[validators.MatchesRegularExpression(regex)] ) >>> >>> >>> But with what code to override the clean method? Is there any sample or >>> built in function for this purpose? >>> >>> >>> If your field is named name, then you add a function to your form called >>> clean_name and put whatever you want in it. >>> >>> http://docs.djangoproject.com/en/1.2/ref/forms/validation/ >>> >>> Shawn >>> >>> -- >>> 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: Help on adding CSS to django project
In your template: In your urls.py: site_media = os.path.join(os.path.dirname(__file__),'site_media') urlpatterns = patterns('', (r'^site_media/(?P.*)$' , 'django.views.static.serve',{'document_root':site_media}), ) Maybe helps... 2011/2/4 h@ck5t0ck > Hi guys, > am very new to django and am having troubles adding css to my pages > even though i've found some tutorials online > and followed it word for word. > Can anyone please help me urgently? I really appreciate your help. > Best Wishes, > h@ck5t0ck > > -- > 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: How to know if is a update or insert??
try: old_user = User.objects.get(pk=self.pk) # means update except: pass 2011/2/4 andmart > Hi, > > I overrided the save_model of ModelAdmin of model Client that is > associated a one User so I can create a user when a client is created. > > Well, how to know if the save_model was called to do a update or a > insert if the object already exists in database? > > Trying to see if model.pk exists fail. > > Thanks in advance. > > Andre > > -- > 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.
incrementing counter of an cached data
Hi, I'm using file caching. But need to increment a field for storing product hits. Is there an optimal way to do this? 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.
Re: incrementing counter of an cached data
No suggest? 2011/2/7 ozgur yilmaz > Hi, > > I'm using file caching. But need to increment a field for storing product > hits. Is there an optimal way to do this? > > 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.