Re: Rendering TabuarInline inside ModelAdmin without a foreign key

2014-11-02 Thread Mario Gudelj
Thanks Collin. That's the path I've had to take. On 03/11/2014 11:55 am, "Collin Anderson" wrote: > Hi Mario, > > If you are able to edit the model replacing the IntegerField with this > should do what you want: > user = models.ForeignKey(CRMUser, null=True, blank=True, >

Unit-testing Custom Admin Action, requires request and querysets parameters.

2014-11-02 Thread Azam Alias
Hi, I would like to unit-test the activate_apps( ) and deactivate_apps( ) functions below, as low-level as possible. How could I do this without going through Selenium (FT) route? In my admin.py: from django.contrib import admin from my_app_listing.models import App class

Re: Working with requests app

2014-11-02 Thread Collin Anderson
Hello, Does this work? def realizarPago(request): parametros_payu = {} # I use my params here in a dict url = "https://gateway.payulatam.com/ppp-web-gateway/; return HttpResponse(requests.post(url, data=parametros_payu).text) Collin -- You received this message because you are

Re: Model Manager QuerySet over-ride class not working as expected

2014-11-02 Thread Collin Anderson
Hello You are saying this doesn't work as expected? class MemberActive(models.Manager): def get_queryset(self): qs = super(MemberActive, self).get_queryset().filter(status='Active' ) return qs class Member(models.Model): # etc Active_objects = MemberActive() assert

Re: broken image on my django production site. Why is it?

2014-11-02 Thread Collin Anderson
Hello, You may need to install something like dj-static to serve your files. Collin -- 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

Re: Django test discovery and RuntimeError: Conflicting 'entry_tags' models in application 'entries': and .

2014-11-02 Thread Collin Anderson
Hello, The problem is that both D:\projekty\ogloszenia and D:\projekty\ogloszenia\src\apps are on your python path. The recommended way to do it is to import all of your code relative to manage.py and only have that directory on your python path, so in your case, that would be:

Re: Rotate the CSRF token on every request

2014-11-02 Thread Collin Anderson
Hello, You could try setting a new CSRF token using javascript every time a form is submitted. Something like: // Change this selector so it doesn't apply to forms with off-site actions. $(document).on('submit', 'form[method=post]', function(){ for(var c = ''; c.length < 32;) c +=

Re: Get form from modelformset by the model associated in template

2014-11-02 Thread Collin Anderson
Hi Luigi, Do you want something like this? {% for form in modelformset %} The object: {{ form.instance }} The form: {{ form }} {% endform %}} Collin -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: Override

2014-11-02 Thread Collin Anderson
Hi Julien, It also might be possible to "monkeypatch" the function. It's generally not recommended, but it might be worth it in your case. Collin -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: Django formfield_for_foreignkey

2014-11-02 Thread Collin Anderson
Hi Cristian, Maybe you could call traceback.print_stack() to see why it's being called each time. Thanks, Collin -- 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

Re: Rendering TabuarInline inside ModelAdmin without a foreign key

2014-11-02 Thread Collin Anderson
Hi Mario, If you are able to edit the model replacing the IntegerField with this should do what you want: user = models.ForeignKey(CRMUser, null=True, blank=True, on_delete=DO_NOTHING) Collin -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: How not to explicly write very very big json object when rendering page in django template ?

2014-11-02 Thread Vijay Khemlani
Do you really need all the data in that dictionary for the page? You could request the necessary parts by AJAX after the page has loaded. On Sun, Nov 2, 2014 at 6:59 PM, Matlau Issu wrote: > I mean, in my views.py i do : > return render(request, 'myapp/detail.html', {

Working with requests app

2014-11-02 Thread Jorge Andrés Vergara Ebratt
Hello everyone, I'm working with requests app so I can send post data in one of my views, I need to sent it to an external url, I'm integrating with an online payment provider. I'm doing as the docs say: import requests def realizarPago(request): parametros_payu = {I use my params here in

Re: How to generally handle exceptions in function based and class based views?

2014-11-02 Thread Aliane Abdelouahab
why not using the classic try except ? since it is a normal python? Le dimanche 2 novembre 2014 18:18:11 UTC+1, Daniel Grace a écrit : > > Hi, I'm looking for some information / examples of how to generally handle > exceptions and show a message to the user, in function based and class > based

How not to explicly write very very big json object when rendering page in django template ?

2014-11-02 Thread Matlau Issu
I mean, in my views.py i do : return render(request, 'myapp/detail.html', { pydic_jsonized : json.dumps(python_dict) } ) then in my html, i get pydic_jsonized with var json = {{ pydic_jsonized }}; But pydic_jsonized is just furiously big, and is written as harded coded data in the

In django-tables2 how do I paginate from the database

2014-11-02 Thread Néstor Boscán
Hi Can django-tables2 paginate at the database level using SQL OFFSET AND LIMIT?. I have a table that has millions of rows and it doesn't make any sense to load them in memory to show only the first 10 rows. Regards, Néstor -- You received this message because you are subscribed to the

Re: Retrieving other fields along with ValueQueryset

2014-11-02 Thread Joel Goldstick
Using v1.6 On Sun, Nov 2, 2014 at 2:18 PM, Joel Goldstick wrote: > I have a model with a year field and a score field, as well as other > fields. I want to get the highest score for each year. I can do that > with this: > >

Retrieving other fields along with ValueQueryset

2014-11-02 Thread Joel Goldstick
I have a model with a year field and a score field, as well as other fields. I want to get the highest score for each year. I can do that with this: Batting.objects.values('year').annotate(category=Max('score')) But I also want to display the the name associated with the highest score. The

Re: Model Manager QuerySet over-ride class not working as expected

2014-11-02 Thread rmschne
Also, when I call from the calling programm: qs=Member.all().filter(status='Active') ... then just those records where status=Active are returned qs=Member.Active.all() ... all records from data base returned ... but expected only status=Active On Sunday, 2 November 2014 18:12:10 UTC,

Model Manager QuerySet over-ride class not working as expected

2014-11-02 Thread rmschne
I've upgraded to Django 1.7.1 Following the upgrade most (haven't tested all, but for all tested this true) the over-rided queryset is not functioning. when the code calls qs=Member.Active_objects.all() then all members are returned, not just those which confrom to the filter specified in

How to generally handle exceptions in function based and class based views?

2014-11-02 Thread Daniel Grace
Hi, I'm looking for some information / examples of how to generally handle exceptions and show a message to the user, in function based and class based views. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: Warning with 'cycle'

2014-11-02 Thread Neto
Thanks Em domingo, 2 de novembro de 2014 02h05min42s UTC-2, Carl Meyer escreveu: > > On 11/01/2014 01:36 PM, Neto wrote: > > Hi, im using template tag 'cycle' (in Django version 1.7.1,) and is > > showing it in my terminal: > > > > RemovedInDjango18Warning: 'The `cycle` template tag is

Re: broken image on my django production site. Why is it?

2014-11-02 Thread Kakar Nyori
I think, you should add "static"/ in your html: Or else change your directory settings. On Sat, Nov 1, 2014 at 8:21 PM, rdyact wrote: > > > I just product my