admin.py, save_model and content-type of a file

2008-10-02 Thread ozgur
ileAdmin(admin.ModelAdmin): def save_model(self, request, obj, form, change): obj.content_type = request.FILES['cfile']['content-type'] admin.site.register(content, contentfileAdmin) thanks to all helpers -- Ozgur Odabasi --~--~-~--~~--

Re: admin.py, save_model and content-type of a file

2008-10-02 Thread ozgur
obj.content_type = req.headers.get('content-type') return obj.save() but gets all flv contenttypes as text/plain any ideas? -- Ozgur Odabasi ozgur wrote: > Hello, > > I am trying to get content-type of uploading file in admin, and I always > get the error: >

Re: change i18n language through hyperlinks

2008-12-02 Thread Ozgur Odabasi
try this def set_language(request, lang_code): next = request.REQUEST.get('next', None) if not next: next = '/' response = http.HttpResponseRedirect(next) if lang_code and check_for_language(lang_code): settings.LANGUAGE_CODE=lang_co

Re: change i18n language through hyperlinks

2008-12-03 Thread Ozgur Odabasi
wow this is dangerous! Changes language settings for all users ;P But I couldnt unerstand how session and cookie frameworks works, documented examples doesn't work... On Dec 3, 6:56 am, Ozgur Odabasi <[EMAIL PROTECTED]> wrote: > try this > > def set_language(request, lang_c

ModelForm with only FileField or ImageField can not pass validation

2008-12-13 Thread Ozgur Gunes
geField(required=True) class Meta: model = Profile fields = ['mugshot'] # This form pass validation: class MugshotForm(forms.ModelForm): gender = forms.CharField(widget=forms.HiddenInput()) mugshot = forms.ImageField(required=True)

Uploading fetched image

2008-12-17 Thread Ozgur Gunes
examle.com/image1.jpg"; /> http://examle.com/image2.jpg " />http://examle.com/image1.jpg"; /> I call myself as a newbie coder, I couldn't handle this since morning and my brain stopped now. Any idea please. Thanks alot. Ozgur Gunes

Django Database API in standalone mode

2010-05-09 Thread Ozgur Yılmaz
Hi everybody, I'm writing an open source asset,resource and project manager for animation and vfx studios. And I want to use Django's database api to handle all the db stuff. In my system every project is going to have its own database (probably sqlite3 files in project root folder). So what is th

Python Database Framework

2010-05-14 Thread Ozgur Yılmaz
Hi everybody, Do anyone knows a Python Database framework, which resembles Django's approach to database programming? I need it to use outside of Django, for other Python scripts. Best regards, E.Ozgur Yilmaz Lead Technical Director www.ozgurfx.com -- You received this message because you are

Re: Python Database Framework

2010-05-14 Thread Ozgur Yılmaz
; Elixir is cool. I used it with > http://elixir.ematia.de/apidocs07/elixir.ext.versioned.html > and it saved my bacon ! > > > > On May 14, 10:51 am, Nabil Servais wrote: > > Hello > > Le 14 mai 2010 à 16:47, Ozgur Yılmaz a écrit : > > > > > Hi everybody

Re: Python Database Framework

2010-05-14 Thread Ozgur Yılmaz
Now I'm stuck... As you guys pointed to me, I've searched the web for DJANGO_SETTINGS_MODULE and found that I can use django.conf.settings to set the settings and that allowed me to use django in standalone scripts. To be more clear I use: from django.conf import settings then in the code somew

Re: Python Database Framework

2010-05-16 Thread Ozgur Yılmaz
Nabil Servais wrote: > > Hello > > Le 14 mai 2010 à 16:47, Ozgur Yılmaz a écrit : > > > > > Hi everybody, > > > > > Do anyone knows a Python Database framework, which resembles Django's > approach to database programming? > > > &g

template problem with login.html

2010-09-17 Thread ozgur yilmaz
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-user

minimum system requirements

2010-10-31 Thread ozgur yilmaz
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

django admin css problem

2010-12-02 Thread 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/l

Re: django admin css problem

2010-12-02 Thread ozgur yilmaz
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: > > > > &

Re: static serve problem

2010-01-28 Thread Ozgur Yılmaz
Merhaba Ibrahim, sanirim hata surada: wrote: > Hi, > I've made what saying at > http://superjared.com/entry/requiring-login-entire-django-powered-site/ > url. But i cant import to my css file which stay under /extend/ > directory. I have diffrent apps and I can import with that that css > file.

Redundant alterations for every psycopg2 db connection

2010-03-01 Thread ozgur vatansever
Hi, I have a django-based web application (django 1.1.0) and I encounter some db related issues. (i am using python_psycopg2 and PostgreSQL 8.4) Every connection psycopg2 establishes, it performs the following statements: Feb 27 04:02:04 gallus postgres[28534]: [6756-1] user=postgres,db=markafon

Re: Is any thing for python like .jar files for java.

2010-04-04 Thread Ozgur Yılmaz
python egg's E.Ozgur Yilmaz Lead Technical Director www.ozgurfx.com On Sun, Apr 4, 2010 at 11:12 PM, George Cox wrote: > On 9 Feb 2010, at 20:05, chiranjeevi muttoju wrote: > > > Is there any concept in python like .jar files in java. If anybody of you > know please reply me. > > This is not a

Re: Displaying template location in html

