Accessing a field's verbose_name

2015-08-04 Thread Déborah Leder
Hello I have created models in a django application. class FicheService(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=64, verbose_name="Nom", blank=False) phone = models.CharField(max_length=16, validators=[phone_verif], blank= True, null=T

Re: Accessing a field's verbose_name

2015-08-04 Thread Déborah Leder
I am sorry, it seems like I've made a cuple of typos The name of my method is indeed get_descr all the time, so that is not the source of the problem. And the command that I h

Re: BaseListView's get_context_data is missing kwargs?

2015-08-04 Thread Ken
Django is really well documented. So much so, it's an effort to wade through it. So, sometimes (most times), I resort to looking at the source code. The downside is you miss these little tips mentioned in the docs, you miss the philosophy behind why it's done a particular way. On Monday, Au

Passing parameters / attributes to javascript in a template

2015-08-04 Thread Déborah Leder
Hello I am currently developping a django geolocalisation application. Therefore, I need both python and javascript. I would like to give some parameters to a script in a template, that is to say, in my template, I want to use the script tag to define/modify some javascript variables. Here is m

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Larry Martell
On Tue, Aug 4, 2015 at 9:14 AM, Déborah Leder wrote: > Hello > > I am currently developping a django geolocalisation application. Therefore, > I need both python and javascript. > I would like to give some parameters to a script in a template, that is to > say, in my template, I want to use the sc

Django Logical Deletes on Models

2015-08-04 Thread psychok7
So i decided to fork pinax-models because i need the capability of soft deleting objects and their related (setting a flag but not really deleting them). This is a project that seems to be unmaintained , so i diged into the code and i am trying to make some improvements. It basically fetched

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Déborah Leder
Hello Larry, thank you for your response. I didn't run the debugger, but i know that my values are correctly passed in the template (when it it outside of the script tags), because at the end of my template, I have also written the code : {% for current_addr in mymodel.addresses.all %} {{ c

Re: Django 1.4 - how to display a success message on form save

2015-08-04 Thread Sammy
I'm pretty sure you have to use AJAX to display the message without reloading. -- 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...@googlegro

Re: Accessing a field's verbose_name

2015-08-04 Thread Mike Dewhirst
On 4/08/2015 10:11 PM, Déborah Leder wrote: I am sorry, it seems like I've made a cuple of typos This works for me ... def get_verbose_name(obj, field): """New _meta API

help with list_editable and raw_id_fields

2015-08-04 Thread Marcela Campo
Hi eveyone, I am having issues with list_editable and raw_id_fields. I am adding one field to both attributes like this lass LocationDataReview(admin.ModelAdmin): list_display = ('country', 'state', 'city', 'area','location') list_editable = ('location',) raw_id_fields = ("location"

Re: Accessing a field's verbose_name

2015-08-04 Thread Déborah Leder
Thanks for your answer, Mike. However, I have just tried it and it doesn't seem to work for me either... Your code : self.__class__()._meta.get_field('{0}'.format(field_name)).verbose_name gives the exact same result as self._meta.get_field(field_name).verbose_name -- You received this message

Django 1.8, migrations and database views

2015-08-04 Thread marcin . j . nowak
Hi, Who knows how to disable auto-making migrations for models mapped to database views? I've set managed=False but it does nothing. Django adds CreateModel operation to migration file, but it shouldn't do that. Can anyone help? Thanks. BR, Marcin -- You received this message because you ar

Re: Django 1.8, migrations and database views

2015-08-04 Thread marcin . j . nowak
Oh my s**t. Django generates operation but does not execute it when migrating. What a mess... Solved by Django itself... On Tuesday, August 4, 2015 at 5:21:07 PM UTC+2, marcin@gmail.com wrote: > > Hi, > > Who knows how to disable auto-making migrations for models mapped to > database vie

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Vijay Khemlani
Have you checked the HTML that is actually rendered by the Django template? On Tue, Aug 4, 2015 at 10:39 AM, Déborah Leder wrote: > Hello Larry, thank you for your response. > > I didn't run the debugger, but i know that my values are correctly passed > in the template (when it it outside of the

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Déborah Leder
After some more tests, I have managed to understand where my problem is (but I don't know how to resolve it). Here is my final piece of code : my_markers = [ {{ mymodel.set_first_call_true }} {% for current_addr in mymodel.addresses.all %} {% if not mymodel.first_call %},{%

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Alex Heyden
I don't quite follow what you're doing with set_first_call_true and set_first_call_false. Are you using that to control the for loop behavior? If you are, take a look at https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#for. Django's template language has that built in. If you're push

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Daniel Roseman
On Tuesday, 4 August 2015 17:32:11 UTC+1, Alex Heyden wrote: > > I don't quite follow what you're doing with set_first_call_true and > set_first_call_false. Are you using that to control the for loop behavior? > > If you are, take a look at > https://docs.djangoproject.com/en/1.8/ref/templates/bu

Upload new file to the uploaded file path

2015-08-04 Thread Robin Lery
I have a model for Video: class Video(models.Model): title = models.CharField(max_length=75) pubdate = models.DateTimeField(default=timezone.now) original_video = models.FileField(upload_to=get_upload_file_name) mp4_720 = models.FileField(upload_to=get_upload_file_name,blank=True,

Re: Celery to process task and modify the model fields

2015-08-04 Thread Robin Lery
Hi, Thank you so very much kind sir. This really helped! On Wed, Jul 15, 2015 at 4:08 PM, 'Tom Evans' via Django users < django-users@googlegroups.com> wrote: > On Tue, Jul 14, 2015 at 9:15 PM, Robin Lery wrote: > > Yes. That time you were the one to guide me. I was looking at other > projects >

Re: Accessing a field's verbose_name

2015-08-04 Thread Mike Dewhirst
On 5/08/2015 12:53 AM, Déborah Leder wrote: Thanks for your answer, Mike. However, I have just tried it and it doesn't seem to work for me either... Your code : | self.__class__()._meta.get_field('{0}'.format(field_name)).verbose_name | gives the exact same result as | self._meta.get_field(fiel