Re: LANGUAGE_CODE

2019-07-28 Thread Aldian Fazrihady
Hi Yves, please clear cookies and refresh your django app page afterwards. It is possible to not use cookies at all regarding i18n if you use language code as part of URL. I always prefer using URL for i18n. On Mon, Jul 29, 2019 at 1:08 AM Yves de Champlain wrote: > HI > > Django translation

Re: Running pending migrations in Middleware

2019-07-28 Thread David Grant
On Sunday, July 28, 2019 at 2:35:03 PM UTC-7, David Grant wrote: > > > I'm using Google AppEngine and I have no access to the server. The > alternative is to have the exact same code checked out on my local machine. > Connect to the remote database with a special proxy tool that google >

Re: Running pending migrations in Middleware

2019-07-28 Thread David Grant
On Sunday, July 28, 2019 at 10:10:57 AM UTC-7, James Schneider wrote: > > > > On Sun, Jul 28, 2019, 12:47 AM David Grant > wrote: > >> Anyone see any problems with running migrations in Middleware? >> > > What's the actual problem you are trying to solve by doing this? This is a > bad idea for

Re: Running pending migrations in Middleware

2019-07-28 Thread David Grant
The reason I want to do this by the way, is because I'm using Google AppEngine and I have no access to the server. The alternative is to have the exact same code checked out on my local machine. Connect to the remote database with a special proxy tool that google provides (so the db becomes

Overriding Django Form Model Errors

2019-07-28 Thread Metin AKIN
[image: Capture.PNG] [image: Capture - Copy.PNG] Hello, I'm trying to implement a signup form but I couldn't override default field error messages. For example, as you can see I get "your password can't be too similar" error but I want to show them in custom alert window with bootstrap such

Re: Cant create venv

2019-07-28 Thread Gaddafi adamu
hi why don't you start using pycharm it does of this automatically the also have the community edition which is 100% free On Sunday, July 28, 2019 at 5:57:40 PM UTC+3, Karreerchange wrote: > > Hi, > > I was writing some code in sublime text for my django app. > and my python session suspended

Re: Syntax Error django, python issue

2019-07-28 Thread Kean
Hi James, Yes this worked. Thanks. Best, K On 28 Jul 2019, at 19:45, James Schneider wrote: > > On Sun, Jul 28, 2019, 10:54 AM Kean wrote: > Hi Chetan > > pls see setup below > > It looks like you may have copied in the ellipses (...) from the example. > Remove those lines and try

Re: Syntax Error django, python issue

2019-07-28 Thread James Schneider
On Sun, Jul 28, 2019, 10:54 AM Kean wrote: > Hi Chetan > > pls see setup below > It looks like you may have copied in the ellipses (...) from the example. Remove those lines and try again. -James > -- You received this message because you are subscribed to the Google Groups "Django users"

Re: How to set (global) context value from a templatetag?

2019-07-28 Thread James Schneider
> > > > from django.template import RequestContext; rc = RequestContext(request) > > > rc contains all the context that had been passed on to TemplateResponse > within the view, o I want to add few more there from the template tag and > just cant figure out how. > > Thanks a lot for any ideas! >

Re: Cant create venv

2019-07-28 Thread Kean
Hi Franck, Thanks, this is the best way to salvage project, will do. Best wishes, K On 28 Jul 2019, at 16:28, Franck Tchouanga wrote: > try to create another project through the command line and then copy and > paste your past work to the presently created project. > > > On Sun, Jul 28,

LANGUAGE_CODE

2019-07-28 Thread Yves de Champlain
HI Django translation works very well for me, except that when I try to change LANGUAGE_CODE in settings.py, my site remains in French. I need to change my OS system settings to see the English version. I have two languages, English as default and a French Translation. LANGUAGES = (

truncated response content in middleware

2019-07-28 Thread Václav Mach
Hi, i'm trying to build my own middleware for server side javascript prerending. It's currently very simple (see attachment). It seems to be working fine for few pages but for some other pages the reponse.content is somehow truncated (line 20). The reponse.content is truncated at exactly

Re: Cant create venv

2019-07-28 Thread Franck Tchouanga
try to create another project through the command line and then copy and paste your past work to the presently created project. On Sun, Jul 28, 2019 at 3:58 PM Kean Dumba wrote: > Hi, > > I was writing some code in sublime text for my django app. > and my python session suspended after

Re: Django inbuilt Model

2019-07-28 Thread Juhana Jauhiainen
Hi Soumen, You could try with profiles = Profile.objects.filter(user__username=username) I would also suggest changing your model definition to something like class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) Then you will have exactly one Profile

