url () to path()

2018-04-30 Thread Kayode Oladipo
Hi there again! Beginner here using Django 2.0. I'm following a tutorial (coupled with the official doc for compatibility) and I discovered that <2.0 versions use RegEx with the url but 2.0> uses the simplified path() function. My question is how do I find the right corresponding path() function

Re: updating model breaks admin

2018-04-30 Thread Gloria Elena
Hi George, Thanks for the advice. I tried both suggestions and I am still getting the same errors. Here is my articles app structure and admin.py: And here is my site structure: Thank you!! On Sun, Apr 29, 2018 at 11:50 PM, George Lubaretsi wrote: > If the data is

Fwd: Re: AttributeError at /admin/login/

2018-04-30 Thread Gerald Brown
I had replied to Daniel Roseman instead of to the users group as I am new to this group. Thanks to Daniel for his response Forwarded Message Subject:Re: AttributeError at /admin/login/ Date: Mon, 30 Apr 2018 21:46:35 +0800 From: Gerald Brown

Re: I am following the official Django documentation and trying to make the polls app. But when I run the command python manage.py shell I get the console error.

2018-04-30 Thread Avitab Ayan Sarmah
Thank you Mathew now it is working fine On Tue 1 May, 2018, 2:39 AM Matthew Pava, wrote: > You need a space between def and __str__ > > > > *From:* django-users@googlegroups.com [mailto: > django-users@googlegroups.com] *On Behalf Of *Avitab Ayan Sarmah > *Sent:* Monday,

RE: I am following the official Django documentation and trying to make the polls app. But when I run the command python manage.py shell I get the console error.

2018-04-30 Thread Matthew Pava
You need a space between def and __str__ From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Avitab Ayan Sarmah Sent: Monday, April 30, 2018 4:07 PM To: Django users Subject: I am following the official Django documentation and trying to make the polls app.

I am following the official Django documentation and trying to make the polls app. But when I run the command python manage.py shell I get the console error.

2018-04-30 Thread Avitab Ayan Sarmah
The code of my polls/models.py is: import datetime from django.db import models from django.utils import timezone class Question(models.Model): #... def was_published_recently(self): return self.pub_date >= timezone.now() - datetime.timedelta(days=1) def__str__(self):

Re: I am following the official Django documentation and trying to make the polls app. But when I run the command python manage.py makemigrations polls I get the console error.

2018-04-30 Thread Avitab Ayan Sarmah
Yes I found the error George, I mistakenly typed polss in settings. Now the code is running fine On Tue 1 May, 2018, 1:03 AM George Lubaretsi, wrote: > Looks like you have a typo somewhere. > > Exception says that it can't find a module `polss` while it should be >

Re: Django and Fullcalendar.

2018-04-30 Thread Elias Coutinho
No error, it returns a template full of cluttered tags. 2018-04-28 2:41 GMT-03:00 Andy : > What kind of error are you getting? > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this

Re: I am following the official Django documentation and trying to make the polls app. But when I run the command python manage.py makemigrations polls I get the console error.

2018-04-30 Thread George Lubaretsi
Looks like you have a typo somewhere. Exception says that it can't find a module `polss` while it should be `polls`. Check your settings and imports On Mon, Apr 30, 2018 at 11:29 PM Avitab Ayan Sarmah wrote: > The code I am using for the models is: > > from django.db

I am following the official Django documentation and trying to make the polls app. But when I run the command python manage.py makemigrations polls I get the console error.

2018-04-30 Thread Avitab Ayan Sarmah
The code I am using for the models is: from django.db import models class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') class Choice(models.Model): question = models.ForeignKey(Question) choice_text =

Re: Using Django Channels to subscribe to a Redis channel

2018-04-30 Thread Michael
Did you have luck with this. I've tried the same thing, but it seems like if no one is consuming on the other side I get a "channels.exceptions.ChannelFull" exception. I'm trying to provide a real-time feed for an exchange. There might be zero people listing or 1 million listening. The high

Re: Architecting a Crypto Market Data Feed using Django Channels

