Help regarding view modification

2018-08-22 Thread Sagar
Hi guys, I am working on project in which admin will post news and users will able to give up-votes, down-votes and comments. I'm storing data in MongoDB. I'm trying to store comments inside it's parent news documents. I'm facing some trouble with views. Look at the my code and below that I expl

Re: Help regarding view modification

2018-08-22 Thread Olivier Pons
Hi, You should try this: upvotes = models.IntegerField(blank=True, default=0) downvotes = models.IntegerField(blank=True, default=0) (dont forget the makemigrations, then migrate) tell me if it worked Le mer. 22 août 2018 à 09:25, Sagar a écrit : > Hi guys, > I am working on project in which

Re: Help regarding view modification

2018-08-22 Thread Olivier Pons
Try this: upvotes = models.IntegerField(blank=True, default=0) downvotes = models.IntegerField(blank=True, default=0) (dont forget the makemigrations, then migrate) tell me if it worked Le mercredi 22 août 2018 09:25:20 UTC+2, Sagar a écrit : > > Hi guys, > I am working on project in which admin

Re: Make an element on a page visible only to logged in users

2018-08-22 Thread Olivier Pons
Hi, I disagree with Mike Dewhirst answer, here's mine. The simplest way is in the template, to see if it's logged in: {% if user.is_authenticated %} Then maybe a much more powerful way is to write your right management this way: first you write what you need beginning with "has_right_" like

Re: template tag help please?

2018-08-22 Thread MikeKJ
I am so rusty I’m having trouble writing a simple_tag In the template {% for b in list %} {% load get_cost %}{% do_cost {{ b.name }} avn avd %} Also tried (per docs) {% do_cost name={{ b.name }} avn=avn avd=avd %} I definitely have values in the template passed from the view for avn

Re: template tag help please?

2018-08-22 Thread Andréas Kühne
Hi, You don't need the {{}} when sending a variable to the template tag - try removing them. Regards, Andréas Den ons 22 aug. 2018 kl 12:17 skrev MikeKJ : > > I am so rusty I’m having trouble writing a simple_tag > > > > In the template > > > > {% for b in list %} > > {% load get_cost %}{% do

python -m django --version

2018-08-22 Thread Basavaraj Halgali
Hi What is usage of -m command in this command line "python -m django --version". Regards, Basav -- 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

Debugging allauth social authentiacation

2018-08-22 Thread ram manoj
Hey, I am trying to include social authentication with google to my site with allauth. There are certain requirements to the site. I am trying to modify the adapters, but modifying a simple adapter is giving the server error. It is not giving what the error is, but just popping a server error.

Django Database Table Front End Editing

2018-08-22 Thread Sandeep Khatri
Hi, I am using a django framework and wants to fetch data from mysql database table. I also wants user to edit and update table column data at ui/ frontend. Please help me out with this issue. Thanks and Regards, Sandeep Khatri -- You received this message because you are subscribed to the G

Re: Django Database Table Front End Editing

2018-08-22 Thread Mikhailo Keda
Check the documentation: https://docs.djangoproject.com/en/2.1/ref/databases/#connecting-to-the-database https://docs.djangoproject.com/en/2.1/topics/forms/ https://docs.djangoproject.com/en/2.1/ref/templates/ -- You received this message because you are subscribed to the Google Groups "Django u

Same superuser in diffenrent apps

2018-08-22 Thread aseem hegshetye
Hi, I created second app and when creating superuser I get error saying superuser already taken. Is Django superuser shared accross all aps if DB is shared between those apps? I have two seperate Apps with shared DB and when i tried to create superuser for second app, i got error saying user na

Re: Same superuser in diffenrent apps

2018-08-22 Thread Mikhailo Keda
Yes, superuser will be set for all apps in this case -- 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 to this g

Re: Same superuser in diffenrent apps

2018-08-22 Thread Irenge Mufungizi
try to clear cache, On Wed, Aug 22, 2018 at 1:45 PM aseem hegshetye wrote: > Hi, > I created second app and when creating superuser I get error saying > superuser already taken. Is Django superuser shared accross all aps if DB > is shared between those apps? I have two seperate Apps with shared

Re: python -m django --version

2018-08-22 Thread Jason
basic python command line arg. you can see it when executing `python --help` in the terminal. -m mod : run library module as a script (terminates option list) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: Same superuser in diffenrent apps

2018-08-22 Thread Jason
if you're trying to create a superuser account with the same username, you will get that error. usernames are unique. -- 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 ema

Re: problems with order by month