Re: Syntax Error django, python issue

2019-07-28 Thread Kean
Hi Chetan pls see setup below settings.py This is copied from https://django-allauth.readthedocs.io/en/latest/installation.html Please can clarify in this context? Best, K On 28 Jul 2019, at 18:46, Chetan Ganji wrote: > AUTHENTICATION_BACKENDS =

Re: Syntax Error django, python issue

2019-07-28 Thread Chetan Ganji
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend', # your backends goes here, ] Regards, Chetan Ganji +91-900-483-4183 ganji.che...@gmail.com http://ryucoder.in On Sun, Jul 28, 2019

Re: Cant create venv

2019-07-28 Thread Kean
Hi Juhana, Thanks for your guidence. Someone recommended I use Brew to uninstall Django and pipenv, then re-installed them this fixed it, glad to have working again. Best wishes, -K On 28 Jul 2019, at 18:41, Juhana Jauhiainen wrote: > Hi, > > I had the same error when a virtual

Syntax Error django, python issue

2019-07-28 Thread Karreerchange
Hi, Installing the authentication backend code in settings.py (copy paste..) server crashed after save reporting the following, File "/Users/ProductionEnv/Desktop/devbnt/project/bnt/bnt/settings.py", line 130 'django.contrib.auth.backends.ModelBackend',

Re: Cant create venv

2019-07-28 Thread Juhana Jauhiainen
Hi, I had the same error when a virtual environment was active and resolved it by deactivating it and creating a new virtual environment. Not sure what was the cause but I suspect it had something to do with updating to MacOS Mojave. -Juhana On Sun, Jul 28, 2019 at 5:58 PM Kean Dumba wrote:

Re: Running pending migrations in Middleware

2019-07-28 Thread James Schneider
On Sun, Jul 28, 2019, 12:47 AM David Grant wrote: > Anyone see any problems with running migrations in Middleware? > What's the actual problem you are trying to solve by doing this? This is a bad idea for a number of reasons, and I can't think of any good ones. -James > -- You received this

How to set (global) context value from a templatetag?

2019-07-28 Thread toinbis
Hi, I wonder how would I access context and set the key/value pair from within custom template tag? Later on I want to access context object in djang-debug-toolbar panel with from django.template import RequestContext; rc = RequestContext(request) rc contains all the context that had been

Django inbuilt Model

2019-07-28 Thread Soumen Khatua
Hi Folks, I Extended Profile Model from dajngo inbuilt User model but Now I want call all the details those are associated with Username in Profile model. I got the username but how i cann call it in Profile model. Ex: class Profile(models.Model): user = models.ForeignKey(User,related_name =

Cant create venv

2019-07-28 Thread Kean Dumba
Hi, I was writing some code in sublime text for my django app. and my python session suspended after migrate. now i'm not able to run django or venv, the error below is what i receive. keans-air:project ProductionEnv$ python3 -m venv project dyld: Library not loaded:

Re: forms.Form with class in html-rendering

2019-07-28 Thread Jani Tiainen
Hi. Be aware that pushing rendering data like styles to form code has a nasty drawback. If you want to change that it is code change. And at some point it will get burden to maintain styles in code. There are few options still. Recent versions of django renders widgets using templates. Use

Re: forms.Form with class in html-rendering

2019-07-28 Thread Kai Kobschätzki
Hi Juhana, thanks for the fast response! This is helpfull, I will study it :) Best Greetings bengoshi On 7/28/19 4:13 PM, Juhana Jauhiainen wrote: > Hi,  > > You can achieve this by customizing the widget which renders the HTML > for the form field. You can find more information in the

Re: forms.Form with class in html-rendering