2018-04-30 Thread Michael
Thanks for your reply Andrew. I've created a custom manage command called `websocket_producer.py` that is responsible for feeding the firehose of market data (price changes, market volatility etc). It looks like this from django.core.management.base import BaseCommand, CommandError from

Re: committing migration files

2018-04-30 Thread Vijay Khemlani
At least for me I have custom migrations (for a materialized view) so that needs to be commited, and a migration seems the most logical place to do so Also if you already have a production database and you need to execute a complex change in the data model you may need a sequence of steps that

Re: Dynamically altering a (ForeignKey) ModelChoiceField’s values

2018-04-30 Thread Jim Illback
If anyone is interested in a solution I found, it is at www.webforefront.com/django/formprocessing.html. Great documentation there, and you can read why it works, too. Here are some code snippets used to test my situation. In forms.py and

committing migration files

2018-04-30 Thread Tom Scrace
Hi all, The way I've always worked, developers run `makemigrations` locally, and commit migration files to the repo. However, a suggestion has recently come my way that a better strategy is to only commit model changes to the repo (leaving the migrations directory gitignored), and then run

Url parameters don't work

2018-04-30 Thread Саша Губський
Hi, have GET request : https://mydomain/auth/complete/instagram/?code=mycode And i want to get parameter 'code' path('auth/complete/instagram/', views.instagram, name='auth') def instagram(request): code = request.GET.get('code') if code: return HttpResponse(code) return

Re: django does not open html file properly

2018-04-30 Thread qop
You are right, it's too complicated. I could zip gephi's graphics and make them downloadable on my site, how could i do that? How can i create a "download button" that allows the user to download my zip files? Il giorno venerdì 27 aprile 2018 23:24:43 UTC+2, Andy ha scritto: > > It looks as if

Solved Re: Decorator function argument woes

2018-04-30 Thread Mike Dewhirst
Stephen Not really solved except I gave up on decorating when I finally "got" it. Thanks again. 1. made two new sub-views for the two scenarios and decorated one of them with login_required 2. factored out all the commonalities into a new undecorated view with the same name as used in

Re: Crazy Idea: OOP for "Hyperlink"

2018-04-30 Thread 'Anthony Flury' via Django users
What is wrong with a special type of Field - which is a URL, but also have augmented data items which are stored on the model? As far as I know - there is no rule that states that each 'Field' on a model has to have one and only one field in the database. Even if you have one and only one

Re: AttributeError at /admin/login/

2018-04-30 Thread Daniel Roseman
n Monday, 30 April 2018 13:30:54 UTC+1, Gerald Brown wrote: > > I am getting the following error when I TRY to log in to my site > "AttributeError at /admin/login/ > > 'datetime.datetime' object has no attribute 'split'" > > This looks like a Django bug as it is in the Admin module and is NOT

RE: Crazy Idea: OOP for "Hyperlink"

2018-04-30 Thread Matthew Pava
Here’s Django’s documentation on widgets: https://docs.djangoproject.com/en/2.0/ref/forms/widgets/ >From the docs: A widget is Django’s representation of an HTML input element. This whole idea would take some time to implement and consider ramifications. After all, a hyperlink isn’t really an

AttributeError at /admin/login/

2018-04-30 Thread Gerald Brown
I am getting the following error when I TRY to log in to my site "AttributeError at /admin/login/ 'datetime.datetime' object has no attribute 'split'" This looks like a Django bug as it is in the Admin module and is NOT related to any of my code. Does anyone have any idea why this is

Re: model permission assignment via groups requires further config at model level?

2018-04-30 Thread Rob B
Thanks George - I understand now. I never thought it would only apply to the admin interface but should have. Kind regards, Rob On Sun, Apr 29, 2018, 10:05 PM George Lubaretsi, wrote: > Django permissions are only enforced in Admin interface by default. You > have to

Re: New language adding error('Unknown language code si.')

2018-04-30 Thread lakshitha kumara
Hello Jason, *Thanks you for your reply but **unfortunately** that example not working any more with django 2 and python 3 .* *Thanks* On Monday, April 30, 2018 at 7:47:45 AM UTC+5:30, lakshitha kumara wrote: > > Hello Guys > > I added new language to django . language called Sinhala. My code

