Create a view form capable of saving data into models through FK

2015-09-24 Thread eli
Hi Guys, A noob here, I have two models, class Students(CommonInfo): first_name = models.CharField(max_length=75) surname = models.CharField(max_length=75) class_score = models.ForeignKey(Course, related_name='course') exam_score = models.ForeignKey('House')

Re: Redirect from get_queryset() in a class view?

2011-12-12 Thread Eli Criffield
I like the raise exception idea, but where do i catch it? In a decorator? Overwrite get() ? -- 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/-/KMhk4RFokUAJ. T

Redirect from get_queryset() in a class view?

2011-12-10 Thread Eli Criffield
n is to put the condition in get and check there and return redirect. But that seems hacky. I'm just wonder whats the best way to do this. Eli Criffield -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on

Re: custom tag - render() isn't called

2009-09-11 Thread eli
I have problem when tag is called from for loop in template. It's called only once (sic!). Why? --~--~-~--~~~---~--~~ 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@g

Django-logging in production mode

2009-09-09 Thread eli
Hi, It's a good idea to logging errors, notices etc using python module logging in app under production mode (Nginx)? I know about for ex: sending error:500 emails to admins etc, but sometimes I want to log errors and lets app go on. (I'm talking about logging errors to the file, and later send

Re: Custom url in django Django sitemap

2009-09-09 Thread eli
: > Hi eli, > > If you want serve a "static file" (that never changes and doesn't take > advantage of django's template system) then you shouldn't be serving > it with django.  You can use django if you really > want:http://docs.djangoproject.com/en/dev/howto/

Custom url in django Django sitemap

2009-09-09 Thread eli
Hi, How to add custom static url (they are not in database) to Django Sitemap? for ex: /about-me.html, /contact.html, /some-static-url.html regards. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" gro

Re: Django remove value from field with attrs disabled="disabled"

2009-09-06 Thread eli
Thanks for help. regards. --~--~-~--~~~---~--~~ 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

Django remove value from field with attrs disabled="disabled"

2009-09-05 Thread eli
Hi, I have problem with Django Forms and field with set attrs to disabled="disabled" # forms.py class EditForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(EditForm, self).__init__(*args, **kwargs) self.fields['title'].widget.attrs.update({'readonly': 'reado

Re: save_formset() in admin.TabularInline doesn't work.

2009-05-01 Thread eli
Ok, I overloaded save_formset in BAdmin and everything works fine. Thank You. On 1 Maj, 16:46, George Song wrote: > On 5/1/2009 4:29 AM, eli wrote: > > > > > Hi, > > > I have problem with save_form, save_model, save_formset methods in > > Admin class admin.

save_formset() in admin.TabularInline doesn't work.

2009-05-01 Thread eli
Hi, I have problem with save_form, save_model, save_formset methods in Admin class admin.TabularInline. class AAdmin(admin.TabularInline): model = A1 extra = 3 def save_form(self, request, form, change): print "form" return form.save(commit=False) def save_model

Re: Getting data post from input with multiple name

2009-04-27 Thread eli
Ok, I'm going to use string (like: items_{{ data.id }}) Thanks. regards. On 26 Kwi, 21:31, Malcolm Tredinnick wrote: > On Sun, 2009-04-26 at 10:20 -0700, eli wrote: > > Hi, > > > I have problem: > > In my template, I have some inputs with multiple name lik

Getting data post from input with multiple name

2009-04-26 Thread eli
Hi, I have problem: In my template, I have some inputs with multiple name like: How to get this data from request.POST in view method? I tried: - request.POST.get('values', None) - request.POST.get('values[]', None) but didn't wokr.. Thank You. regards. --~--~-~--~~---

Re: Problem with GenericRelation

