These are chat archives for django/django

Feb 2018
Feb 16 2018 02:50 UTC
Hi I am @emihir0 I am posting my code
This is my view for the search function
This is my search form
This the results page
But when I search nothing appears
is there anything that I am doing wrong @emihir0
Feb 16 2018 03:43 UTC
I am now moving from Django1 to Django2
But the dependency is outdated and one of the feature has been remove from the offical Django
Suppose I am about to fix this thing to let it works for Django2
What am I suppose to do with it?
Feb 16 2018 04:10 UTC
@elcolie there might be alot of problem migrating from 1 to 2 since so many feature has been change, if your application is somewhat mature i suggest to stick to the current version of django you are using.
Feb 16 2018 05:37 UTC
Hello Guys, i just started with django...
Currently following the official polls tutorial. Any suggestions and guide from you all is highly welcomed... :+1:
Jhonferdz King Rule
Feb 16 2018 05:40 UTC
@prinxy Another good beginner example tuto,
Feb 16 2018 05:41 UTC
will definitely check it out @jkingz ... Thanks
Following the tutorial should take me off the beginner
beginner's stage right @jkingz
Jhonferdz King Rule
Feb 16 2018 05:42 UTC
indeed @prinxy
Feb 16 2018 05:43 UTC
Thanks @jkingz :+1:
Feb 16 2018 12:18 UTC

Hello guys, please need some help on how to use a primary key to 3 models. the models are PROFILE, SUBJECTS AND GRADE. i want the subject to be linked to profile and the grade to link to subject. I don't know how to archive that. class Profile(models.Model):
f_name = models.CharField(max_length=20)
l_name = models.CharField(max_length=20)
sch_id = models.CharField(max_length=20)

class Subject(models.Model):
profile = models.ForeignKey(Profile, on_delete=models.CASCADE)
maths = models.CharField(max_length=20)
english = models.CharField(max_length=20)

class Grade(models.Model):
subjt = models.ForeignKey(Subject, on_delete=models.CASCADE)
score = models.CharField(max_length=20)
grad = models.CharField(max_length=20)

Feb 16 2018 14:53 UTC
I got a strange problem in my server.
I am sure that no one can remote my server
Everything commit to the database always perform under Django
Mehmood Deshmukh
Feb 16 2018 15:04 UTC
@Anyilloyd_twitter your code seems to be correct (unless I misunderstood what you wanted it to do ). What exactly is the problem?
Feb 16 2018 17:31 UTC
@Anyilloyd_twitter presumably you want your Subject to actually just have something like name = models.CharField(max_length=20) where the actual value of name can be math or english. Also your Grademodel's grad (which I think is meant to mean grade) should be a property (or method) which calculates grade based on the score. E.g. 90-100 = A, 80-900 = B... and your score grade should be either a DecimalField or an IntegerField, not a CharField
usually in this type of scenario you want to have 3 basic things, (1) User, (2) Subject/Class, (3) Grade - you have these, but the relationship is a bit different than what you have - A User can be taking a subject/class, hence subject must have a FK to User. A grade is for a user's subject (e.g. student A got score 75.5 on subject math), and so it should have both User and Subject FK (and score).
Ferruccio Balestreri
Feb 16 2018 21:38 UTC
Does anyone know why when deploying django in production with debug False and this:
  • url: /static
    static_dir: static`
in the app.yaml static files aren't loaded?
(static files are in the static folder of the project and in the templates i'm doing all the {% loadstaticfiles things
Ferruccio Balestreri
Feb 16 2018 21:55 UTC
I just put the static files in a bucket and deployed changing the static file URL to the directory, hope it works
Ferruccio Balestreri
Feb 16 2018 22:12 UTC
! it didn't work, trying again with different configuration, maybe this time it will work
Ferruccio Balestreri
Feb 16 2018 23:48 UTC
managed to solve my problem somehow!