Re: Django multiple Model Forms in template

2018-06-23 Thread martin . ma012500
Hi. I have changed views.py last line to this: return render(request, 'assumptions.html', {'formset': formset,'model_names': model_names,'name': name}) As a result, it outputted more forms, however they do not save to model forms to database and raise Validation Error ['ManagementForm data is

looking for job in python banglore location

2018-06-23 Thread xahid majeed
if there is any vacancy in your companies please let me know -- 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...@googlegroups.com. To post

Re: Channels 2.0 close code and http response status

2018-06-23 Thread Andrew Godwin
Hi! Close code 1006 means that the connection was closed abruptly by the other end (basically, the socket just got chopped off without an actual close frame being sent). This is what happens when you close during the handshake, which is what closing during connect() does - at that point, the

Why am I not able send through async_to_sync ?(asgiref==2.3.2)

2018-06-23 Thread chitranjali edpuganti
Can anyone please check this link, and let me know the solution please? https://stackoverflow.com/questions/51002890/why-am-i-not-able-send-through-async-to-sync-asgiref-2-3-2 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Django Channels 2.0 - How to init and persist/communicate with only one instance of background worker for every channel_layer.send?

2018-06-23 Thread Andrew Godwin
I'm not sure why that would happen - the code that chooses what application instance to use is here: https://github.com/django/asgiref/blob/master/asgiref/server.py (under get_or_create_application_instance). If you're always using a single channel name, which gets passed as scope_id (see here:

Re: ValueError at /feedback/by/feedback/new Cannot assign "": "Feedback.user" must be a "User" instance.

2018-06-23 Thread Saloni Kalra
Thank you for your reply. I removes all the migrations and dropped the database. Now when I try to make migrations i get the following error in my terminal. Thanks and regards, Saloni *Error:* accounts.User.user_ptr: (fields.E301) Field defines a relation with the model 'auth.User', which has

Clean ValidationError not showing when form.is_valid() called

2018-06-23 Thread HashRocketSyntax
I'm trying to show my ValidationError from clean_MY_VALUE in the template. *template* {% csrf_token %} {{form.as_p}} Submit {{ form.errors }} {{ form.non_field_errors }} *views.py* def MY_VIEW_CLASS(request, MY_ARG): MY_ARG = "query to check for silly conditions" if

Cannot assign the current user to the ForeignKey field in my model.

2018-06-23 Thread Saloni Kalra
I am trying to build a feedback application for the teachers by the students. I have a proxy User that will the student. But I am not able to assign the user to the feedback model. I am a newbie. Please help. Thanks and regards, Saloni *models.py:* class User(auth.models.User,

Re: ValueError at /feedback/by/feedback/new Cannot assign "": "Feedback.user" must be a "User" instance.

2018-06-23 Thread Melvyn Sopacua
On zaterdag 23 juni 2018 10:52:09 CEST Saloni Kalra wrote: > https://github.com/salonikalra/feedback > This is a feedback application for teachers by the students. I have been > constntly getting the following error: > ValueError at /feedback/by/feedback/new > Cannot assign "": "Feedback.user"

Re: smtp email configuration error

2018-06-23 Thread Ruhia gr
am having below error now can anyone help me with this [23/Jun/2018 05:59:32] "GET /contact/ HTTP/1.1" 200 11440 Not Found: /contact/contactform/contactform.js [23/Jun/2018 05:59:34] "GET /contact/contactform/contactform.js HTTP/1.1" 404 16 637 Not Found: /contact/contactform/contactform.js

Re: Django multiple Model Forms in template

2018-06-23 Thread alex eckert
This is likely not the answer you're looking for, but my two cents... I've never been successful in writing the templates for formsets on my own, as they tend to end up looking rather clunky. I've been using this

Re: Pass value from view to non-model form

2018-06-23 Thread HashRocketSyntax
SOLVED. https://stackoverflow.com/questions/50997267/django-pass-value-from-view-to-non-model-form/51002442#51002442 thank you for pointing me in the right direction On Friday, June 22, 2018 at 9:37:26 PM UTC-4, HashRocketSyntax wrote: > > When I call my form in my view, I am trying to pass

Re: Pass value from view to non-model form

2018-06-23 Thread HashRocketSyntax
Looks like I was missing an `initial` inside init... 0_o https://stackoverflow.com/questions/1993014/passing-kwargs-to-django-form On Friday, June 22, 2018 at 9:37:26 PM UTC-4, HashRocketSyntax wrote: > > When I call my form in my view, I am trying to pass MY_VALUE to the form > as an

Re: Pass value from view to non-model form

2018-06-23 Thread HashRocketSyntax
It seems to like that! `(arg1, OTHER_VAL=OTHER_VAL) Now I'm trying to access that other_value: def __init__(self, *args, **kwargs): OTHER_VAL = kwargs.get('OTHER_VAL') #tried these: #kwargs['OTHER_VAL'] #kwargs.pop('OTHER_VAL') super(MY_FORM, self).__init__(*args, **kwargs) Keep

Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread James Bellaby
Indeed! I have actually used the admin site to do it before I posted this it's just something I didn't know was by design. After numerous searches I came here but I may have been asking the wrong questions in google :). The shell would be good if I have quite a few I need to delete. Thankfully

ValueError at /feedback/by/feedback/new Cannot assign "": "Feedback.user" must be a "User" instance.

2018-06-23 Thread Saloni Kalra
https://github.com/salonikalra/feedback This is a feedback application for teachers by the students. I have been constntly getting the following error: ValueError at /feedback/by/feedback/new Cannot assign "": "Feedback.user" must be a "User" instance. Please help. Thanks. -- You received this

Re: Pass value from view to non-model form

2018-06-23 Thread Tomasz Knapik
You get that error because you use kwargs.pop (presumably that's why) and you pass OTHER_VALUE as a positional argument. E.g. MY_FORM(request.POST, OTHER_VALUE=OTHER_VALUE) would pass it as a keyword argument and then you can use kwargs.pop('OTHER_VALUE') in the form's init. On Fri, 2018-06-22

sessions

2018-06-23 Thread john speny
What does the method session.keys() do or particularly that keys() method -- 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 Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread Tomasz Knapik
If you search about it on the Internet many sources claim that Django does not set those constraints on the database level. If you look at the code of the base code for database backends, you'll notice that they don't mention on_delete at all. - https://github.com/d

Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread Jason
well, nothing stopping you from doing the same in the django shell and doing `Group.objects.get(pk = some_pk).delete`. that would be an alternative for going straight to the db. I can see some issues with this coming up, especially if you're doing deletes with django's raw sql capability.

Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread James Bellaby
OK. So it's by design. So during development I can't go straight to the database and delete a "Group" quickly due to an error I made. I'd have to set up tests to deal with it at an application level. No probs though. I'm just happy I know it can't be done and not that it's a bug I'd have to

Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread Melvyn Sopacua
On zaterdag 23 juni 2018 14:40:30 CEST Jason wrote: > Not quite. If you run python manage.py sqlmigrate > , you can see the SQL generated for that migration. > > https://docs.djangoproject.com/en/2.0/ref/django-admin/#django-admin-sqlmigr > ate > > Because Django emulates Cascade, its done

Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-23 Thread Melvyn Sopacua
On zaterdag 23 juni 2018 14:30:08 CEST Mikkel Kromann wrote: > In models.py: > def GetItemPaths():paths = [ ] > for i in [ 'Model1', 'Model2', 'Model3' ]: > p = path( i + '/list/', ItemListView.as_view(model=i), name=i + > '_list' ) > paths.append(p) > > return paths

Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread Jason
Not quite. If you run python manage.py sqlmigrate , you can see the SQL generated for that migration. https://docs.djangoproject.com/en/2.0/ref/django-admin/#django-admin-sqlmigrate Because Django emulates Cascade, its done outside of the db, and therefore shouldn't be a db-level constraint.

Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-23 Thread Mikkel Kromann
So, I think I have a neat idea for solving my problem, simply make a function which returns a list of path() returns. In urls.py urlpatterns = GetItemPaths() + [ # other paths ] In models.py: def GetItemPaths():paths = [ ] for i in [ 'Model1', 'Model2', 'Model3' ]: p = path( i +

Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread James Bellaby
OK, understood. However, If you set up CASCADE on the model surely when it creates the table on the database level it surely should set ON DELETE CASCADE not ON DELETE NO ACTION on the CONSTRAINT? On Saturday, 23 June 2018 10:54:44 UTC+1, Melvyn Sopacua wrote: > > On zaterdag 23 juni 2018

Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread Melvyn Sopacua
On zaterdag 23 juni 2018 00:56:36 CEST James Bellaby wrote: > However when looking are the SQL in Postgresql it's created the Membership > table constraint for the Group id with "ON DELETE NO ACTION" > > CONSTRAINT groups_membership_group_id_d4404a8c_fk_groups_group_id FOREIGN > KEY (group_id) >

Re: prevent AppConfig.ready() from running twice

2018-06-23 Thread Melvyn Sopacua
On zaterdag 23 juni 2018 02:01:06 CEST Mike Dewhirst wrote: > Is there a python singleton pattern which might work? No, cause the startup is done in 2 different processes which do not share state. So both processes will have a "new singleton". This is why you need an IPC mechanism, such as file

Re: prevent AppConfig.ready() from running twice

2018-06-23 Thread Mike Dewhirst
Makes sense - thank you Eric M On 23/06/2018 5:10 PM, PASCUAL Eric wrote: IMHO, some of (a lot of ?) the "classical" GOF patterns do not really apply to Python (or at least are not necessary, when not making things more confuse). They are often a consequence of constraints and limitations

Re: prevent AppConfig.ready() from running twice

2018-06-23 Thread PASCUAL Eric
IMHO, some of (a lot of ?) the "classical" GOF patterns do not really apply to Python (or at least are not necessary, when not making things more confuse). They are often a consequence of constraints and limitations of statically compiled languages such as C++, Java and alike used at the time