Re: django user authenication form in modal form twitter bootstrap

2014-06-27 Thread Roman Klesel
I think the view function is wrong. This should do: from django.views.decorators.csrf import csrf_protect from django.shortcuts impor render @csrf_protect def login(request): return render(request, 'login.html') 2014-06-27 6:03 GMT+02:00 sarfaraz ahmed : > Hello >

Re: Unable to add CSRF token to the header

2014-06-26 Thread Roman Klesel
Hello, I'm not quite sure what you are trying to do, but with type: "GET" there is no need to worry about crfs_token. >From the link you posted: """ function csrfSafeMethod(method) { // these HTTP methods do not require CSRF protection return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));

Re: one form, many submits

2014-06-26 Thread Roman Klesel
>From your code: """ if request.method=='GET': if request.POST.get('accept'): bid = QuotedItem.objects.get(id=2) return render(request, 'bills/p_bill.html', {'bid' : bid}) """ if the method is "GET", you will never have any POST parameters. If you want POST

Re: testing equality in template tag

2014-06-26 Thread Roman Klesel
Ugh , sorry of course we know ... forget what i said ... 2014-06-26 9:48 GMT+02:00 Roman Klesel <roman.kle...@gmail.com>: > hard to tell since we do not know what values default_month and month.0 have > ... > try to print in the view and examine: > print type(month[0

Re: testing equality in template tag

2014-06-26 Thread Roman Klesel
hard to tell since we do not know what values default_month and month.0 have ... try to print in the view and examine: print type(month[0]), month[0], type(today.month), today.month 2014-06-25 20:34 GMT+02:00 Lee Hinde : > with view code like so: > > import calendar >

Re: Handling checkbox inputs

2014-06-26 Thread Roman Klesel
Hello, the {{j.i}} can not work as you expect. If i understand you correctly you would like to do something like getattr(list, i) in the template. In order to do this you have 2 possibilities: 1) Write a custom template tag like this

Re: How do I Iterate database object querysets

2014-06-24 Thread Roman Klesel
Hello, I would recommend to create a django form and feed the post data to this form. Because 1) the form will extract the post data for you 2) in the form you will be able the validate and clean the post data (you should definitively do that) The code that saves the data to the form could also

Re: Form validation vs. DRY

2013-07-03 Thread Roman Klesel
2013/7/3 Tomas Ehrlich : > you can use model validation > https://docs.djangoproject.com/en/dev/ref/models/instances/#validating-objects This sounds very good! :-) Thanks! -- You received this message because you are subscribed to the Google Groups "Django users"

Form validation vs. DRY

2013-07-03 Thread Roman Klesel
Hello, I'm programming a database front end. In many cases I want to constrain the data written to the database. Therefore I implement some checks either through real database constraints or trough some logic in the model, so it will throw an exception when the constraints are not met. e.g.:

Re: deprecation of DotExpandedDict announced?

2012-12-17 Thread Roman Klesel
2012/12/17 donarb > > > https://github.com/django/django/commit/c57abd3c29cedcca00821d2a0d5708f10977f3c6 > > ahh the commit, thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Custom option for Model Meta Options

2012-03-27 Thread Roman Klesel
Hello Anssi, thanks! Seems to work. I tried it like this: from django.db import models class MyModelBase(models.base.ModelBase): def __new__(cls, name, bases, attrs): attr_meta = attrs.pop('Meta', None) try: has_cpk= attr_meta.has_composite_primary_key

Custom option for Model Meta Options

2012-03-26 Thread Roman Klesel
d be quite easy to accomplish this by paching the django source. However I'd prefere to do this by subclassing. How to do this? Best regards Roman Klesel -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send e

Re: Optimization of a Large QuerySet iteration

2011-07-27 Thread Roman Klesel
2011/7/26 nixlists : > Is it a best practice to take a bunch of code out to the stored > procedures as much as possible, or the opposite is true with Django? I don't want to comment on whether it's best practice or not ... I was thinking about efficiency: If the data

Re: Optimization of a Large QuerySet iteration