2018-08-22 Thread Phako Perez
I think you miss the column to order cardio = Alumno.objects.filter ( fechanacimiento __month = now.month).order_by(‘fechanacimiento’) Should be cardio = Alumno.objects.filter ( fechanacimiento __month = now.month).order_by(‘fechanacimiento_day’) Sent from my iPhone > On Aug 21, 2018, at 6:

Re: template tag help please?

2018-08-22 Thread MikeKJ
Thank you Andreas Kuhne, progress So this {% load get_cost %}{% do_cost b.name avn avd %} is not getting any error on the template but as simple as the below is there is no return from django import template from django.conf import settings from django.utils.html import escape register = templa

Re: problems with order by month

2018-08-22 Thread Franklin Sarmiento
hi Osvaldo, try filtering by date ( by month and date ), do you can filter by month and day ??? if this is what do you want, so, you can filter by date by example: "fechanacimiento__date", so, the queryset sould be this: Alumno.objecs.filter(.).order_by('fechanacimiento__date') # by default i

Re: python -m django --version

2018-08-22 Thread Franklin Sarmiento
hi Basavaraj, you can use the command $ python -V for more commands you can use $ python --help I hope this helps you *Franklin Sarmiento* *Full-stack developer* *skype: franklin.s.dev* *Twitter: @franklinitiel* *linkedin: Franklin Sarmiento

Re: template tag help please?

2018-08-22 Thread MikeKJ
Thank you Andreas Kuhne, progress So this {% load get_cost %}{% do_cost b.name avn avd %} was working quite happily but for some reason is now complaining Exception Type: TemplateSyntaxError Exception Value: Caught KeyError while rendering: 'avn' Exception Location claims to bege

Re: template tag help please?

2018-08-22 Thread Andréas Kühne
Wait a secound, you are doing some very strange things I didn't see this before. You have defined the following: @register.simple_tag def do_cost( name, avn, avd, *args, **kwargs ): avn = kwargs['avn'] avd = kwargs['avd'] name = kwargs['name'] return name The method has 3 par

RE: template tag help please?