2019-07-28 Thread Juhana Jauhiainen
Hi, You can achieve this by customizing the widget which renders the HTML for the form field. You can find more information in the documentation here https://docs.djangoproject.com/en/2.2/ref/forms/widgets/ -Juhana On Sun, 28 Jul 2019 at 16.57, Kai Kobschätzki wrote: > Heiho, > > I wrote a

Re: is_friend relation

2019-07-28 Thread Soumen Khatua
Hi Pradeep, Im trying to complete this task , can You help me do that. Actually I'm new django Rest Framework 1. Model Specifications: - a custom user model called 'Profile' which has following fields (other than name, email, etc.) - phone number (must be unique)

forms.Form with class in html-rendering

2019-07-28 Thread Kai Kobschätzki
Heiho, I wrote a class in views.py class UploadFileForm(forms.Form): file = forms.FileField() and I use it in a function like def import_data(request): if request.method == "POST": form = UploadFileForm(request.POST, request.FILES) [...] return

is_friend relation

2019-07-28 Thread Pradeep Sukhwani
Your question is vague. Share an example may be piece of a code or a scenario that can help us to understand product requirement more clearly. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Djago Rest framework Error

2019-07-28 Thread Pradeep Sukhwani
I'm assuming you have used ModelViewSet. In that you can always call this method: def get_serializer_class(self): if self.request.user and self.request.user.is_authenticated: return ProfileSerializer else: return UserSerializer -- You received this message because you

is_friend relation

2019-07-28 Thread Soumen Khatua
Hi Folks, I want to do something like if I'm creating a resource it should show is_friend equaks to True for me but for others it should be False using Django Rest Framework.Please help me,guys. Thank You Regards, Soumen -- You received this message because you are subscribed to the Google

Re: Djago Rest framework Error

2019-07-28 Thread Soumen Khatua
Could you help me I have another requirement like I want to Show some fields for get method and for post method I want to serialize some other fields also. So how i can do that using same ProfileSerializers. Plase help me. Thank You Regards, Soumen On Sun, Jul 28, 2019 at 2:59 PM Pradeep

Re: Running pending migrations in Middleware

2019-07-28 Thread Markus Holtermann
Yes, I do see several problems. Some of them: - All middleware are run for every request - What you're doing can slow down your request response time to minutes, depending on home many migrations you have - Depending on your database, migrations might not be atomic thus causing conflicts - You

Re: Djago Rest framework Error

2019-07-28 Thread Pradeep Sukhwani
you need to pass the username in the serializer. Then in serializer, you can do something like this: serializers.py: class ProfileSerializer(serializers.ModelSerializer): user = UserCreateSerializer() # create the serializer for user # mention all the other fields in profile model

Re: Djago Rest framework Error

2019-07-28 Thread Soumen Khatua
How I can hold Profile details and them save it after provide the user field details, Cn you tell me how i can do that? Thank you Regards, Soumen On Sun, Jul 28, 2019 at 2:22 PM Pradeep Sukhwani wrote: > Hi Soumen, > > ModelSerializers do not behave in exactly the same way as ModelForm.

Re: Djago Rest framework Error

2019-07-28 Thread Pradeep Sukhwani
Hi Soumen, ModelSerializers do not behave in exactly the same way as ModelForm. However, there are intentional design decisions behind these differences. commit is not (and won't ever be) a keyword argument to save(). I believe that the usage of .save() is pretty much adequately documented

Djago Rest framework Error

2019-07-28 Thread Soumen Khatua
Hi Folks, I'm getting this error when I declared like this: def post(self, request): serializer = ProfileSerializer(data=request.data) username = request.user.username user_details = User.objects.get(username = username) if serializer.is_valid():

Re: Model Related Issue

2019-07-28 Thread Pradeep Sukhwani
You can always use serializers. Have a look at declaring serializers and then you can call that serializer in your APIView. If this doesn't help then share your code. On Saturday, July 27, 2019 at 11:18:59 PM

Running pending migrations in Middleware

2019-07-28 Thread David Grant
Anyone see any problems with running migrations in Middleware? import logging import os import time from django.core.management import call_command from django.http import HttpResponse from products.models.models import AppVersion LOG = logging.getLogger(__name__) # Used for testing locally