These are chat archives for django/django

17th
Oct 2017
John
@flyboy1565
Oct 17 2017 01:08
Quest
@phillip94 for question one.. what does your company model look like?
John
@flyboy1565
Oct 17 2017 01:25
Fyi, @LukeVideo , if say you wanted to get a person with a specific attribute, you could do something like User.objects.filter(last_name='smith')
If you extend you user model with a one-to-one field, then you could do something like User.objects.filter(profile__logged_in__range=[start, end])
kpagcha
@kpagcha
Oct 17 2017 07:14
I'm getting a migration error when running test so I decided to disable migrations for tests. I learned many people asked for this featured (disabling migrations when testing) because it's slowed the process considerably. But I wonder, if Django runs migrations when testing there must be a reason for it right? Could disabling migrations cause any problems?
Luke-VideoLibre
@LukeVideo
Oct 17 2017 08:13
@flyboy1565 Thanks, you are answering my query set related question right ? That's not about could that be used to redirect to the current page with a updated template? I'm having an issue where I only get the penultimate submission to show up after a form submission. As soon as I hit f5 I get my last submission as expected.
NeelMishra
@NeelMishra
Oct 17 2017 12:03
CommandError: You appear not to have the 'mysql' program installed or on your path.
How to encounter this error, please help me out.
Luke-VideoLibre
@LukeVideo
Oct 17 2017 13:43
In your settings.py the database to use is specified. Did you install your project on a new machine? Or did you perhaps git clone a Django project? You will have to install MySQL on your server or change your settings to fit your environment
For development purpose you can use SQLite
Phillip
@phillip94
Oct 17 2017 14:28
@flyboy1565 I was able to figure out Q1, I used if (datetime.date.today() - datetime.timedelta(days=7)) > company.people_updated: get_company_details(stock_symbol) where get_company_details is a function I imported.
John
@flyboy1565
Oct 17 2017 19:20
@phillip94, if you second model looks like
class Person(models.Model):
     company = models.ForeignKey(company)
     name = models.CharField()
     date_added = models.DateField()

# then you could do 
Person.get_or_create()
It would mean you'd have a database of the people that would be add during your scraping. The page would only render the data from the database
Phillip
@phillip94
Oct 17 2017 19:46
@flyboy1565 that will work, thanks for the help!