2018-08-22 Thread Mike Jones
Ah I was just doing that to prove it was working This is the actual tag from django import template from django.conf import settings from django.utils.html import escape from band.models import Data register = template.Library() @register.simple_tag def do_cost( name, avn, avd,

Re: template tag help please?

2018-08-22 Thread Mikhailo Keda
Probably you don't need template tag at all, try {{ b.name }} if you just need to get name value from b -- 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-us

how to import serveral csv into database by using migrations.RunPython

2018-08-22 Thread emmanuel wyckens
Hello, The class below didn't work if you use migrations.RunPython several times. Have you got an idea to manage double csv file importation into database ? Thanks Emmanuel class Migration(migrations.Migration): dependencies = [ ("contact", "0001_initial"), ] operations

Help with mi first hello world please problems with urls

2018-08-22 Thread Dario Coronel
El problema que tengo es el siguiente soy un novato recien conociendo el mundo de python y django estaba siguiendo los pasos de la documentacion para crear una primera aplicacion consegui instalr django y craer con startproject un projecti inicial sin problemas, mi primer problema se presenta c

Data Binding Example Channels 2

2018-08-22 Thread weezardofwoz
Hello, In another question it was pointed out that data binding has been removed form the channels 2.x core. Andrew said "You can write most of the data binding functionality yourself in Channels 2 by adding group send methods to model save methods" - can anyone provide a basic example of how t

Making a django project and an API.

2018-08-22 Thread vineeth sagar
Hi I am pretty comfortable django. Now recently started working on a fresh project, they want a normal project and an browsable api. I have seen the drf and it's great, the browsable api in drf documentation is what they(my boss) wants. How do I start developing both of them simultaneously. I wi

Re: Data Binding Example Channels 2

2018-08-22 Thread Mikhailo Keda
There is an example of simple chat site (direct link to save method where data binding is implemented): https://bitbucket.org/voron-raven/chat/src/f78b6531652f866109dbfa2f8aeffac6c0f1bb32/core/models.py#lines-157 -- You received this message because you are subscribed to the Google Groups "Djan

Re: Data Binding Example Channels 2

2018-08-22 Thread Mikhailo Keda
link to the chat site - https://chat.mkeda.me/ середа, 22 серпня 2018 р. 22:12:58 UTC+3 користувач Mikhailo Keda написав: > > There is an example of simple chat site (direct link to save method where > data binding is implemented): > > https://bitbucket.org/voron-raven/chat/src/f78b6531652f866109

Re: Data Binding Example Channels 2

2018-08-22 Thread weezardofwoz
Thank you very much! This will be extremely helpful in accomplishing my intended usage! On Wednesday, August 22, 2018 at 3:16:42 PM UTC-4, Mikhailo Keda wrote: > > link to the chat site - https://chat.mkeda.me/ > > середа, 22 серпня 2018 р. 22:12:58 UTC+3 користувач Mikhailo Keda написав: >> >> T

Re: Data Binding Example Channels 2

2018-08-22 Thread weezardofwoz
Another thought occurs to me: what are the benefits (if any) of this method vs. hooking into the save / create / delete signals? On Wednesday, August 22, 2018 at 3:30:44 PM UTC-4, weezar...@gmail.com wrote: > > Thank you very much! This will be extremely helpful in accomplishing my > intended u

Re: Data Binding Example Channels 2

2018-08-22 Thread weezardofwoz
Also, if for instance I am updating a user model with information that I want only that specific user to see, how do I send over the websocket to only that user (they would have an authenticated session)? sorry for the bombardment of questions :P On Wednesday, August 22, 2018 at 3:45:15 PM UTC-

Re: how to import serveral csv into database by using migrations.RunPython

2018-08-22 Thread Mike Dewhirst
On 23/08/2018 1:32 AM, emmanuel wyckens wrote: Hello, The class below didn't work if you use migrations.RunPython several times. Have you got an idea to manage double csv file importation into database ? In your migration file ... from django.db import migrations, models from .utils import do

Re: Making a django project and an API.

2018-08-22 Thread Mike Dewhirst
If you can get your hands on a copy of Two Scoops of Django 1.11, there is a whole chapter on DRF. I've just had a look through it (20+ pages) and I reckon it will answer all your questions. On 23/08/2018 5:10 AM, vineeth sagar wrote: Hi I am pretty comfortable django. Now recently started work

Re: Making a django project and an API.

2018-08-22 Thread vineeth sagar
Hey Mike I like reading books rather than tutorials please share the name of the book. On Aug 23, 2018 5:47 AM, "Mike Dewhirst" wrote: > If you can get your hands on a copy of Two Scoops of Django 1.11, there is > a whole chapter on DRF. I've just had a look through it (20+ pages) and I > reckon

Re: Making a django project and an API.

2018-08-22 Thread vineeth sagar
Sorry, got the name of the book. On Aug 23, 2018 9:29 AM, "vineeth sagar" wrote: > Hey Mike I like reading books rather than tutorials please share the name > of the book. > > On Aug 23, 2018 5:47 AM, "Mike Dewhirst" wrote: > >> If you can get your hands on a copy of Two Scoops of Django 1.11,

Re: Making a django project and an API.

2018-08-22 Thread Vineet Kothari
You want the response in front end that's what you wantSent from my Huawei Mobile Original Message Subject: Re: Making a django project and an API.From: vineeth sagar To: django-users@googlegroups.comCC: Sorry, got the name of the book.On Aug 23, 2018 9:29 AM, "vineeth sagar"

Re: Disable HTTP Referer checking

2018-08-22 Thread Siphiwe Gwebu
Did you ever have any luck with disabling referer checnking? On Thursday, 29 September 2011 08:25:26 UTC+2, sspross wrote: > > On Sep 28, 5:19 pm, Tom Evans wrote: > > On Wed, Sep 28, 2011 at 4:03 PM, sspross wrote: > > > hi tom > > > > > thanks for your reply, but > > > > > i'm don't want

Re: Data Binding Example Channels 2

2018-08-22 Thread Mikhailo Keda
There are no benefits. As for me if you need to implement data binding just for one model - you could do this directly in the model, if you need data binding for few models - better to use signals to keep code clean and readable. You could create groups with just one user. -- You received thi

django sqlite3 error

2018-08-22 Thread ruban bharath
Hi these are my tables music_name = char(username),userId(int) meaning = char(meaning),userid(int) i have used the join to merge this db = sqlite3.connect('db.sqlite3') cursor = db.cursor() cursor.execute('\n' 'INSERT INTO music_result SELECT username, meaning ,NULL

Re: How to delete least recently used not expired django sessions?

2018-08-22 Thread Web Architect
Hi Avraham, Thanks for the recommendation. Will take a look at the package. Thanks. On Monday, August 20, 2018 at 1:00:03 PM UTC+5:30, Avraham Serour wrote: > > maybe something like this could be useful for your use case: > https://pypi.org/project/django-session-timeout/ > it has an option for

Re: How to delete least recently used not expired django sessions?

2018-08-22 Thread Web Architect
Hi, Thanks for the approach. On our site, customers have option to do guest checkout wherein users can make a purchase without getting registered/signing up. We are still using session information for such users. Hence, the session is kind of combined for logged in and not logged in users. The