2009-04-22 Thread eli
Thank You Alex. This patch will be available in Django 1.1 ? On 22 Kwi, 16:56, Alex Gaynor wrote: > On Wed, Apr 22, 2009 at 10:49 AM, eli wrote: > > > Hi, > > > I have a problem with GenericRelation ... > > > My code: > > > class Comment(models

Problem with GenericRelation

2009-04-22 Thread eli
Hi, I have a problem with GenericRelation ... My code: class Comment(models.Model): text = models.TextField() content_type = models.ForeignKey(ContentType, blank=True, null=True) object_id = models.PositiveIntegerField(blank=True, null=True) content_object = generic.GenericForei

Re: Form validation in Admin Panel

2009-04-13 Thread eli
On 13 Kwi, 21:10, Alex Gaynor wrote: > Provide a custom form to the ModelAdmin using the form > option:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#form > > Alex > Oh, it's so simple.. :-) Thank You Alex regards. --~--~-~--~~~---~--~~ You received th

Form validation in Admin Panel

2009-04-13 Thread eli
Hi, How can I to validate data from form in Django Admin Panel? (like: clena_fieldname in form.ModelForm) ? regards. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Form wizard - previous step

2009-04-06 Thread eli
Thank You Elliott. regards. On 6 Kwi, 11:52, Elliott wrote: > On Apr 5, 4:24 pm, eli wrote: > > > No, how to add  functionality to back to the previous step without > > deleting current step's data. > > > regards. > > That can't be done wi

Re: Form wizard - previous step

2009-04-05 Thread eli
No, how to add functionality to back to the previous step without deleting current step's data. regards. On 5 Kwi, 22:39, codecowboy wrote: > Are you asking how to modify the html in the multi-step-form app to > add a button? > > On Apr 5, 4:33 pm, eli wrote: > > >

Re: Form wizard - previous step

2009-04-05 Thread eli
unt of conditional logic (e.g. if stepone then show this form > elseif steptwo show this form)? > > On Apr 5, 1:14 pm, eli wrote: > > > anybody ? :-) > > > regards. > > > On 4 Kwi, 11:17, eli wrote: > > I have no problem reading existing docs if you k

Re: Form wizard - previous step

2009-04-05 Thread eli
anybody ? :-) regards. On 4 Kwi, 11:17, eli wrote: > Hi, > > What is the best way to add button "previous step" to multi-steps > form ? > > Thank You. > > regards. --~--~-~--~~~---~--~~ You received this message because you a

Form wizard - previous step

2009-04-04 Thread eli
Hi, What is the best way to add button "previous step" to multi-steps form ? Thank You. regards. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-use

Re: Problem with Sum() function

2009-03-27 Thread eli
Thank You. regards. On 23 Mar, 23:58, Russell Keith-Magee wrote: > On Tue, Mar 24, 2009 at 12:17 AM, eli wrote: > > > How to pass to the Sum() function (ORM) more than one field? > > > My problem: > > > class Model1(models.Model): > >    name = mode

Re: Problem with Sum() function

2009-03-23 Thread eli
anybody? On 23 Mar, 16:17, eli wrote: > How to pass to the Sum() function (ORM) more than one field? > > My problem: > > class Model1(models.Model): >     name = models.CharField(u'Name', max_length=255) > > class Model2(models.Model): >     fk1 = models.

Problem with Sum() function

2009-03-23 Thread eli
How to pass to the Sum() function (ORM) more than one field? My problem: class Model1(models.Model): name = models.CharField(u'Name', max_length=255) class Model2(models.Model): fk1 = models.ForeignKey(Model1, related_name='fk_1') fk2 = models.ForeignKey(Model1, related_name='fk_2')

Re: Django annotate with Count() problem

2009-03-20 Thread eli
> Seems like you're seeing this:http://code.djangoproject.com/ticket/10060 Yes, It's a big bug. > Try to add distinct() to query set. It's work.. Thanks Alex... distinct is not very fast but it's last way to fix the problem... Proper query: e = File.objects.annotate(comment_cnt=Count('comment',

Re: Django annotate with Count() problem

2009-03-20 Thread eli
I'm using latest SVN version of Django (10105 revision) regards. --~--~-~--~~~---~--~~ 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

Django annotate with Count() problem

2009-03-20 Thread eli
Hi, I have a problem with Django Orm annotate method.. My models (application: app): class File(models.Model): name = models.CharField(max_length=255) file = MyFileField(upload_to=...) class Visit(models.Model): file = models.ForeignKey(File) class Comment(models.Model): file = models

How to compare two different types in templates using ifequal

2009-03-02 Thread eli
Hi, I have a problem (Django 1.1. alpha SVN): Python: week = [1, 2, 3, 4, 5, 6, 7] # There are only two records in objects_list with date_start field = 01.01.2000 and 02.01.2000 objects_list = SomeModel.objects.all() Template: {% for day in week %} {% for e in objects_list %} {# date:"j

How to compare two different types in templates using ifequal

2009-03-02 Thread eli
Hi, I have a problem: Python: week = [1, 2, 3, 4, 5, 6, 7] # There are only two records in objects_list with date_start field = 01.01.2000 and 02.01.2000 objects_list = SomeModel.objects.all() Template: {% for day in week %} {% for e in objects_list %} {% ifequal e.date_start|date:"j" da