2011-07-26 Thread Roman Klesel
Hello, 2011/7/25 nixlists : > Is there a way to rewrite the dictionary code above to make it more > readable, and/or rewrite everything in a more efficient manner in > general? I also consider myself a beginner in programming but I've been using django for about 1 year now.

Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread Roman Klesel
hmm... strange... the __unicode__ thing is nothing django-specific. It works in plain python as well: It's supposed to work like this: >>> class TestClass(object): ... def __unicode__(self): ... return "unicode" ... def __repr__(self): ... return "buh" ... def

Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread Roman Klesel
2011/5/16 maaz muqri : > I am getting this > Poll.objects.all() > [] What do you get when you do: print unicode(Poll.objects.all()[0]) ? Regards Roman -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: referencing fields on the model without F()

2011-04-13 Thread Roman Klesel
Hello Yuka, 2011/4/13 Yuka Poppe : > You could possibly resort to the extra() queryset method, allthough it eats > raw sql, its documented in the manual. Im not sure if its in 0.96 though. Yes, thanks! I think I found a solution: hw=Hardware.objects\

referencing fields on the model without F()

2011-04-13 Thread Roman Klesel
Hello, I have an old version of django here where the F() object is not available (0.96). Is there a chance to reference a field on the same model without using using F()? I'd like to write: hw=Hardware.objects.filter(he=F('rack__he')) ... but there is no F() in this version. Any ideas?

Re: confused about ModelForm Field validation

2011-02-18 Thread Roman Klesel
2011/2/18 Roman Klesel <roman.kle...@googlemail.com>: >> I would use pre_save signal for data modification did not really work. In any case I need to use to_python so that the ModelForm displays the right value, and then I'm in *BEEP*, since to_python not only receives the values

Re: confused about ModelForm Field validation

2011-02-18 Thread Roman Klesel
Hello Piotr, 2011/2/18 Piotr Zalewa : > > I would use pre_save signal for data modification > hmm ... this sounds like a good idea. It would make the whole thing a lot more compact ... I'll give it a try. Thank's! Roman -- You received this message because you are

confused about ModelForm Field validation

2011-02-18 Thread Roman Klesel
Hello guys, I'm running django on a legacy database and in some cases the values stored in the tables have to be converted before the can be displayed and also have to be converted bevore bein saved to the database. Example: A table for storing IP addresses: The address field contains values

Re: models.CharField.null=True ignored

2011-02-10 Thread Roman Klesel
2011/2/10 : ... Thanks for the kind words. Your comments are very welcome! -- 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

Re: models.CharField.null=True ignored

2011-02-10 Thread Roman Klesel
2011/2/10 : '' == None > False yes, makes sense ... I was thinking of things like: if '': if []: ... which probably lead me to a wrong conclusion. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: models.CharField.null=True ignored

2011-02-10 Thread Roman Klesel
Hello Daniel, thanks for you reply 2011/2/10 Daniel Roseman : >> >>> from test_django.roman.models import Jtem >> >>> o=Jtem.objects.get(pk=29) >> >>> o.name='' >> >>> o.save() >> >> Now the record looks like this: >> >> mysql> select * from roman_jtem where id=29; >>

models.CharField.null=True ignored

2011-02-10 Thread Roman Klesel
Hello community, I'm using a django version 1.3 beta 1 SVN-15481 and a mysql 5 backend I have the following field definition in my model: class Jtem(models.Model): name=models.CharField(blank=True, null=True, max_length=255) nachname=models.CharField(max_length=255) Doing manage.py

Re: Error when subclassing models.ForeignKey field

2011-01-26 Thread Roman Klesel
Hello again, since no one responded untill now, I'd like to bring this back to attention. If no one knows an answer to my question, maybe some one could give me some hint what I could do? Should I open a bug report? Thanks in advance! Roman -- You received this message because you are

Error when subclassing models.ForeignKey field

2011-01-25 Thread Roman Klesel
Hello, I'm using a current SVN checkout of django an I'm having difficulties creating a custom field. class ForeignKeyAX(models.ForeignKey): __metaclass__ = models.SubfieldBase description = "ForeignKey field prepared for Ajax Autocompletion" def __init__(self,*args,**kwargs):