2012-01-31 Thread Ustun Ozgur
+1 for debug toolbar. If you choose to do it manually though, you can make use of a middleware instead of passing templates in each view function explicitly, as shown here: http://djangosnippets.org/snippets/766/ Ustun -- You received this message because you are subscribed to the Google Gr

Re: Django Caching appended character issue

2012-01-31 Thread Ustun Ozgur
No idea actually, but I would look for BOM related issues. Ustun -- 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/-/YpAgjT_A98MJ. To post to this group, send

How to build this query

2012-11-09 Thread ozgur yilmaz
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 ):

Re: How to build this query

2012-11-09 Thread ozgur yilmaz
bute "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 ): &

Re: How to build this query

2012-11-09 Thread ozgur yilmaz
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_

dynamic form with popup

2011-08-22 Thread 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 mul

Re: dynamic form with popup

2011-08-22 Thread ozgur yilmaz
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): >>

Re: dynamic form with popup

2011-08-22 Thread ozgur yilmaz
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 i

Re: dynamic form with popup

2011-08-22 Thread ozgur yilmaz
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? >> > >

Re: dynamic form with popup

2011-08-22 Thread ozgur yilmaz
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. >>

Re: Django Development environment

2011-08-22 Thread ozgur yilmaz
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, virtuale

Re: Which IDE should I use for Django?

2011-12-19 Thread Ozgur Vatansever
Emacs + django-mode works well. https://code.djangoproject.com/wiki/Emacs On 19.12.2011 12:34, Alec Taylor wrote: > I'm looking for a Django IDE which incorporates the following features: > - Syntax-highlighting > - Projects (all code file of the project shown separated by directory > in a sidebar

A problem about get_absolute_url()

2012-11-12 Thread ozgur yilmaz
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

A question about template fragment caching

2013-02-16 Thread ozgur yilmaz
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 sub

Re: A question about template fragment caching

2013-02-16 Thread ozgur yilmaz
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 &

A query question

2013-02-26 Thread ozgur yilmaz
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 r

Re: A query question

2013-02-26 Thread ozgur yilmaz
_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

Re: A query question

2013-02-26 Thread ozgur yilmaz
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: >>

change extension of uploaded image

2011-04-15 Thread 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 ema

Re: change extension of uploaded image

2011-04-15 Thread ozgur yilmaz
oad, 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

nested template tags

2011-05-26 Thread ozgur yilmaz
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@google

Re: nested template tags

2011-05-26 Thread ozgur yilmaz
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

Re: nested template tags

2011-05-27 Thread ozgur yilmaz
hat 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 }} >> >>

howto remove request.GET parameter

2011-06-02 Thread 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

Re: howto remove request.GET parameter

2011-06-02 Thread ozgur yilmaz
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

Start to get error after modifying models

2011-08-05 Thread ozgur yilmaz
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

www prefix in sitemap.xml

2010-12-14 Thread ozgur yilmaz
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

Model Formset Pre-Filled Problem

2010-12-23 Thread ozgur yilmaz
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.FloatFi

django using wrong python???

2010-12-30 Thread ozgur yilmaz
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

Re: django using wrong python???

2010-12-30 Thread ozgur yilmaz
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 Robbin

Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
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

Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
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 t

Re: Charfield, limiting acceptable characters

2011-02-04 Thread 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

Re: Charfield, limiting acceptable characters

2011-02-04 Thread 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

Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
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

Re: Help on adding CSS to django project

2011-02-04 Thread ozgur yilmaz
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 d

Re: How to know if is a update or insert??

2011-02-04 Thread ozgur yilmaz
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 ca

incrementing counter of an cached data

2011-02-07 Thread 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.

Re: incrementing counter of an cached data

2011-02-07 Thread ozgur yilmaz
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 "Djang

A sample project showing server side rendering with React and Django

2015-01-24 Thread Ustun Ozgur
Last year I gave a conference talk at Djangocon EU where I introduced React.js to the community. Since then, I have been getting some emails asking for some sample code. I just published a sample project that simply uses a node.js server to delegate server side rendering from Django. Hope that

Re: A sample project showing server side rendering with React and Django

2015-01-25 Thread Ustun Ozgur
t; On Saturday, January 24, 2015 at 7:13:56 AM UTC-6, Ustun Ozgur wrote: >> >> Last year I gave a conference talk at Djangocon EU where I introduced >> React.js to the community. Since then, I have been getting some emails >> asking for some sample code. >> >> I just p

Re: A sample project showing server side rendering with React and Django

2015-01-26 Thread Ustun Ozgur
For most brown-field projects, that's not an option. Besides that, I believe that outside templating system, remaining parts of Django (models, managers etc) are solid, so I still prefer that as opposed to a node.js solution. But that's clearly a personal preference. Ustun

Re: A sample project showing server side rendering with React and Django

2015-01-27 Thread Ustun Ozgur
t; server-side rendering of React templates (which I will try avoid in the > beginning stages, anyway), I can skip node.js. > > Learning React is on my todo list. Then I'll need to dig deeper. I suppose > then I might change my mind...;-) > > On Monday, January 26, 2015 at

Appending trailing slashes to jQuery Ajax requests automatically

2014-10-14 Thread Ustun Ozgur
I have published a small snippet at https://github.com/ustun/ensure-trailing-slash-for-jquery-ajax/blob/master/ensure_slash.js that automatically adds a trailing slash to every outgoing AJAX request so as to minimize accidental redirects. Best, Ustun (Inspired by https://docs.djangoproj