How to limit the format of django-rest-framework-api uploading(post method)

2018-04-30 Thread Majid Am
In fact, I need your help to limit the my api to upload I only need Jason and excel formats(csv,xls,xlsl) on the server-side, but I did not find any code for that. The second question is, what methods should I use to authenticate the user? Here's a link

Re: Re-using CreateView, UpdateView & friendship

2018-04-30 Thread subhani shaik
Hi can you please share me any django project.for the practicing purpose . On Mon, Apr 30, 2018 at 10:15 AM, Mikkel Kromann wrote: > Hmmm. It might be my question 3 after all. > After a good night's sleep, I re-read the Figure 8.1 on Function vs Class > Based

Facebook-Like Multiple Accounts for a Django Social Media Website

2018-04-30 Thread michele . developer16
Hello Django Users Group! As the title of the topic suggests, I am in the process of creating a Facebook-Like Multiple Account functionality for a Django Social Media Website. With Facebook-Like, I mean that users of the Website will have the opportunity to create multiple "Page Accounts" to

Django and Visual Studio Code

2018-04-30 Thread Simon Connah
I've got most of Visual Studio Code configured for Django development (I'm trying it out to see if I can ditch PyCharm and save some money) and almost everything seems OK. I set the Python path to be the one in the virtual environment, and if Visual Studio Code needs to install any modules, they

Re: New language adding error('Unknown language code si.')

2018-04-30 Thread Jason
The reason is that language code is not supported by django, but there's a procedure to add custom languages. https://github.com/deschler/django-modeltranslation/issues/364#issuecomment-193182171 Specifically, this StackOverflow post

Re: New language adding error('Unknown language code si.')

2018-04-30 Thread lakshitha kumara
Hello guys sorry this is the error. KeyError at /accounts/login/ 'Unknown language code si.' Request Method: GET Request URL: http://localhost.test:8000/accounts/login/ Django Version: 2.0.4 Exception Type: KeyError Exception Value: 'Unknown language code si.' Exception Location:

how to define migrations to use BigAutoField

2018-04-30 Thread Priyanka Thakur
Hi, We have recently migrated to django 1.10 and with prior version of Django 1.7 we had . a patch to convert AutoField to "BigInt" instead of "int". Since Django 1.10 provides capability to use BigAutoField for "BigInt", we don't want to patch anymore. Is there a way to define primary key as

Add extra fields to a ModelAdmin form

2018-04-30 Thread 'James Foley' via Django users
So, I have a ModelAdmin that I need to add extra fields to. These fields do not exist on the model, but will be dynamically added to a custom ModelForm through the __init__ method, and logic inside clean will handle the returned data on save. I can't seem to find any solid information related

Re: Crazy Idea: OOP for "Hyperlink"

2018-04-30 Thread guettli
Am Donnerstag, 26. April 2018 15:54:31 UTC+2 schrieb Matthew Pava: > > I’ve been thinking about your idea, and I wonder if there could instead be > some kind of widget for URL objects (or views). > > > A widget ... Let me think about it. A widget is a libray, is source code. The code needs

Re: Decorator function argument woes

2018-04-30 Thread Mike Dewhirst
On 30/04/2018 4:30 PM, Stephen J. Butler wrote: Yes. I don't see it in the documentation for login_required, but I believe it's so that you can do something like this in your urls.py: urlpatterns = [     url(r'^example$', login_required(views.example)), ] That might be an older way of using

Re: Decorator function argument woes

2018-04-30 Thread Stephen J. Butler
Yes. I don't see it in the documentation for login_required, but I believe it's so that you can do something like this in your urls.py: urlpatterns = [ url(r'^example$', login_required(views.example)), ] That might be an older way of using the decorator? IDK for sure. But you can see from

Re: Decorator function argument woes

2018-04-30 Thread Mike Dewhirst
On 30/04/2018 3:35 PM, Stephen J. Butler wrote: @login_required doesn't take a test function. You need to use @user_passes_test directly. Thank you Stephen. I thought I'd start another thread to ask about my use case of being able to require login or not depending on whether the content