Re: Window expression inside Subquery

2018-02-28 Thread Tomáš Ehrlich
It seems to be a bug in Django. Here's the ticket (https://code.djangoproject.com/ticket/29172) with patch and tests if anyone is interested in this topic. Cheers, Tom Dne čtvrtek 1. března 2018 7:38:13 UTC+1 Tomáš Ehrlich napsal(a): > > Hey folks, > I’m getting an AttributeError:

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-02-28 Thread Bernd Wechner
Mike, Yep, adding pk as a final tie breaker is trivial, but not the issue ;-). Alas adding a sequencing field is not an option because I am looking for a generic solution, akin to what the admin site on Django offers, I have a model browser that I want to browse any of my models with.  And I

Window expression inside Subquery

2018-02-28 Thread Tomáš Ehrlich
Hey folks, I’m getting an AttributeError: 'NoneType' object has no attribute ‘relabeled_clone' when using Window expression inside Subquery: Message.objects .filter(pk__in=Subquery( Message.objects .annotate(latest_pk=Window( expression=FirstValue('pk'),

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-02-28 Thread Mike Dewhirst
On 1/03/2018 10:50 AM, Bernd Wechner wrote: Julio, Thanks for giving it some though. But I think you misread me a little. I am using the get() only to illustrate that the precondition is, I have a single object. The goal then is find a neighboring object (as defined by the ordering in the

Re: Is there a way to make a field both foreignKey or allow user to fill it in themself?

2018-02-28 Thread Mike Dewhirst
On 1/03/2018 3:20 PM, Matemática A3K wrote: On Wed, Feb 28, 2018 at 12:46 AM, Mike Dewhirst > wrote: On 28/02/2018 1:58 PM, Alexander Joseph wrote: Sorry, I think my question was confusing. What I want to do is allow

Re: What happened to CollapsedFieldsets.js?

2018-02-28 Thread Matemática A3K
On Tue, Feb 27, 2018 at 1:28 PM, Alan wrote: > Hi there, > > Well, I used that like 8 years ago. Just wondering what's the current > solution for Django 2.0 if one want to collapse fields in forms. > > AFAIK is to write your own javascript (or use a third-party library /

Re: Static/constant dictionary for get_initial or get_form_kwargs

2018-02-28 Thread Matemática A3K
On Tue, Feb 27, 2018 at 9:10 PM, Bob Glassett wrote: > Hello, > > Trying to bring a django app into production, and I ran into a real > headscratcher. > > I have a Class based view inherited from create. When the page reloads, > after validation, I check the initial

Re: Is there a way to make a field both foreignKey or allow user to fill it in themself?

2018-02-28 Thread Matemática A3K
On Wed, Feb 28, 2018 at 12:46 AM, Mike Dewhirst wrote: > On 28/02/2018 1:58 PM, Alexander Joseph wrote: > >> Sorry, I think my question was confusing. What I want to do is allow the >> user to either select a user from a drop down list of users from the >> ForeignKey in

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-02-28 Thread Bernd Wechner
I should add that one solution which I find functional but unattractive is to build a and ordered list of PKs: things = list(Thing.objects.all().values_list('pk', flat=True)) then find the PK of the current object in that list and look one ahead or behind to get the PK of the neighbor and then

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-02-28 Thread Bernd Wechner
Julio, Thanks for giving it some though. But I think you misread me a little. I am using the get() only to illustrate that the precondition is, I have a single object. The goal then is find a neighboring object (as defined by the ordering in the model). Yes indeed, a filter is the first and

Re: When do I need a new app within the site?

2018-02-28 Thread Mike Dewhirst
On 1/03/2018 4:46 AM, Karol Bujaček wrote: On 02/22/2018 09:44 AM, Cictani wrote: Hi, I'm just beginning developing a new app(s) and I'm wondering when I need to add a new app. if one app uses models from another app is that a hint that these two apps are acutally one app or is this still

Re: Upgrade django from 1.8 to 1.9 - issue

2018-02-28 Thread Jani Tiainen
Hi. In your app __init__.py you import signals which in turn imports User model. You can't do that any more. Correct way to register signal handlers is to use app config ready. See https://docs.djangoproject.com/en/1.9/topics/signals/#connecting-receiver-functions And section "where this

Re: Trying to create a CBV that allows user to copy a record

2018-02-28 Thread Dylan Reinhold
Use the get_inital method. def get_initial(self): initial = super(MyCreateView, self).get_initial() initial['name'] = 'Testing' return initial Dylan On Wed, Feb 28, 2018 at 9:42 AM, Alexander Joseph < alexander.v.jos...@gmail.com> wrote: > I'd like to create a CBV

Re: django-channels: WebSocketBridge options

2018-02-28 Thread Andrew Godwin
Hi Nicolas, It's likely just an oversight in the coding. We're actually in the process of removing official support for that JavaScript code as we have nobody to maintain it, so I suggest you either clone it and modify it yourself or use ReconnectingWebSocket directly. Andrew On Wed, Feb 28,

Re: Help needed - new very first django App

2018-02-28 Thread Kasper Laudrup
Hi Jayaram, On 2018-02-28 15:45, Jayaram Namburaj wrote: When running the url http://127.0.0.1:8000/myapp/exRenderDict/ output doesn't display the values which is from the for loop. You named your list 'MyListArg' not 'mylist' in the dictionary you passed to the render function. Try

Upgrade django from 1.8 to 1.9 - issue

2018-02-28 Thread OliveTree
I am upgrading from django 1.8.4 to 1.9.13. I installed django 1.9.3 and my application stops working, it displays the following error: Unhandled exception in thread started by .wrapper at 0x7effd13cbbf8> Traceback (most recent call last): File

Re: When do I need a new app within the site?

2018-02-28 Thread Karol Bujaček
On 02/22/2018 09:44 AM, Cictani wrote: Hi, I'm just beginning developing a new app(s) and I'm wondering when I need to add a new app. if one app uses models from another app is that a hint that these two apps are acutally one app or is this still ok in terms of good design? Let's say I

Trying to create a CBV that allows user to copy a record

2018-02-28 Thread Alexander Joseph
I'd like to create a CBV to allow users to copy a record, except for item specific information. - I'm making a fixed assets app and if there are 2 of the same laptop I'd like the user to be able to make one record in the database, then copy it minus the serial number and asset tag number which

django-channels: WebSocketBridge options

2018-02-28 Thread nferrari
Hello, It seems that it is not possible to pass options to ReconnectingWebsocket through WebSocketBridge. I'd like to do able to do so, like it's possible with ReconnectingWebsocket : var webSocketBridge = new

Re: how to access binary file which is outside project folder

2018-02-28 Thread Andréas Kühne
Hi, You shouldn't be doing that at all. If you want the file to be accessable you need to include it in your media folder in the project - that's per design. The way django (and all other frameworks) work is to make sure that only the items present in the application should be allowed. Even if

RE: How to get Foreign Key Objects programmatically?

2018-02-28 Thread Matthew Pava
You may want to look at the model _meta API. https://docs.djangoproject.com/en/2.0/ref/models/meta/ You are looking for a list of all the ForeignKeys, but you also probably want other relations such as OneToOne and ManyToMany. You probably want something like the get_all_related_objects method:

Re: Why doesn't Django support managing Raw SQL changes using migration system like models

2018-02-28 Thread Julio Biason
Hi Cmp, Well, Django has to be database agnostic for things to work with any database. If raw sql is allowed, how do you can be sure it will work with any database? So far, you mentioned a bunch of PostreSQL things. But what if, tomorrow, some higher ups decided that support is required and buy

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-02-28 Thread Julio Biason
Hi Bernd, Well, the thing with `get()` is that it will return only one object. What you're looking for is `filter()`. Say, you want all the things that have an ID after a certain value. So you get `list_of_things = Things.objects.filter(pk__gte=...)`. Now it'll return the list, with all elements

how to access binary file which is outside project folder

2018-02-28 Thread sam kavuri
I am new to Django and trying to access binary file which is outside project folder and open it in the browser. When i try to do that it is saying Cross-Origin Request is blocked (Reason: CORS header 'Access-Control-Allow-Origin missing). Somebody, please help on this. -- You received this

[digital envelope routines: EVP_MD_CTX_copy_ex] input not initialized

2018-02-28 Thread marek
I have proble with login to Django web admin. It produces bellow exception: Internal Server Error: /adminlogin/ Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File

Deploying in hostgator VPS

2018-02-28 Thread Krishnaprasad Areekara
Can anyone shed some light on how to deploy django project in a hostgator VPS including initial setup in the root? Where should I store static files? And what all changes should I make while bringing the project into production from Dev environment? Thank you very much -- You received this

Re: When do I need a new app within the site?

2018-02-28 Thread Julio Biason
Hi Andreas, My rule of thumb is "does this works without the other?" Do your customer app works without the booking app? Then they are two different apps, with the second using the first as dependency. But, then again, I had some people suggesting this wasn't good enough (for deployment reasons,

Fetching next and/or prior objects given an arbitrary ordering

2018-02-28 Thread Bernd Wechner
I'm a bit stumped on this. Given an arbitrary ordering as specified by the ordering meta option: https://docs.djangoproject.com/en/2.0/ref/models/options/#ordering for example: class Thing(models.Model):     field1 = ...     field2 = ...     field2 = ...     class Meta:

Re: django mathfiters

2018-02-28 Thread sum abiut
Thanks Peter. cheers, On Wed, Feb 28, 2018 at 5:05 PM, Peter of the Norse wrote: > I would do > {% with a=42 c=b.value|default_if_none:0} > > - Peter of the Norse > > On Feb 21, 2018, at 3:47 PM, Matthew Pava wrote: > > And how are you checking if

Re: Channels 1.x

2018-02-28 Thread nferrari
Thank you Andrew for your answer! Nicolas On Wednesday, February 28, 2018 at 12:05:09 AM UTC+1, Andrew Godwin wrote: > > Yes, there is one session made per connection. They should expire and get > cleaned up like normal HTTP sessions if you run the session cleanup in > Django (or use backends