Re: Candidacy for the Contract Full Stack Django Engineer role

2024-07-01 Thread Kevin Anand
No worries!

On Sat, Jun 29, 2024 at 9:20 PM Gobi Dasu  wrote:

> I am so sorry for sending this to the wrong email address. Please forgive
> me. I meant to send it to the individual.
>
> On Sat, Jun 29, 2024 at 11:18 PM  wrote:
>
>> Hi Bernard,
>>
>> We commend your dedication to pioneering AI-enabled systems through
>> advanced Django development, reflecting a strong commitment to
>> technological innovation and excellence.
>>
>> I saw your job post for the Contract Full Stack Django Engineer role at
>> your endeavor. I (Gobi) personally would be interested in working with you
>> as an IC or PM. Here is my profile
>> .
>>
>> If I'm not the right fit, then my peers, these candidates
>> 
>> from our network, may be relevant to your search for talent who know
>> Django, CSS, Continuous Integration, NoSQL, and Stripe API. We recommend
>> checking out Gobi D
>> ,
>> Collins M
>> 
>> and Wilfred Chetat Y
>> 
>> (myself included).
>>
>> My peers and I work through LD Talent, a future of work platform that has
>> helped 100+ remote teams quickly find vetted, motivated, and productive
>> talent.
>>
>> Teams hiring on LD Talent include startups funded by Y Combinator and 500
>> Global, tech giants like Baidu and Infosys, and universities like Yale and
>> Northwestern.
>>
>> Free Trial: We give out ~5 free hours
>> 
>> to try us before hiring us for contract or full-time roles. To see how
>> incredibly unique LD is, check out this video:
>> https://www.youtube.com/watch?v=EVAo8LPCZmA
>>
>> Mission: To strengthen remote teams by helping them drop location
>> constraints and include qualified but overlooked talent from the majority
>> world: diversity meets capitalism.
>>
>> Contact: We split our time between WI USA, Stanford, CA USA,
>> Northwestern, IL USA, and on occasion Africa, India, and Nepal. If you have
>> any questions, you can connect with us on LinkedIn (profiles in the
>> signature below) or schedule a call: our calendar
>> 
>>
>> Regards,
>> Gobi , alongside Anisha
>> , Girija
>> , and Nutan
>> 
>> Stanford CS · Northwestern HCI · IITD · UCSC
>> Calendar  · PM Service
>>  · Join our
>> Investors 
>>
>>
>> 10311 Sister Oak Dr. Verona, WI USA 53593 · +14087055753 (SMS only) ·
>> Unsubscribe
>> 
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMk8evkJgyw_-UNvNqFQF3mWN%3D-bcg%2BWd7j255G80Nneg9zvkw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHghHZfWr%3DiKgLLtYjQB0v1XkzDazp88Riq3y4iA97%3DYwzOwZQ%40mail.gmail.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-18 Thread Kevin Tuo
I agree to join the Django group!

On Sun, 18 Feb 2024, 4:48 pm SURAJ TIWARI,  wrote:

>  Join Our Django WhatsApp Bulk Messaging Project!
>
>  Hello everyone,
>
> Are you looking for an exciting opportunity to gain hands-on experience in
> Django development? Do you want to work on a meaningful project that
> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
> our dynamic team!
>
>  Benefits:
>
>- Get hands-on experience working on a real-world Django project.
>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>in today's digital landscape.
>- Opportunities for hybrid work, allowing flexibility in your schedule.
>- Collaborate with experienced developers and gain valuable mentorship.
>- Access to cutting-edge tools and technologies.
>
>  Opportunities Available:
>
>- Django developers
>- Frontend developers
>- UI/UX designers
>- Quality assurance testers
>
> 欄 How to Join: Simply reply to this message expressing your interest,
> and we'll provide you with all the necessary details to get started on our
> project.
>
> Let's work together to create something amazing and gain valuable
> experience along the way! ✨
>
> Best regards,
>
> Suraj Tiwari
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJrNK9sNT4%3DJc0V_5NujpBqpXTyJBvZLMXEt%2BHSraUhQW%2BMX6w%40mail.gmail.com.


[no subject]

2024-02-03 Thread Kevin Tuo
Ô

Envoyé à partir de Outlook pour Android

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/VI1PR07MB5117C7A22346604955B43A5AFA412%40VI1PR07MB5117.eurprd07.prod.outlook.com.


Re: Book

2024-02-03 Thread Kevin Tuo
Good idea, Thanks!

Envoyé à partir de Outlook pour Android<https://aka.ms/AAb9ysg>

From: django-users@googlegroups.com  on behalf 
of Obam Olohu 
Sent: Saturday, February 3, 2024 4:15:02 PM
To: django-users@googlegroups.com 
Subject: Re: Book

why don't you learn directly from a tutor?


On Thu, Feb 1, 2024 at 3:14 AM Kevin Tuo 
mailto:tuokev...@gmail.com>> wrote:
Hello, Please can I get a book for building a portfolio website with django?


Envoyé à partir de Outlook pour Android<https://aka.ms/AAb9ysg>

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AS4PR09MB55764DA8881C3AB572B7468AFA7C2%40AS4PR09MB5576.eurprd09.prod.outlook.com<https://groups.google.com/d/msgid/django-users/AS4PR09MB55764DA8881C3AB572B7468AFA7C2%40AS4PR09MB5576.eurprd09.prod.outlook.com?utm_medium=email_source=footer>.

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMc8uwNeDWk8QRicjFHg_Ph6%3DrN7ARRgGxAQBzxVM7ASFupL9g%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAMc8uwNeDWk8QRicjFHg_Ph6%3DrN7ARRgGxAQBzxVM7ASFupL9g%40mail.gmail.com?utm_medium=email_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/VI1PR07MB511726EE0F530FF06C424722FA412%40VI1PR07MB5117.eurprd07.prod.outlook.com.


Re: Book

2024-02-03 Thread Kevin Tuo
Thanks for advice sir; I will do that!
Nice weekend!

Envoyé à partir de Outlook pour Android<https://aka.ms/AAb9ysg>

From: django-users@googlegroups.com  on behalf 
of BUHNYUY RONALD 
Sent: Saturday, February 3, 2024 5:17:16 PM
To: django-users@googlegroups.com 
Subject: Re: Book

Greetings. Saying just a portfolio site, basically there will no Django book 
that will teach u that. U have to get a tutor and start from a base. I do offer 
some Django courses from beginner level to advanced

On Sat, 3 Feb 2024, 17:16 Obam Olohu, 
mailto:olohuo...@gmail.com>> wrote:
why don't you learn directly from a tutor?


On Thu, Feb 1, 2024 at 3:14 AM Kevin Tuo 
mailto:tuokev...@gmail.com>> wrote:
Hello, Please can I get a book for building a portfolio website with django?


Envoyé à partir de Outlook pour Android<https://aka.ms/AAb9ysg>

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AS4PR09MB55764DA8881C3AB572B7468AFA7C2%40AS4PR09MB5576.eurprd09.prod.outlook.com<https://groups.google.com/d/msgid/django-users/AS4PR09MB55764DA8881C3AB572B7468AFA7C2%40AS4PR09MB5576.eurprd09.prod.outlook.com?utm_medium=email_source=footer>.

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMc8uwNeDWk8QRicjFHg_Ph6%3DrN7ARRgGxAQBzxVM7ASFupL9g%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAMc8uwNeDWk8QRicjFHg_Ph6%3DrN7ARRgGxAQBzxVM7ASFupL9g%40mail.gmail.com?utm_medium=email_source=footer>.

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO0F2GYnkMY8fY_0asOyMnb6dk3nzSYe5Wpc2%3DLHjx7BeuJDBg%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAO0F2GYnkMY8fY_0asOyMnb6dk3nzSYe5Wpc2%3DLHjx7BeuJDBg%40mail.gmail.com?utm_medium=email_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/VI1PR07MB5117794750FECBD2FB73C8B4FA412%40VI1PR07MB5117.eurprd07.prod.outlook.com.


Book

2024-01-31 Thread Kevin Tuo
Hello, Please can I get a book for building a portfolio website with django?


Envoyé à partir de Outlook pour Android

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AS4PR09MB55764DA8881C3AB572B7468AFA7C2%40AS4PR09MB5576.eurprd09.prod.outlook.com.


Re: Looking for a Learning Buddy

2023-06-19 Thread Kevin Anand
I would be interested too!

On Sun, Jun 18, 2023, 9:36 AM John Ayodele  wrote:

> I have some basic knowledge from high school.
> But if I get stuck, I'll go online and find solutions.
>
> On Sun, Jun 18, 2023 at 3:36 PM Jeman Kumar 
> wrote:
>
>> did you learn math for machine learning?
>>
>> On Sat, 17 Jun, 2023, 3:30 am John Ayodele, 
>> wrote:
>>
>>> Hi! It's John.
>>>
>>> I am currently looking for a learning buddy, for Machine Learning.
>>> I have little experience in Django and I code in Python.
>>>
>>> The learning buddy would have one-on-one meetings with me so we can
>>> share ideas and learn together.
>>> It is really going to be a fun experience.
>>> The reason I am looking for a learning buddy is because I find it more
>>> fun learning with people rather than just being self-taught alone.
>>> I will be going to university later this year or next year.
>>> 
>>> If this sounds like you, please do not hesitate to contact me.
>>> 
>>>
>>> Thanks.
>>> John Ayodele
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAP7pJ3gsn_bkOfP-8k-SNZ%2BmmJ8riuc1cdUVXzoQXN31BS4W4g%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CALmE1TvMBEOov%3DCeG3TtiFfHDB8T6h9zD%3D_2NOyg%3DbG5OruodA%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP7pJ3ihN7Er22k%2Be7qO1cghAM%2BeMJp%3DLP4XgUYsp4knup5TYw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHghHZcKCPPSEvO5aT5nKb5pTEHvJ__60%3D8%3De1z-3FFi-pwFOw%40mail.gmail.com.


Re: Freelance Django and Python work

2023-06-18 Thread Kevin Anand
As a current backend engineer, yes, I am also interested in this position.
Please do keep me updated with any information better position.

On Sat, Jun 17, 2023, 5:36 PM Vairamuthu Puvanachandran 
wrote:

> Are you working from home?
> Vai
>
> On Thu, Jun 15, 2023, 6:28 AM Francis F. Massaquoi, Jr. <
> ffmassaquo...@gmail.com> wrote:
>
>> Hi,
>>
>> I am interested in the Django and Python Developer freelancing role, I am
>> a Python Developer with great experience working Django, Flask, FastApi and
>> other advance frameworks. Based on my experience I believed I am be a great
>> candidate for this role.
>>
>> I remain available, if there are any additional information needed.
>>
>> Regards.
>>
>> Francis F. Massaquoi Jr.
>> On Tuesday, June 13, 2023 at 11:30:40 AM UTC אורי wrote:
>>
>>> Hi,
>>>
>>> I'm looking for a programmer to hire as a freelancer for Django and
>>> Python work.
>>>
>>> - Experience with Python and Django
>>> - Experience with open source
>>> - Committed to the Django repository on GitHub - an advantage
>>> - Committed to other open-source projects in Python - an advantage
>>> - Experience with Stack Overflow -  an advantage
>>> - BSc or BA in computers or science (math, physics) -  an advantage
>>> - Knowledge of HTML, CSS, and JavaScript - an advantage
>>> - Can issue receipts
>>>
>>> I need about 5 hours per month on average. Some months I might need up
>>> to 15 hours per month. Some months I might not need anything. The work is
>>> remote. My project is open source. I can give you a free license to
>>> PyCharm. My website is at https://en.speedy.net/ and
>>> https://github.com/speedy-net/speedy-net
>>>
>>> To apply please send one email to jobs+jango...@speedy.net, with your
>>> name, your email address, where you live, your experience, how many commits
>>> you committed to Django, how many commits you committed to other open
>>> source projects, a link to your profile on LinkedIn, a link to your profile
>>> on GitHub, a link to your profile on Stack Overflow, your diploma if you
>>> have any, how much you charge per hour and in which currency (I prefer USD
>>> or Euro), and if you can issue receipts. If you don't have a profile on one
>>> of the above websites please mention this too.
>>>
>>> Thanks,
>>> Uri Rodberg, Speedy Net.
>>> אורי
>>> u...@speedy.net
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/6228db4a-936d-43de-8bb2-173ade7b48f2n%40googlegroups.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAJ%2B9rH_jcPuGBDtL6J99bPNpUrapVSqsoh826-_MTOUhcr-Kw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHghHZcfX0jusTX1ceoUB2Mm8hY%3D5X-rFPZK%2B%2B-SzwWqhbpGnQ%40mail.gmail.com.


Re: New to Django

2022-11-06 Thread Kevin gallagher
Thanks for the help! 

On Thursday, November 3, 2022 at 7:28:08 PM UTC subtitle indo wrote:

> Please let me know if that sounds okay.
>
> On Wed, Nov 2, 2022 at 6:05 PM Kevin gallagher  
> wrote:
>
>> Hi guys,
>> Im currently learning django and am doing a project for college. Im 
>> building an appointment website users can book a training session. These 
>> are my models:
>>
>> class TimeSlot(models.Model):
>>
>> title = models.CharField(max_length=50)
>>
>> def __str__(self):
>> return f'There is a slot at {self.title}'
>>
>>
>> class Booking(models.Model):
>>
>> user = models.ForeignKey(settings.AUTH_USER_MODEL,
>>  on_delete=models.CASCADE)
>> time_slot = models.ForeignKey(TimeSlot, on_delete=models.CASCADE)
>> booking_date = models.DateField(("Date"), default=date.today)
>>
>> def __str__(self):
>> return f'{self.user} has booked a session at 
>> {self.timeslot.title} on {self.booking_date}'
>>
>> I have the title field set as available session times, 1-2pm, 3-4pm etc.
>> I want the user to select a date and then be able to see what time slots 
>> are still available to book but I'm kind of lost and confused. Any help 
>> would be much appreciated! 
>>  
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/1c6c2ab1-f852-4503-81c5-d072cf2dbb02n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/1c6c2ab1-f852-4503-81c5-d072cf2dbb02n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/df45710f-3081-4836-bd09-d8060069d974n%40googlegroups.com.


New to Django

2022-11-02 Thread Kevin gallagher
Hi guys,
Im currently learning django and am doing a project for college. Im 
building an appointment website users can book a training session. These 
are my models:

class TimeSlot(models.Model):

title = models.CharField(max_length=50)

def __str__(self):
return f'There is a slot at {self.title}'


class Booking(models.Model):

user = models.ForeignKey(settings.AUTH_USER_MODEL,
 on_delete=models.CASCADE)
time_slot = models.ForeignKey(TimeSlot, on_delete=models.CASCADE)
booking_date = models.DateField(("Date"), default=date.today)

def __str__(self):
return f'{self.user} has booked a session at {self.timeslot.title} 
on {self.booking_date}'

I have the title field set as available session times, 1-2pm, 3-4pm etc.
I want the user to select a date and then be able to see what time slots 
are still available to book but I'm kind of lost and confused. Any help 
would be much appreciated! 
 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1c6c2ab1-f852-4503-81c5-d072cf2dbb02n%40googlegroups.com.


How to generate a table in pdf?

2022-06-24 Thread Kevin Kamla




*Hi family, I created a salary calculation application.As I already display 
the list of employees, I now have to download it using a function in the 
VIEW folder.Please I urgently need helpThanks ...*

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/93f28821-a021-48bb-a02c-3310ec8d79b3n%40googlegroups.com.


Re: runserver not working

2022-03-26 Thread Kevin Jay
Did you activate your virtual environment?

Sent from my iPhone

> On Mar 22, 2022, at 10:32 PM, 'Delvin Alexander' via Django users 
>  wrote:
> 
> i did that but the problem still remains :(
> 
>> On Tuesday, March 22, 2022 at 2:09:33 AM UTC-7 sebasti...@gmail.com wrote:
>> Hey,
>> 
>> I think yoz don't have installed django package. Please install it over pip 
>> install django
>> 
>> Regards
>> 
>> 'Delvin Alexander' via Django users  schrieb am 
>> Di., 22. März 2022, 06:07:
>>> would anyone know why my "manage.py runserver" is not working?
>>> 
>>> Every time i try running it on the command prompt, i get relocated to my 
>>> visual studio of manage.py file that states this:
>>> 
>>> #!/usr/bin/env python
>>> """Django's command-line utility for administrative tasks."""
>>> import os
>>> import sys
>>> 
>>> 
>>> def main():
>>> """Run administrative tasks."""
>>> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 
>>> 'django_project.settings')
>>> try:
>>> from django.core.management import execute_from_command_line
>>> except ImportError as exc:
>>> raise ImportError(
>>> "Couldn't import Django. Are you sure it's installed and "
>>> "available on your PYTHONPATH environment variable? Did you "
>>> "forget to activate a virtual environment?"
>>> ) from exc
>>> execute_from_command_line(sys.argv)
>>> 
>>> 
>>> if __name__ == '__main__':
>>> main()
>>> 
>>> 
>>> A step in the right direction will be super helpful for me.
>>> 
>> 
>>> -- 
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/69291c68-61e7-4557-8175-7b705bcfcbb0n%40googlegroups.com.
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/a60f5102-0638-4fae-9dec-e870e6c2c98fn%40googlegroups.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/934F4336-CA23-48AF-B83C-174AEAD0A1A5%40gmail.com.


can I use django authentication in already created mysql database with user data?

2021-03-10 Thread Kevin Thomas
I am creating a web app and I need to authenticate the login. The username 
and password is already stored in mysql database. Can I use django for 
authentication of existing data? It will be great help if anyone knows the 
answer.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/50dd8d8b-da70-462f-abe2-fe446f826693n%40googlegroups.com.


Show FK as input instead of drop down in admin

2021-01-27 Thread Kevin Olbrich
Hi!

Is it possible to disable fetching of related models for admin pages?
I have a field that links to a table containing more than 1M rows which 
django tries to fetch and build the drop down. For my purpose, it is 
sufficient if it is a simple input containing the id instead.

How can I accomplish this?

Thank you!

Kind regards
Kevin

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/12a7c928-a960-4c48-b631-93153260adbfn%40googlegroups.com.


Re: Static not working on unix while working on windows

2020-07-07 Thread Kevin Jay
You also need to close your quote.

On Tue, Jul 7, 2020 at 11:54 AM Kevin Jay  wrote:

> I’ve had the same issue in the past. I fixed it by removing
> *rel="stylesheet *
>
>
> On Mon, Jul 6, 2020 at 1:20 PM ashish goyal 
> wrote:
>
>> Hi All,
>>
>> I have created a django app on windows and have used bootstrap navbar n
>> other functions which are working good on windows.
>>
>> Same files I have imported on unix server then i am able to get all
>> details but getting issue with css and js files saying below error
>>
>> *Refused to apply style from  because its MIME type ('text/html') is
>> not a supported stylesheet MIME type, and strict MIME checking is enabled
>> angular*
>>
>> I am using below script in windows which is working in windows but not on
>> unix
>>
>> *{ % load static %}*
>> *> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/D45C33B1-949B-4BBE-8338-8982F2A246BF%40gmail.com
>> <https://groups.google.com/d/msgid/django-users/D45C33B1-949B-4BBE-8338-8982F2A246BF%40gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEtabwesOTudueuyFYdyhj8vzKCMqCR24SmKKEnAaus5mXXBhw%40mail.gmail.com.


Re: Static not working on unix while working on windows

2020-07-07 Thread Kevin Jay
I’ve had the same issue in the past. I fixed it by removing
*rel="stylesheet *


On Mon, Jul 6, 2020 at 1:20 PM ashish goyal 
wrote:

> Hi All,
>
> I have created a django app on windows and have used bootstrap navbar n
> other functions which are working good on windows.
>
> Same files I have imported on unix server then i am able to get all
> details but getting issue with css and js files saying below error
>
> *Refused to apply style from  because its MIME type ('text/html') is
> not a supported stylesheet MIME type, and strict MIME checking is enabled
> angular*
>
> I am using below script in windows which is working in windows but not on
> unix
>
> *{ % load static %}*
> * To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/D45C33B1-949B-4BBE-8338-8982F2A246BF%40gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEtabwcUaMsPwztfk-aep_t3cKjva-fSAtfYcX3wJDgA6NhwXg%40mail.gmail.com.


Re: Django CSRF protection and AJAX calls

2020-06-10 Thread Kevin
Thanks Boris & Allan,

I was able to research the problem further and found that my header was 
being set entirely correctly, and the Django csrf middleware does in fact 
require both the cookie AND the header to be set. It's not an either/or, 
and there is an explicit error message for when either of them are missing 
and csrf secured method is used. The POSTs that I am seeing fail appear to 
be because the csrf cookie is missing sometimes. I'm not sure as of yet if 
this is because Django is not creating it, or because certain browsers 
(notably Safari) are not sending it, or a mix of both.

On Wednesday, June 10, 2020 at 11:57:52 AM UTC-4, Boris Pérez wrote:
>
> My way, i use the csrf_token tag on template, an pass it to the view in 
> the ajax call, using 
>
> $.ajax({
> url : url,
> type : "POST", // http method
> data : {'csrfmiddlewaretoken': 
> $('input[name="csrfmiddlewaretoken"]').val(),
> 'v1':v1,'v2':v2,
> }, // data sent with the post request
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6a0f1491-cdbc-4cfc-b9fa-665e389fdafeo%40googlegroups.com.


Django CSRF protection and AJAX calls

2020-05-26 Thread Kevin
Hi,

I'm not able to POST to django without having a csrf_token cookie sent with 
the request, though the documentation says you can set an X-CSRFToken 
header - it appears to be entirely ignored.

The behaviour has been pointed out a couple of times before:

https://code.djangoproject.com/ticket/26904

https://code.djangoproject.com/ticket/30514

but it doesn't appear to have ever been triaged by a project member or 
looked into in any way.

I'm trying to find a definitive answer - should a POST request to a CSRF 
protected endpoint work without the cookie if the header is set?

Thanks

-Kevin

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1e318fcd-32bc-448b-bd4d-05b92f4a8afc%40googlegroups.com.


Re: Active Open Source Project to contribute to

2020-03-11 Thread Kevin Dublin
I'm interested as well. Do you have a discord channel? Or Hangouts group?
Or slack? And is there a link to the repo?

On Wed, Mar 11, 2020, 9:10 AM ranjan jha  wrote:

> Hey Guys
>
> We are small startup called Rebataur(https://rebataur.com) and we have
> been working on a "Product Management Tool"
> It is still in very early stage and we plan to opensource it.
>
>
> Many people have asked us why are we building it in the first place, and
> the answer is,
> that the kind of products we design and projects we execute, there is no
> tool that lets you capture
> your design to execution journey from Design Thinking - Validation to
> Execution in one tool.
>
> You can see live demo here
> http://ec2-54-164-87-73.compute-1.amazonaws.com/
>
> We were planning to send out emails for invitation in this group, but
> since the discussion has already started,
> thought of putting it in here now itself.
>
> If you guys want to join in then let me know and we can take this
> conversation in some channel.
>
> regards
>
> On Wednesday, March 11, 2020 at 4:58:43 AM UTC+5:30, Johnson wrote:
>>
>> Hi friends, I'm a django/vue js junior developer, does anyone has or
>> knows beginner friendly open source projects I can start contributing to.
>>
>> Thanks.
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d816b517-b4ec-4edd-900a-50e2193d8996%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANips4LzvwukvvYa2seheVOMa2O245wwo%2BSgLH-R-Zwf7T01Nw%40mail.gmail.com.


Has anyone ever deployed a Django project that uses Pyo to Heroku?

2020-02-13 Thread Kevin Dublin
Hi all,

I'm trying to deploy an mvp of a django project on Heroku that works fine
locally but only works online when I uninstall the package Pyo (
http://ajaxsoundstudio.com/pyodoc/index.html) or move my import to the
specific function that uses it, but it throws an OSerror whenever it is
initialized (OSError at / Exception Value:
/app/.pyo/3.6_64/libs/libasound-fb332ab3.so.2.0.0: cannot open shared
object -- see below for full traceback). I've added a buildpack that
installs the libasound and recommened packages, but I still get the error.
What am I missing? I see the Linux wheel fix symlink (
https://github.com/belangeo/pyo/blob/master/pyo/_linux_wheel_fix_symlinks.py
).

After an exchange on the Pyo usergroup via email, it was clear that a part
of the issue is here on line 35 of the above file:

userlibdir = os.path.join(os.path.expanduser("~"), ".pyo", version, "libs")


The missing file is supposed to be created the first time pyo loads, but it
fails. I even tried just copying the files locally and force pushing them
up into the directory, but it still returns the same error. I don't know if
this is permissions related or what, but it's become increasingly
frustrating. Any help would be greatly appreciated.

Error:

Request Method: GETRequest URL: ---
Django Version: 3.0.3Python Version: 3.6.10Installed
Applications:['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'core',
 'allauth',
 'allauth.account',
 'allauth.socialaccount',
 'allauth.socialaccount.providers.facebook',
 'allauth.socialaccount.providers.google']Installed
Middleware:('whitenoise.middleware.WhiteNoiseMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback (most recent call last):
  File 
"/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py",
line 34, in inner
response = get_response(request)
  File 
"/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py",
line 100, in _get_response
resolver_match = resolver.resolve(request.path_info)
  File 
"/app/.heroku/python/lib/python3.6/site-packages/django/urls/resolvers.py",
line 544, in resolve
for pattern in self.url_patterns:
  File 
"/app/.heroku/python/lib/python3.6/site-packages/django/utils/functional.py",
line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"/app/.heroku/python/lib/python3.6/site-packages/django/urls/resolvers.py",
line 588, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File 
"/app/.heroku/python/lib/python3.6/site-packages/django/utils/functional.py",
line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"/app/.heroku/python/lib/python3.6/site-packages/django/urls/resolvers.py",
line 581, in urlconf_module
return import_module(self.urlconf_name)
  File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line
126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import

  File "", line 971, in _find_and_load

  File "", line 955, in _find_and_load_unlocked

  File "", line 665, in _load_unlocked

  File "", line 678, in exec_module

  File "", line 219, in _call_with_frames_removed

  File "/app/autosubclub/urls.py", line 20, in 
from core import views
  File "/app/core/views.py", line 8, in 
from pyo import PVMix, PVMorph, PVAnal, SfPlayer, Vocoder, Server,
Record, sndinfo
  File "/app/.heroku/python/lib/python3.6/site-packages/pyo/__init__.py",
line 25, in 
from . import _linux_wheel_fix_symlinks
  File 
"/app/.heroku/python/lib/python3.6/site-packages/pyo/_linux_wheel_fix_symlinks.py",
line 88, in 
libasound = ctypes.CDLL(libasound, mode=ctypes.RTLD_GLOBAL)
  File "/app/.heroku/python/lib/python3.6/ctypes/__init__.py", line
348, in __init__
self._handle = _dlopen(self._name, mode)
Exception Type: OSError at /Exception Value:
/app/.pyo/3.6_64/libs/libasound-fb332ab3.so.2.0.0: cannot open shared
object file: No such file or directory

Thank you,


Kevin Dublin (he / him / his)
Writer of poetry, prose, scripts, and code (Django/MERN Full Stack
Developer)
Author of *How to Fall in Love in San Diego
<https://www.finishinglinepress.com/product/how-to-fall-in-love

Re:

2020-01-14 Thread Kevin Dublin
Hi Yusuf,

It could be any number of reasons depending on the type of carousel and
implementation.

I will assume you are using bootstrap and suggest that you make sure all of
the necessary bootstrap css and JavaScript files are linked at the bottom
of your base template. Also check your carousel against a working example.

Cheers,

Kevin

On Tue, Jan 14, 2020, 12:39 PM Kasper Laudrup  wrote:

> Hi Yusuf,
>
> On 14/01/2020 16.31, yusuf abdul wrote:
> > why is my carousel not changing veiw
> >
>
> Try spinning it around a bit. That usually gives some new perspective.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bd2b750e-50ed-074a-bda7-cc6b40932bc5%40stacktrace.dk
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANips4L1nBeU3k%3Du91s7cTHJvV0dD61sMkBoOXH6w-BZg_zU5g%40mail.gmail.com.


Re: send data to database

2019-12-24 Thread Kevin Dublin
Hi Leo,

You'll want to use a model form in your forms.py, create an instance of it
in the views.py to pass 'form' as a context variable, and then just let the
model form render in the html template using {{ form }}. Check the docs:

https://docs.djangoproject.com/en/3.0/topics/forms/modelforms/

This is a pretty thorough guide:

https://simpleisbetterthancomplex.com/article/2017/08/19/how-to-render-django-form-manually.html

Cheers!

Kevin


Kevin Dublin
Etched Press Editor
Author of *How to Fall in Love in San Diego
<http://kevindublin.com/how-to-fall/>*
Follow me @parteverything

*Happiness is a state of being, just be.*
*Believe it, and it will be.*


On Tue, Dec 24, 2019 at 6:20 AM Leó Horváth 
wrote:

> Hi guys,
>
> I want to create a form with radio buttons that sends data to a specific
> database field.  How can I do it?
>
> My models.py looks like this:
> import datetime
> from django.db import models
> from django.utils import timezone
>
> # Create your models here.
>
> class Name(models.Model):
> user_name = models.CharField(max_length=200)
>
> publication_date = models.DateTimeField('date published')
>
> age= models.IntegerField(default=0)
>
> prof_comm_score = models.IntegerField(default=1)
> prof_comm_status = models.IntegerField(default=1)
>
> teamwork_score = models.IntegerField(default=1)
> teamwork_status =  models.IntegerField(default=1)
>
> prod_knowledge_score =  models.IntegerField(default=1)
> prod_knowledge_status =  models.IntegerField(default=1)
>
> part_comp_score =  models.IntegerField(default=1)
> part_comp_status =  models.IntegerField(default=1)
>
> relations_score =  models.IntegerField(default=1)
> relations_status =  models.IntegerField(default=1)
>
> strategy_score =  models.IntegerField(default=1)
> strategy_status =  models.IntegerField(default=1)
>
> loyality_score =  models.IntegerField(default=1)
> loyality_status =  models.IntegerField(default=1)
>
> overall_score = models.IntegerField(default = 7)
>
> def __str__(self):
> return self.user_name
> def was_published_recently(self):
> return self
> .publication_date >= timezone.now() - datetime.timedelta(days=1)
>
> Lets say i want 7 radio buttons to determine the value of prof_comm_score
> (which is an int ranging from 1 to 7)
>
> My html file looks like this rn:
> 
> {%block content%}
> #1 Sales profession, communication
> 
> {% csrf_token %}
> 
> 
> 
> 
> 
> 
> 
>
>
> {%endblock%}
> 
>
>
>
> here is my git repo if needed:
> https://github.com/leocsi/salesgrade
>
> Thanks a lot,
> Leó
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJBcW0xearS3cj4XD%2BT0HEOCTvSSFMeJ18dvkjMaPdzwVfXf0w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJBcW0xearS3cj4XD%2BT0HEOCTvSSFMeJ18dvkjMaPdzwVfXf0w%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANips4KVWWx%3DECgM37CDSwpDoKJ3KBhFREhw4H8qZcuCDgbD7g%40mail.gmail.com.


Re: Static files configuration

2019-12-18 Thread Kevin Dublin
Hey, try this:

In settings:

# If running collectstatic
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

# make sure if you have multiple apps that you want to direct to specific
location of static files
STATIC_DIRS = (
os.path.join(BASE_DIR, '../apps/core/static'),
)

Finally if you're using Django 2.0+

In the html file:
{% load static %}


On Wed, Dec 18, 2019, 5:07 AM Yash Garg  wrote:

> I have to display a HTML page with its supporting css, js and images. So i
> create a template folder to put HTML in it then i create a static folder in
> which i create css, js and img folder and put related files into these
> folders.
> then I configure the
> *Settings.py*
>
> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>
> STATIC_URL = '/static/'
> MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
>
> MEDIA_URL = '/media/'
>
> STATIC_ROOT = os.path.join(BASE_DIR, 'static')
>
> STATIC_DIRS = (
> os.path.join(BASE_DIR, 'static'),
> )
>
>
> *.html file *
>
> {% load staticfiles %}
> 
>
> *views.py*
>
> def Index(request):
> return render(request,'Teenager Startup.html')
>
> please help me where i'm not getting the point.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/68f02a87-1876-4d81-9cf7-daba5f9079ca%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANips4KMEPxo-3P6-9L_q7s2mhgBRoMu5jJUj3c4a%2Be3FofLrw%40mail.gmail.com.


Re:

2019-12-04 Thread Kevin Dublin
Hmm, do you mean that you would like to post a get response with a message
and it pass through the URL? Are you trying to pass it to another view?

I want to clarify because it involves changing the view, template & urls.py.

On Wed, Dec 4, 2019, 12:23 AM Karan Mittal 
wrote:

> I think he wants to use get method. Like the search page reuslts of google.
> For that just make thw {%block content %} inside the title tags of your
> base template. And use get method for these kind of work where no database
> interaction is happening.
>
> Karan Mittal,
> Business Analyst at techvalens
> Contact me on this mail.
>
>
> On Wed, 4 Dec, 2019, 5:51 AM 1351552...@qq.com, <1351552...@qq.com> wrote:
>
>> r u mean u want to display the response?
>>
>> --
>> wblueboat
>>
>>
>> *From:* vaneet bawa 
>> *Date:* 2019-11-27 16:35
>> *To:* django-users 
>> *Subject:*
>> can someone please tell me that how I can display the message on the url
>> from which I am getting the response
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKubXnycx%3DqU2h4SgRJ%3D_HEXbSqfbJ8ii2TbVQVzYGzcT9m7Qg%40mail.gmail.com
>> 
>> .
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/5de6fbe9.1c69fb81.8ef74.2debSMTPIN_ADDED_BROKEN%40gmr-mx.google.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAO24gqyv0%3Df%2BkgvJvCM0J_J_CM0cJL9FfMnsqAz3Wf6uRaSVQg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANips4%2Bw4AOLqEOXUcbq54Jehav_cibdZKFdmzaLcoJXxOYVsw%40mail.gmail.com.


Re: Link a .css to a Html template

2019-12-02 Thread Kevin Dublin
Hi Leo,

Make sure that you point to the exact directory where the CSS file is
located. If it's in static/pages/frame.css, then point to {% static
"pages/frame.css" %}

Cheers,

Kevin

On Mon, Dec 2, 2019, 11:15 AM Leó Horváth  wrote:

> hi! i still cant make it work. this is my html snippet and the .css is
> located at static/pages/frame.css.
> when i run the server the browser displays the hard coded html but not the
> style. console says "GET /static/frame.css HTTP/1.1" 404 1651
> 
>
> {% load static %}
>
> 
> 
> 
> {% block css %}
> 
> {% endblock %}
>
> ‪‫אורי‬‎  ezt írta (időpont: 2019. dec. 2., H, 3:33):‬
>
>> Hi,
>>
>> Look at these templates for example:
>>
>> https://github.com/speedy-net/speedy-net/blob/master/speedy/core/templates/base.html#L12-L27
>>
>>
>> https://github.com/speedy-net/speedy-net/blob/master/speedy/match/templates/base_site.html#L7-L13
>>
>>
>> https://github.com/speedy-net/speedy-net/blob/master/speedy/match/templates/accounts/edit_profile/activate.html#L13-L18
>>
>>
>> אורי
>> u...@speedy.net
>>
>>
>> On Mon, Dec 2, 2019 at 3:26 AM Leó Horváth 
>> wrote:
>>
>>> Hi guys, I am experiencing an error while trying to Link a .css file to
>>> a Html template of one of my Views. What is the correct way to do it?
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/b37e10ec-3b9d-4178-8757-1d0277f6cd15%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/b37e10ec-3b9d-4178-8757-1d0277f6cd15%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABD5YeHFgym3pJ4Q5_gE3ATWJiVJ9KDnoBCN8UqM0%2BhWPxXpbg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CABD5YeHFgym3pJ4Q5_gE3ATWJiVJ9KDnoBCN8UqM0%2BhWPxXpbg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJBcW0w3qc8OcDgCJAFKrr881%2B2wyAyY3ENH6%3D2bi%2Bn%2BFALBDA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJBcW0w3qc8OcDgCJAFKrr881%2B2wyAyY3ENH6%3D2bi%2Bn%2BFALBDA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANips4LSgRBQ1QAg7gDgq70r--d4zDvQc%3DnfoiwcyomLEJaj%3Dg%40mail.gmail.com.


Re: Problem django-allauth

2019-11-15 Thread Kevin Dublin
Are you in your virtual environment? And installing with virtualenv or
pipenv vs just pip?

On Fri, Nov 15, 2019, 11:06 AM Nemanja Marković 
wrote:

> I want to install django-allauth however it throws me a code error:
>
> Traceback (most recent call last):
>   File "c:\program files\python37-32\lib\runpy.py", line 193, in
> _run_module_as_main
> "__main__", mod_spec)
>   File "c:\program files\python37-32\lib\runpy.py", line 85, in _run_code
> exec(code, run_globals)
>   File "C:\Program Files\Python37-32\Scripts\pip.exe\__main__.py", line 9,
> in 
> TypeError: 'module' object is not callable
>
> My email is: markovicnemanj...@gmail.com
> Please Help me :)
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAiBpJ7zeYuAZQZVn%3DREj0_OtYQ48yd2JjR3c%2BVM9e03PL0UhQ%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANips4JpSDRBC49H2KcczXAeyV7iO%3DgDnsDaQVx%2BhTNRM1XbAg%40mail.gmail.com.


Re: SPA websites with Django

2019-11-14 Thread Kevin Dublin
Hi Inna,

Yes. You can setup Django with a single view and page, then use a frontend
framework like Vue, React, or anything else to manipulate that single page
as your application. I hope this helps!

Cheers,

Kevin

On Thu, Nov 14, 2019, 4:49 AM Michael Thomas 
wrote:

> Django is a backend platform - it's agnostic as to what type of front end
> you build with it.
>
> On Thu, Nov 14, 2019 at 4:27 PM Inna Reddy  wrote:
>
>> Hi,
>>
>> Can we build Single page web applications with Django ?
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/26edfa5c-74b9-46f1-9d8f-3512625b3e78%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/26edfa5c-74b9-46f1-9d8f-3512625b3e78%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEdx1foJTu27k%2B6wtK_F8H2VedpF70MiVLp_vfK%2B0C%3DbBcmr%2BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEdx1foJTu27k%2B6wtK_F8H2VedpF70MiVLp_vfK%2B0C%3DbBcmr%2BA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANips4K3Sy2mdUB-bf26_9cFb49QMyc%3DZy%3DMkXs4hE1cz5gxTg%40mail.gmail.com.


Re: Does the "manifest_strict" attribute on "ManifestFilesMixin" work?

2019-11-14 Thread Kevin Dublin
Hi Chris,

DId you ever find a solution to this? Because I'm encountering a very 
similar error.

--Kevin

On Monday, October 1, 2018 at 4:29:45 AM UTC-7, Chris Bergstresser wrote:
>
> Hi all --
>
>For some reason, I get a "Missing staticfiles manifest entry" even 
> though the file it's complaining about is listed in the manifest. I don't 
> get the error when DEBUG is turned on, and I'm not sure why.
>At any rate, I tried subclassing "ManifestStaticFilesStorage" and 
> setting "manifest_strict" to False as it says in the documentation. I still 
> get a ValueError. The code appears to check that attribute, then call 
> "self.hashed_name(name)" anyway, which checks to see if the file exists and 
> throws an error if it doesn't.
>Is this intended behavior? Does anyone know why I'd be getting a 
> "Missing staticfiles manifest entry" only if DEBUG were turned off?
>
> -- Chris
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7bc688c3-3af2-4adc-8144-91e8326ba75f%40googlegroups.com.


Re: Djangorest framework tutorial

2019-11-04 Thread kevin trinidad
Django Signals: The QuerySet value for an exact lookup must be limited to
one result using slicing

i have this code in my models.py (post_save)

class StudentsEnrolledSubject(models.Model):
Students_Enrollment_Records =
models.ForeignKey(StudentsEnrollmentRecord, related_name='+',

on_delete=models.CASCADE, null=True)
Subject_Section_Teacher = models.ForeignKey(SubjectSectionTeacher,
related_name='+', on_delete=models.CASCADE,
null=True,blank=True)

@receiver(post_save, sender=StudentsEnrollmentRecord)
def create(sender, instance, created, *args, **kwargs):
teachers =
SubjectSectionTeacher.objects.filter(Sections=instance.Section,Education_Levels=instance.Education_Levels,Courses=instance.Courses)
for each in teachers:
if created and teachers.exists():
StudentsEnrolledSubject.objects.update_or_create(
pk=each.id,
Students_Enrollment_Records=instance,
Subject_Section_Teacher=teachers.all()

)

class StudentsEnrollmentRecord(models.Model):
Student_Users = models.ForeignKey(StudentProfile,
related_name='students', on_delete=models.CASCADE, null=True)

class SubjectSectionTeacher(models.Model):
Education_Levels = models.ForeignKey(EducationLevel,
related_name='+', on_delete=models.CASCADE, blank=True)
Courses = models.ForeignKey(Course, related_name='+',
on_delete=models.CASCADE, null=True, blank=True)
Sections = models.ForeignKey(Section, related_name='+',
on_delete=models.CASCADE, null=True)
Subjects = models.ForeignKey(Subject, related_name='+',
on_delete=models.CASCADE, null=True)
Employee_Users = models.ForeignKey(EmployeeUser, related_name='+',
on_delete=models.CASCADE, null=True)

when I used the **Subject_Section_Teacher=teachers.first()** i received no
error but that is not what i want result, then i decide to change it to
this **Subject_Section_Teacher=teachers.all()**


On Tue, Nov 5, 2019 at 1:21 PM Motaz Hejaze  wrote:

> If you need any help please let me know
>
> My skype
>
> m3tz-hjze
>
> On Mon, 4 Nov 2019, 4:44 pm Laura Pérez,  wrote:
>
>> Thanks!
>>
>> Em seg, 4 de nov de 2019 às 09:59, Paras Jain 
>> escreveu:
>>
>>> Hi,
>>> just follow this video u will easily know how to make api very easily
>>> link - https://www.youtube.com/watch?v=263xt_4mBNc
>>> Thnks
>>>
>>> On Mon, Nov 4, 2019 at 6:17 PM Laura Pérez  wrote:
>>>
 Hi!
 I have the task to develop a rest api in python, Can anybody advice me
 on a nice tutorial to use djangorest framework ?

 Best!


 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAF_dEnq90i0zxOgwGANXaFk_eEWJn4N6d544U1r-qwPS1M92jg%40mail.gmail.com
 
 .

>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMtmBS_11roQXUzFHb%3Dvus1MnaqqjQV8CmZS5jLrXZDZKvnNAw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> --
>> Laura Pérez Vera
>> (+53) 53440970 - lpver...@gmail.com
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAF_dEnock0uZ%2B9Vrg6Kyf%2B7z1NVzTQpBA55R4k27CdJ2OHGWtg%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-cSxYkj0rMWau%3DzMJDBBoxzX7H8M7J5dmRKoHEYxPwiiQ%40mail.gmail.com
> 

Django save all data

2019-11-03 Thread kevin trinidad
I have this code in my html


Required Documents:

 {% for d in doc %}



{{d.Description}}

 
{% endfor %}

This is my code in **views.py**

V_insert_data = StudentsEnrollmentRecord(
Student_Users=studentname, Payment_Type=payment,
Education_Levels=educationlevel,School_Year=schoolyear
)
V_insert_data.save()
insert_doc = StudentsSubmittedDocument(
Students_Enrollment_Records =  V_insert_data,
Document = myfile
)
insert_doc.save()

\model

class StudentsSubmittedDocument(models.Model):
Students_Enrollment_Records = 
models.ForeignKey(StudentsEnrollmentRecord, related_name='+', 
on_delete=models.CASCADE,blank=True,null=True)
Document_Requirements = models.IntegerField(null=True,blank=True)
Document = 
models.FileField(upload_to='files/%Y/%m/%d',null=True,blank=True)
Remarks = models.CharField(max_length=500,blank=True,null=True)
def __str__(self):
suser = '{0.Students_Enrollment_Records}'
return suser.format(self)

class StudentsEnrollmentRecord(models.Model):
Student_Users = models.ForeignKey(StudentProfile, 
related_name='students', on_delete=models.CASCADE,null=True)

How to save all in the database all the required documents that the user 
input?

**QUESTION UPDATED**
all documents that the students input, it will save in the database, in my 
case even the students input 4 documents only 1 documents save in the 
database

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b924250e-4ae6-450f-8f2c-05f5ed401068%40googlegroups.com.


Re: Fedora 30 server (Configuring Postgresql with Django)

2019-10-29 Thread Kevin Jay
I meant to type ‘harish.b’

On Tue, Oct 29, 2019 at 11:37 PM Kevin Jay  wrote:

> Does the user ‘garish.b’ have a system password?
>
> On Tue, Oct 29, 2019 at 10:38 PM hari49pf  wrote:
>
>> Hi sir,
>> I didn't understood, can u elaborate, I am new to django, Plz, help me
>> out.
>>
>> regards.
>> Harish.Bheemanpaly
>>
>> On Wednesday, October 30, 2019 at 1:21:50 AM UTC+5:30, sacrac wrote:
>>>
>>> Hi i see one error
>>> USERS is incorrect
>>> see the doc
>>> https://docs.djangoproject.com/en/2.2/ref/databases/#id12
>>>
>>> On Mon, Oct 28, 2019 at 11:15 PM Harish Bheemanpally 
>>> wrote:
>>>
>>
>>>> Hi,
>>>>
>>>> Please find the attachment, below are the screen shots of the setting &
>>>> DB permissions please help me
>>>>
>>>>
>>>> [image: Screenshot from 2019-10-29 10-40-47.png]
>>>>
>>>>
>>>> [image: Screenshot from 2019-10-29 10-40-40.png]
>>>>
>>>>
>>>> On Monday, October 28, 2019 at 7:57:47 PM UTC+5:30, sacrac wrote:
>>>>>
>>>>> You can show the settings and permissions of the DB, because the user
>>>>> harish.b and harishb are different!
>>>>>
>>>>> On Mon, Oct 28, 2019 at 5:00 AM Motaz Hejaze 
>>>>> wrote:
>>>>>
>>>>>> did you install all required packages for postgresql ?
>>>>>>
>>>>>>
>>>>>> On Mon, Oct 28, 2019 at 12:55 PM Harish Bheemanpally <
>>>>>> hari...@gmail.com> wrote:
>>>>>>
>>>>>>> Yes it was running perfectly in sqllie & Mysql. But in postgresql i
>>>>>>> am unable to configure Djanog
>>>>>>> the postger server screen shot
>>>>>>>
>>>>>>> please let me know for any information requried
>>>>>>>
>>>>>>>
>>>>>>> Postgresql image with djanog
>>>>>>>
>>>>>>> [image: Screenshot from 2019-10-28 10-28-38.png]
>>>>>>>
>>>>>>>
>>>>>>> On Monday, October 28, 2019 at 2:12:08 PM UTC+5:30, Motaz Hejaze
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Does it run on sqlite ??
>>>>>>>> You need to show the code
>>>>>>>>
>>>>>>>> On Mon, 28 Oct 2019, 8:10 am Harish Bheemanpally, <
>>>>>>>> hari...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> There is not user with harish in *DB*(postgresql)
>>>>>>>>>
>>>>>>>>> [image: Screenshot from 2019-10-28 16-20-04.png]
>>>>>>>>> the harish is the user of *OS*.
>>>>>>>>>
>>>>>>>>> As suggested by sacrac:
>>>>>>>>>
>>>>>>>>> I have created a new user in DB with the name harishb who is the
>>>>>>>>> owner of the DB and changed the setting.py still raising same error
>>>>>>>>> when i am trying to run migrate or run the django
>>>>>>>>>
>>>>>>>>> PLZ Help me.
>>>>>>>>>
>>>>>>>>> On Monday, October 28, 2019 at 9:04:03 AM UTC+5:30, sacrac wrote:
>>>>>>>>>>
>>>>>>>>>> Hi, Maybe you need change permission role user harish
>>>>>>>>>> #ALTER ROLE harish CREATEROLE CREATEDB; or SUPERUSER;
>>>>>>>>>>
>>>>>>>>>> On Sun, Oct 27, 2019 at 11:58 AM Harish Bheemanpally <
>>>>>>>>>> hari...@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> OS: Fedora30 server X64
>>>>>>>>>>> DB: Postgesql-12
>>>>>>>>>>> Django version:2.2.5
>>>>>>>>>>> connector: psycopg2.binary
>>>>>>>>>>>
>>>>>>>>>>> [image: Screenshot from 2019-10-27 13-20-35.png]
>>>>>>>>>>>
>>>>>>>>>>> i have configured the settings file in django folder, but unable
>>>>>>>>>>> to resolve t

Re: Fedora 30 server (Configuring Postgresql with Django)

2019-10-29 Thread Kevin Jay
Does the user ‘garish.b’ have a system password?

On Tue, Oct 29, 2019 at 10:38 PM hari49pf  wrote:

> Hi sir,
> I didn't understood, can u elaborate, I am new to django, Plz, help me out.
>
> regards.
> Harish.Bheemanpaly
>
> On Wednesday, October 30, 2019 at 1:21:50 AM UTC+5:30, sacrac wrote:
>>
>> Hi i see one error
>> USERS is incorrect
>> see the doc
>> https://docs.djangoproject.com/en/2.2/ref/databases/#id12
>>
>> On Mon, Oct 28, 2019 at 11:15 PM Harish Bheemanpally 
>> wrote:
>>
>
>>> Hi,
>>>
>>> Please find the attachment, below are the screen shots of the setting &
>>> DB permissions please help me
>>>
>>>
>>> [image: Screenshot from 2019-10-29 10-40-47.png]
>>>
>>>
>>> [image: Screenshot from 2019-10-29 10-40-40.png]
>>>
>>>
>>> On Monday, October 28, 2019 at 7:57:47 PM UTC+5:30, sacrac wrote:

 You can show the settings and permissions of the DB, because the user
 harish.b and harishb are different!

 On Mon, Oct 28, 2019 at 5:00 AM Motaz Hejaze  wrote:

> did you install all required packages for postgresql ?
>
>
> On Mon, Oct 28, 2019 at 12:55 PM Harish Bheemanpally <
> hari...@gmail.com> wrote:
>
>> Yes it was running perfectly in sqllie & Mysql. But in postgresql i
>> am unable to configure Djanog
>> the postger server screen shot
>>
>> please let me know for any information requried
>>
>>
>> Postgresql image with djanog
>>
>> [image: Screenshot from 2019-10-28 10-28-38.png]
>>
>>
>> On Monday, October 28, 2019 at 2:12:08 PM UTC+5:30, Motaz Hejaze
>> wrote:
>>>
>>> Does it run on sqlite ??
>>> You need to show the code
>>>
>>> On Mon, 28 Oct 2019, 8:10 am Harish Bheemanpally, 
>>> wrote:
>>>
 There is not user with harish in *DB*(postgresql)

 [image: Screenshot from 2019-10-28 16-20-04.png]
 the harish is the user of *OS*.

 As suggested by sacrac:

 I have created a new user in DB with the name harishb who is the
 owner of the DB and changed the setting.py still raising same error
 when i am trying to run migrate or run the django

 PLZ Help me.

 On Monday, October 28, 2019 at 9:04:03 AM UTC+5:30, sacrac wrote:
>
> Hi, Maybe you need change permission role user harish
> #ALTER ROLE harish CREATEROLE CREATEDB; or SUPERUSER;
>
> On Sun, Oct 27, 2019 at 11:58 AM Harish Bheemanpally <
> hari...@gmail.com> wrote:
>
>> OS: Fedora30 server X64
>> DB: Postgesql-12
>> Django version:2.2.5
>> connector: psycopg2.binary
>>
>> [image: Screenshot from 2019-10-27 13-20-35.png]
>>
>> i have configured the settings file in django folder, but unable
>> to resolve the issue,
>> need help.
>>
>> --
>> 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...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/d1eebb46-834f-4ee6-be50-7882ca72cbfd%40googlegroups.com
>> 
>> .
>>
>
>
> --
> att.
> Carlos Rocha
>
 --
 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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/3217ae2e-d0c7-4b6f-a06d-b1504ba29aa2%40googlegroups.com
 
 .

>>> --
>> 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...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/129de4f3-1957-4a5f-9a25-e65d29dbfdfa%40googlegroups.com
>> 
>> .
>>
> --
> 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...@googlegroups.com.

Re: Python +django

2019-09-13 Thread Kevin Jay
I also prefer text over video. However, Corey Schafer has an excellent
video series that is really well done. He doesn’t waste time babbling or
stumbling over words. He also provides a link to his github repo so you can
let ok over the code.


On Tue, Sep 10, 2019 at 8:19 PM 'Nicholas Hatch' via Django users <
django-users@googlegroups.com> wrote:

> If you are looking for books, any of the O’Reilly books are good. A
> worthwhile investment is an O’Reilly online subscription, which gives you
> access to all their books plus video tutorials, so you get the best of both
> worlds.
>
> For the price of three or four of their technical books, you get their
> full library, and if you really get into this, you’ll need to dive into
> many other topics anyway.
>
>
>
> Nicholas Hatch
>
>
> On Tue, Sep 10, 2019 at 1:03 PM, Gerardo Palazuelos Guerrero <
> gerardo.palazue...@gmail.com> wrote:
>
> hi,
> Django has been a different beast for me, an .NET programmer...
> You need to find your way...
>
> Following are my go-to resources, always:
> #1: (free) Djangogirls tutorial
> #2: (paid) the books by https://wsvincent.com/books/-- specially that
> book (green one) is an excellent resource for beginners
> #3: (free to read online) Harry Percival's
> https://www.obeythetestinggoat.com/
>
> Note:
> I'm not affiliated or anything with those sites... it's just that those
> materials are helpful for me and I keep mentioning those to folks
>
> --
> Gerardo Palazuelos Guerrero
>
>
>
> On Tue, Sep 10, 2019 at 7:25 AM Mario R. Osorio 
> wrote:
>
>> I must agree that video tutorials are harder to follow, specially if and
>> when they are if at least a bit outdated. I used to hate them however; I've
>> learned to appreciate them specially because of one reason: *YOU CANNOT
>> COPY AND PASTE.*
>>
>> Written tutorials don't help you go thru the full learning process and
>> make you a master of [Ctrl]-[C] & [Ctrl]-[V] since you're not even checking
>> the code nor make sense out of it, let alone memorizing it.
>>
>> Back in the day, when written tutorials were handed to you on paper,
>> probably as photocopy of some else's photocopy (bis), you would learn by
>> typing the code yourself. It is online tutorials that I find not as helpful
>> anymore.
>>
>> Now, don't get me wrong, I have found lost of excellent online tutorials.
>> The problem is that it is all too easy to copy and paste.
>>
>> IMHO (and at least in programming) written tutorials are for the very
>> first baby steps but once you've outpaced those; you need to move away from
>> them, even if we are talking about learning a new programming language,
>> tool, framework or paradigm.
>>
>>
>>
>> On Monday, September 9, 2019 at 7:59:07 AM UTC-4, ajoeiam wrote:
>>>
>>> On Mon, Sep 9, 2019 at 6:33 AM selim atmaca  wrote:
>>> >
>>> > You should learn python basics first but dont dive deep, just the
>>> basics. Then
>>> > There is a nice django video series on youtube. Search for corey
>>> schafer django. There are 17 videos in that series. If I was starting
>>> django today, definetly I would start it with that video series.
>>> >
>>> Hopefully this isn't a thread hijacking - - - - but - - - - -
>>> I am finding that online videos are hugely wasteful of time and would
>>> rather have a text equivalent.
>>> Is there such for this recommended video series?
>>>
>>> Regards
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/65360234-aaa6-4365-9e8e-fc6d8a3bc5f2%40googlegroups.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJ8iCyO7XsMj0JPd8Rj8-PXghPOaxoPnjNELr6e8J73wgvLCpA%40mail.gmail.com
> 
> .
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/P4PC8nOmfEd1JqWoqYlzVXO9qMS5Pne1LA1-wTlKy2cwoSlhD8wB28FIFg_bMwUkGVE249jJTynj_PBTqsxWaSudRTlG3FlDth8j-JCnfqE%3D%40thehatchcloud.org
> 

how can i update one model field and save that data into an other model

2019-09-06 Thread kevin irankunda
Hi i'm Kevin and i'm new in python and django

i want if one between student suggestion and staff suggestion's status == 
"approved"
that data to be sent in appointment model

my models are:

statuses=[
('accepted','Approve'),
('denied','deny'),
('canceled','cancel'),

]

class studentsuggestion(models.Model):
student = models.ForeignKey(student, default=None, on_delete=models.CASCADE)
lecture = models.ForeignKey(staffs, on_delete=models.CASCADE)
suggestion_date = models.DateField(default=None,blank=True)
suggestion_hour = models.TimeField(default=None,null=True, blank=True)
student_reason = models.TextField(max_length=1000, blank=True)
status = models.CharField(max_length=9, default=None, choices=statuses, 
null=True, blank=True)
suggested_date = models.DateTimeField(auto_now_add=True)

objects = studentsuggstmanager()
def __str__(self):
return self.student.user.username
def get_absolute_url(self):
return reverse('suggestion_detail', kwargs = {'pk':self.pk})

class staffsuggestion(models.Model):
auhtor = models.ForeignKey(staffs, related_name='stasuggestion', 
default=None, on_delete=models.CASCADE)
studentsuggestion = models.ForeignKey(studentsuggestion, default=None, 
on_delete=models.CASCADE)
suggestion_date = models.DateField(default=None,blank=True)
suggestion_hour = models.TimeField(default=None,null=True, blank=True)
end_time = models.TimeField(default=None,null=True, blank=True)
staff_reason = models.TextField(max_length=1000, blank=True)
status = models.CharField(max_length=9, default=None, choices=statuses, 
null=True, blank=True)
suggested_date = models.DateTimeField(auto_now_add=True) 
def __str__(self):
return self.studentsuggestion

class appointment(models.Model):
staffsuggestion = models.ForeignKey(staffsuggestion, default=None, 
null=True, on_delete=models.CASCADE)
studentsuggestion = models.ForeignKey(studentsuggestion, 
default=None,null=True, on_delete=models.CASCADE)
suggestion_date = models.DateField(default=None,blank=True)
suggestion_hour = models.TimeField(default=None,null=True, blank=True)
end_time = models.TimeField(default=None,null=True, blank=True)
reason = models.TextField(max_length=1000)
status = models.CharField(max_length=9, default=None, null=True, 
choices=statuses, blank=True)
requested_date = models.DateTimeField(auto_now_add=True)
def __str__(self):
if staffsuggestion is not None:
return self.staffsuggestion
else:
return self.studentsuggestion

my views.py

class studentsuggestionreact(UpdateView):
model = studentsuggestion
template_name = 'auth/mine/reaction.html'
fields = ['status']
def form_valid(self, form):
self.object = form.save(commit = False)
if self.object.status == 'approve':
studentsuggestion = self.object.student
suggestion_date = self.object.suggestion_date
suggestion_hour = self.object.suggestion_hour
reason = self.object.student_reason
status = self.object.status
get_values = appointment.objects.get_or_create( 
studentsuggestion=studentsuggestion,
suggestion_date=suggestion_date, 
suggestion_hour=suggestion_hour, reason=reason,
status=status).save()
get_values.save()
self.object.save()
return redirect("suggestion_list")

elif self.object.status == 'canceled':
self.object.save()
return redirect("suggestion_list")

elif self.object.status == 'denied':
self.object.save()
return redirect("suggestion_list")

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/295dc8e8-8393-46f1-b221-ea45f4fea32f%40googlegroups.com.


Re: CORS policy issue when using with JSON and DJANGO

2019-07-08 Thread Kevin McGraw
Consider you should not use absolute path in your request.  Place your file
in your static folder.  Request the file relative to this static location.
This would be similar to requesting other resources, such as css and js
files...like this:

{% load staticfiles i18n %}



or in javascript:
const data = "{% static 'js/yourfile.js' %}";

On Mon, Jul 8, 2019 at 12:51 PM Mayank Tripathi 
wrote:

> Hi Team,
>
> I am making quiz app, for which i wrote a function in view which will
> generate the json file and place it under the same location as of my all
> teamplates (C:/Desktop/Environment/envQuiz/quizsetup/templates/quizsetup)
> Now I am trying to read this json file in my HTML page via javascript
> file, and getting error as attached "Issue1.PNG".
>
> Please help... I also tried using header.. but no luck.
>
> Below is the js code i am using.
> 
> var requestURL =
> 'C:/Desktop/Environment/envQuiz/quizsetup/templates/quizsetup/json_data.json';
> let questions;
> let questionsCount;
> let currentQuestion;
> let score = 0;
>
> let question_title_elem = document.getElementById("title");
> let answers_elem = document.getElementById("answers");
> let action_btn = document.getElementById("action_btn");
>
> function getQuestions () {
> let request = new XMLHttpRequest();
> request.onreadystatechange = function () {
> if (this.readyState == 4 && this.status == 200) {
> questions = JSON.parse(this.responseText).questions;
> questionsCount = questions.length;
> currentQuestion = 0;
> }
> }
>
> /*json_data -- This is from view takeQuiz */
> request.open("GET", requestURL, false);
> request.send();
> 
> .
> ..
> .
> .
> .
> ...
> 
>
>
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/57fd8bf5-8056-4355-b1ec-77247445e48d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACHQt1e0rWpZuQ5cjM9P-q4wrmZFB_zFu9Xbzx1-CmFSZyiSVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Write urls without regex in DRF

2019-05-22 Thread Kevin Jay
kevin@kjay,net

On Wed, May 22, 2019 at 10:19 AM Rounak Jain  wrote:

>
> I am using DRF Viewsets to auto-generate URLs for different views. Is it
> possible to write the code below without using regex?
> Thanks
>
> from .views import TaskViewSet
> from rest_framework.routers import DefaultRouter
>
> router = DefaultRouter()
> router.register(r'', TaskViewSet, basename='task')
> urlpatterns = router.urls
>
>
>
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANNuxWNoPGePbAcxnWqzMgeioYXKXwD1Yn-H_2-FN774MdsbbQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANNuxWNoPGePbAcxnWqzMgeioYXKXwD1Yn-H_2-FN774MdsbbQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEtabwdw6%2BZofc4dLdHbvMM9nzdMc0Yd_uCqUnFNWAHE2wn9ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django wsgi apache Deploy project

2019-05-07 Thread Kevin Jay
Remove the spaces in the paths:
WSGIPythonPath / var / www / html / ecommerce /
should be
WSGIPythonPath  /var/www/html/ecommerce/

Do the same for the other paths

On Tue, May 7, 2019 at 8:57 AM N'BE SORO  wrote:

>
> Hi I'm a beginner in python and I realized a project in Django. I have
> problems in hosting my project. here is my code in the 000-default.conf
>  #ServerName #ServerAlias ServerAdmin webmaster @
> localhost DocumentRoot / var / www / html / ecommerce WSGIScriptAlias ​​/
> /var/www/html/ecommerce/ecommerce/wsgi.py WSGIPythonPath / var / www / html
> / ecommerce / ErrorLog $ {APACHE_LOG_DIR} /error.log CustomLog $
> {APACHE_LOG_DIR} /access.log combined  and I have this error
> Invalid command 'WSGIScriptAlias / /var / www / html / ecommerce /
> ecommerce / wsgi.py ', perhaps misspelled or d efined by a module not
> included in the server configuration
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1912bcdc-cb2f-45a2-932c-d579eb944c0a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEtabwdEQtikBmkrpvpFLJ0oHY%3DfWJhSm5VLGBU7yxwYWq_b2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread Kevin Jay
You are correct.
Django creates a primary key of 'id' for each table as an integer by
default. So foreignkey will reference that primary key which by default is
an integer.
If the primary key is changed to some other type, Django can still handle
it.
Apparently using integers is the more efficient method.

On Mon, May 6, 2019 at 12:54 PM Matthew Pava  wrote:

> Well, I had always assumed that they do need to be integers, but it looks
> like this has been discussed at length.
>
> https://groups.google.com/forum/#!topic/django-users/0utRzn98Wxo
>
>
>
> It does seem clear, though, that the superior database design uses
> integers for ForeignKeys.
>
> And I didn’t find a way to make it clear to Django not to use an Integer
> ForeignKey.  Maybe something to do with the primary_key attribute on a
> CharField?
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *b...@tanners.org
> *Sent:* Monday, May 6, 2019 12:44 PM
> *To:* Django users
> *Subject:* Re: ORM help with INNER JOIN and GROUP BY
>
>
>
> Just want to make sure I understand. ForeighKeys need to be integers?
>
>
>
> Only integers?
>
>
>
>
>
> You need a ForeignKey relationship between the two models, which is an
> integer value, not a char. You’d have to do migrations to get this adjusted
> properly.
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9697de34-3d20-4023-81a7-8ea9f257f7f1%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/27eee43ff8024c98bcf9a5e9cd4bfd89%40iss2.ISS.LOCAL
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEtabwdPi16kCzZAx6btpyRFGVn0JyaXGjL%2Bw8JTj2u6pHZxBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread Kevin Jay
 Maybe that was a typo?
The foreignkey relationship would look like this:
object = models.ForeignKey(FacePng'', max_length=128, blank=False,
null=False, unique=True)

On Mon, May 6, 2019 at 12:44 PM  wrote:

> Just want to make sure I understand. ForeighKeys need to be integers?
>
> Only integers?
>
>
> You need a ForeignKey relationship between the two models, which is an
>> integer value, not a char. You’d have to do migrations to get this adjusted
>> properly.
>>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9697de34-3d20-4023-81a7-8ea9f257f7f1%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEtabwfknJFSeHiYLcLdQ6-0soywHaHwsPz8SLm_T24tbT0Hpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread Kevin Jay
The field within your class should be set to ForeignKey.


Try this:
Object = models.ForeignKey(‘FacePng’, on_delete=SET_NULL, max_length= some_int)

on_delete and max_length need to be set based on your requirements 

Sent from my iPhone

> On May 6, 2019, at 11:28 AM, b...@tanners.org wrote:
> 
> I've inherited an application written django 1.11. The old application uses 
> raw() with INNER JOIN and GROUP BY. 
>  I cannot seem to figure out how to do inner join and group by properly the 
> ORM way.
> 
> The raw() query is below.
> 
> SELECT  * FROM items_monolithic
> INNER JOIN items_facepng
> ON items_monolithic.object == items_facepng.obj
> GROUP BY items_monolithic.object
> ORDER BY object ASC
> 
> 
> Things kind of work with raw() but that doesn't feel right. And I get nasty 
> warnings about RawQuerySet not supporting certain things when I try to use 
> the query set that is returned.
> 
> From what I understand every monolithic object has 1 or more faces 
> (graphic/picture).
> 
> I would call the monolithic a one-to-many relationship with facepng but I see 
> django calls this a ForeignKey.
> 
> I'm working with these models (yes, a field named object is "bad", it's what 
> I was given)
> 
> 
> class Monolithic(models.Model):
> object = models.CharField(max_length=128, blank=False, null=False, 
> unique=True)
> 
> class FacePng(models.Model):
> obj = models.CharField(max_length=128, blank=True, null=True)
> 
> 
> I do not see the ForeignKey relationship between Monolithic and FacePng. 
> 
> Changing Monolithic class to models.ForeignKey() breaks lots of things.
> 
> So I'd prefer to figure out how to do the inner join and group by query but 
> if that's not the django way and I need to change Monolithic.objects to a 
> ForeignKey() and fix all the stuff that is broken I can do that that too. 
> 
> Just need some guidance on how to proceed.
> 
> 
> 
> -- 
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/ab7ecf5b-9ae8-4428-9502-6b7d5dec03b5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/D5B5695B-D057-4D4D-8F53-2BAF1D6B666A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Issues with editing Django files?

2019-04-30 Thread Kevin Weinberg
Awesome, thank you very much!

On Sat, Apr 27, 2019 at 4:19 PM André Toscano 
wrote:

> Hi Kevin,
> You shouldn't put your files inside the Program Files directory, it's
> protected by the system. Instead, you should create a directory (my
> suggestion) 'git' in your user's directory.
> Inside this directory you should create the directory that will organize
> your code.
> After that you need to create a virtualenv and installl all Python
> packages required in the virtual environment.
> Most Python IDE (WingIDE, VS Code, PyCharm, Eclipse, etc) supports virtual
> environments.
> On Windows you have different options to install Python (Direct, Anaconda,
> CygWin, etc) and create the virtual, the best would be to use a Linux or
> Unix based system. Consider a virtual machine on VirtualBox with a linux
> distribution.
> Even if you are able to run as admin, you could create security issues.
> Regards
> André
>
> Ps.: Here there is a good reference on how to setup the system to develop
> with Django: https://tutorial.djangogirls.org/en/django_installation/
>
>
>
>
>
> Em ter, 23 de abr de 2019 às 09:13, Outomyelement <
> kweinberg.ba...@gmail.com> escreveu:
>
>> I'm new to Python and am working through the Crash Course for Python book
>> using Windows 10 and the latest version of Python and Django.
>>
>> I am trying to edit the models.py file, but i get a permissions denied:
>>
>>
>> [image: Capture.PNG]
>>
>> I am learning on a company computer, i'm wondering if my user permissions
>> are an issue? Given i'm not an admin for my computer, am I going to have an
>> issue trying to save files in these folders without some admin access? I am
>> able to run the cmd as admin?
>>
>> Thank you,
>>
>> Kevin
>>
>> --
>> 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 group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/97307eae-7819-445d-bc9d-4b350a8fbafe%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/97307eae-7819-445d-bc9d-4b350a8fbafe%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/ZZOnhbSWbEQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPrw5MG7f3umJ2ipeSYnG6r8%3DqkDBbMseWaK8dSy%3DnM9PLPbnQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPrw5MG7f3umJ2ipeSYnG6r8%3DqkDBbMseWaK8dSy%3DnM9PLPbnQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFh_u0vPyjaySD4J6MvFyUYdd-JZ2m3UpBNLvuuOEBhQx3n0WA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Custom forms in Django admin?

2019-04-08 Thread Kevin Olbrich
Hi!

Is it possible to add a form to the Django admin?
Models are no problem but I have a slightly more complex requirement (still 
less than a full view with templates, etc.).

Kind regards
Kevin

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3149d2b3-751f-4287-addb-34127e918564%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: BaseModelFormSet > _construct_form

2019-04-02 Thread Kevin Jay
ke...@kjay.net

On Tue, Apr 2, 2019 at 4:12 PM nikolaysm  wrote:

> Hello,
>
> In function _construct_form variable "pk_key" is generated as:
>  pk_key = "%s-%s" % (self.add_prefix (i), self.model._meta.pk.name) "
>
> So pk_key is not flexible. Because if I overwrite function "add_prefix"
> from class "forms.ModelForm", I get error "MultiValueDictKeyError".
>
> My add_prefix function:
> def add_prefix(self, field_name):
>   return '%s_%s' % (self.prefix, field_name) if self.prefix else
> field_name
>
>
> I see a possibility to solve that for now. Overwrite function
> _construct_form.
>
> Other options?
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/92616dd1-1e04-43f6-9e91-edfc56dfe5bc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEtabwdvYoD4ypvo%3D3_14M%2BbvOHZoYTtAMNxfs0JcJfs-o1_dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using signals to populate another model based on new registered user

2019-03-10 Thread Kevin Jay
Disregard...Wrong thread.

On Sun, Mar 10, 2019 at 2:47 PM Kevin Jay  wrote:

>
> Here is the relevant template from the link provided
>
>>
>>1. 
>>2. 
>>3. 
>>4. 
>>5. Employee Records
>>6.  {% load staticfiles %}
>>7. 
>>8. 
>>9. 
>>10. 
>>11. 
>>12. 
>>13. Employee ID
>>14. Employee Name
>>15. Employee Email
>>16. Employee Contact
>>17. Actions
>>18. 
>>19. 
>>20. 
>>21. {% for employee in employees %}
>>22. 
>>23. {{ employee.eid }}
>>24. {{ employee.ename }}
>>25. {{ employee.eemail }}
>>26. {{ employee.econtact }}
>>27. 
>>28. >"glyphicon glyphicon-pencil" >Edit
>>29. Delete
>>30. 
>>31. 
>>32. {% endfor %}
>>33. 
>>34. 
>>35. 
>>36. 
>>37. >>Add New Record
>>38. 
>>39. 
>>
>>
>>>
> On Sun, Mar 10, 2019 at 10:06 AM Deepak sharma 
> wrote:
>
>> Simple Answer: DON'T . Resort to signals only when there is No
>> Alternatives left.
>> Using Signals looks tempting but as project grows, it really becomes a
>> Mess to manage each of them. One simply becomes a confused and debugging
>> becomes a real Hell.
>>
>> I suffered from this Problem. hence recommends to Use them as last
>> resort.
>>
>>
>>
>>
>> On Saturday, March 9, 2019 at 8:14:47 PM UTC+5:30, GavinB841 wrote:
>>>
>>> Hi all,
>>>
>>> I am new to working with signals and triggers, what I am trying to
>>> accomplish is:
>>>
>>>1. When a new user registers, I have another model to deal with
>>>subscriptions.
>>>2. I want to create an instance for that subscription model with all
>>>the default values based on the new user.
>>>3. Otherwise no object is created in this model and it has to be
>>>done via a form.
>>>
>>> Would appreciate any help and if any other code is needed let me know.
>>>
>>> *See code below:*
>>>
>>> *Form part of user registration:*
>>>
>>> class ClubInfoForm(forms.ModelForm):
>>> club_address2 = forms.CharField(required=False)
>>> club_address3 = forms.CharField(required=False)
>>>
>>> class Meta():
>>> model = ClubInfo
>>> fields = ('club_name', 'club_logo', 'club_address1', 
>>> 'club_address2',
>>>   'club_address3', 'club_town', 'club_county', 
>>> 'club_country',)
>>>
>>> def clean_club_name(self):
>>> club_name = self.cleaned_data['club_name']
>>> if ClubInfo.objects.filter(club_name=club_name).exists():
>>> raise ValidationError(_("Club already exists"))
>>> return club_name
>>>
>>> *Views for registration:*
>>>
>>> def register(request):
>>> registered = False
>>> if request.method == 'POST':
>>> user_form = UserForm(data=request.POST)
>>> profile_form = ClubInfoForm(data=request.POST)
>>> if user_form.is_valid() and profile_form.is_valid():
>>> user = user_form.save()
>>> user.set_password(user.password)
>>> user.save()
>>> profile = profile_form.save(commit=False)
>>> profile.user = user
>>> if 'profile_pic' in request.FILES:
>>> print('found it')
>>> profile.profile_pic = request.FILES['profile_pic']
>>> profile.save()
>>> registered = True
>>> else:
>>> print(user_form.errors, profile_form.errors)
>>> else:
>>> user_form = UserForm()
>>> profile_form = ClubInfoForm()
>>> return render(request,
>>>   'registration.html',
>>>   {'user_form': user_form,
>>>'profile_form': profile_form,
>>>'registered': registered})
>>>
>>>
>>> *Models for club info used upon registration and the model I want to
>>> update when a

Re: Using signals to populate another model based on new registered user

2019-03-10 Thread Kevin Jay
Here is the relevant template from the link provided

>
>1. 
>2. 
>3. 
>4. 
>5. Employee Records
>6.  {% load staticfiles %}
>7. 
>8. 
>9. 
>10. 
>11. 
>12. 
>13. Employee ID
>14. Employee Name
>15. Employee Email
>16. Employee Contact
>17. Actions
>18. 
>19. 
>20. 
>21. {% for employee in employees %}
>22. 
>23. {{ employee.eid }}
>24. {{ employee.ename }}
>25. {{ employee.eemail }}
>26. {{ employee.econtact }}
>27. 
>28. "glyphicon glyphicon-pencil" >Edit
>29. Delete
>30. 
>31. 
>32. {% endfor %}
>33. 
>34. 
>35. 
>36. 
>37. >Add New Record
>38. 
>39. 
>
>
>>
On Sun, Mar 10, 2019 at 10:06 AM Deepak sharma  wrote:

> Simple Answer: DON'T . Resort to signals only when there is No
> Alternatives left.
> Using Signals looks tempting but as project grows, it really becomes a
> Mess to manage each of them. One simply becomes a confused and debugging
> becomes a real Hell.
>
> I suffered from this Problem. hence recommends to Use them as last resort.
>
>
>
>
> On Saturday, March 9, 2019 at 8:14:47 PM UTC+5:30, GavinB841 wrote:
>>
>> Hi all,
>>
>> I am new to working with signals and triggers, what I am trying to
>> accomplish is:
>>
>>1. When a new user registers, I have another model to deal with
>>subscriptions.
>>2. I want to create an instance for that subscription model with all
>>the default values based on the new user.
>>3. Otherwise no object is created in this model and it has to be done
>>via a form.
>>
>> Would appreciate any help and if any other code is needed let me know.
>>
>> *See code below:*
>>
>> *Form part of user registration:*
>>
>> class ClubInfoForm(forms.ModelForm):
>> club_address2 = forms.CharField(required=False)
>> club_address3 = forms.CharField(required=False)
>>
>> class Meta():
>> model = ClubInfo
>> fields = ('club_name', 'club_logo', 'club_address1', 'club_address2',
>>   'club_address3', 'club_town', 'club_county', 
>> 'club_country',)
>>
>> def clean_club_name(self):
>> club_name = self.cleaned_data['club_name']
>> if ClubInfo.objects.filter(club_name=club_name).exists():
>> raise ValidationError(_("Club already exists"))
>> return club_name
>>
>> *Views for registration:*
>>
>> def register(request):
>> registered = False
>> if request.method == 'POST':
>> user_form = UserForm(data=request.POST)
>> profile_form = ClubInfoForm(data=request.POST)
>> if user_form.is_valid() and profile_form.is_valid():
>> user = user_form.save()
>> user.set_password(user.password)
>> user.save()
>> profile = profile_form.save(commit=False)
>> profile.user = user
>> if 'profile_pic' in request.FILES:
>> print('found it')
>> profile.profile_pic = request.FILES['profile_pic']
>> profile.save()
>> registered = True
>> else:
>> print(user_form.errors, profile_form.errors)
>> else:
>> user_form = UserForm()
>> profile_form = ClubInfoForm()
>> return render(request,
>>   'registration.html',
>>   {'user_form': user_form,
>>'profile_form': profile_form,
>>'registered': registered})
>>
>>
>> *Models for club info used upon registration and the model I want to
>> update when a new user is created:*
>>
>> class ClubInfo(models.Model):
>>
>> user = models.OneToOneField(User, on_delete=models.CASCADE)
>> club_name = models.CharField(max_length=50, default='', unique=True)
>> club_logo = models.ImageField(upload_to='profile_pics', blank=True)
>> club_address1 = models.CharField(max_length=30)
>> club_address2 = models.CharField(max_length=30, default='')
>> club_address3 = models.CharField(max_length=30, default='')
>> club_town = models.CharField(max_length=30)
>> club_county = models.CharField(max_length=30)
>> club_country = models.CharField(max_length=30)
>> created_date = models.DateTimeField(default=timezone.now)
>>
>> def set_default_packages(sender, **kwargs):
>> if kwargs['created']:
>> ClubPackages.objects.create(club_id=kwargs['instance'])
>>
>> post_save.connect(set_default_packages, sender=club_name)
>>
>> def __str__(self):
>> return self.club_name
>>
>>
>> class ClubPackages(models.Model):
>>
>> club_id = models.ForeignKey(ClubInfo, on_delete=models.CASCADE)
>> PACKAGE_STATUS = (
>> ('0', 'Active'),
>> ('1', 'Not Active')
>> )
>> player_register_package = 

Django 1.11.19 .whl failing with error

2019-02-11 Thread Kevin Carrogan
The Django 1.11.19 .whl release file appears to erroneously contain a file 
that appears to be from the 2.x release (it contains Py3 only code).

The file in question is django.contrib.admin.templatetags.base which 
shouldn't exist in the 1.11.19 release.

This file doesn't appear to exist in the .tar.gz file.

I'm downloading from https://pypi.org/project/Django/1.11.19/#files and the 
link for the bad .whl 
is 
https://files.pythonhosted.org/packages/6b/2a/6625366e0e26fcc638c76d1a8b63d8d24a99d129cfebf8b101aaab0327fd/Django-1.11.19-py2.py3-none-any.whl

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/50d61d22-0601-49a5-857a-5dd3db8ea90a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Logging of full trace with Debug set to False

2019-01-29 Thread Kevin Olbrich
Hi!

Seems like things were improved since then:
https://docs.sentry.io/platforms/python/celery/

There is an integration that I can enable which should take care of things.

I realy like Sentry. Currently I use the free tier while I check how to 
setup my own node.
Some of my Apps already send Exceptions (broke some things to test it).

Thanks for the hint to this excellent tool!

Kevin

Am Montag, 28. Januar 2019 13:55:29 UTC+1 schrieb Michal Petrucha:
>
> -BEGIN PGP SIGNED MESSAGE- 
> Hash: SHA512 
>
> On Mon, Jan 28, 2019 at 04:45:44AM -0800, Kevin Olbrich wrote: 
> > Hi Anirudh, 
> > 
> > I am using uWSGI and not Gunicorn. At least for uWSGI, with Debug = 
> False, 
> > it only logs the HTTP status code but not exception (might be the same 
> with 
> > Gunicorn). 
> > I will try Sentry which provides a clean GUI and notification of new 
> > problems. This also seems to work for my Celery tasks and Django admin 
> > commands. 
>
> Since you're mentioning Celery, I thought it might be worth mentioning 
> that Celery performs some black magic ritual on the Python logging 
> config in its default configuration, which interferes with the way 
> Sentry handles errors – or at least that's been my experience. At one 
> point I noticed that errors happening inside Celery tasks didn't have 
> all the stack values, like ones from the regular request/response had. 
> I don't remember exactly how, and I don't have access to that code 
> base anymore, but I remember that we had to explicitly disable as much 
> of Celery's custom logging as we could in order to get that to work. 
> (Might be that things have improved since then, though.) 
>
> Good luck, 
>
> Michal 
> -BEGIN PGP SIGNATURE- 
> Version: GnuPG v1 
>
> iQIcBAEBCgAGBQJcTvuFAAoJEHA7T/IPM/kltD8P/0MfET5/KylfZM/BWHDz4+vn 
> 8U7hr4Zraz5R+zzr4yq7Ow0tom4zWE0EqpYREv87A4tX7dHGITTQLbU+bCce/MNQ 
> tIVD2D498XsEBGRsNav0kOr6ATuWoPuJlLLSFYGbGHedCKz6UB+ftmwYhL7WOQgr 
> zE8LeLS37jbm02/z6DD25intYUpRbKeeSRjyqkc+6esUz2IAXVQQ1NcUtJjPbmvi 
> zJtyWUX/RXS3Wulrp8lwLJ7rThcFAh3wVmC/nJCHeBQFLDmmLZx08EEnV1w7uxwv 
> AcowzfrGPOYv7VcOK9K9KvUPCrIj3KovU4DPlffuX6xxy8FZTvIyDptJAaMnh9C+ 
> i8So48kPL1TxBk1lPuWx8TLr+RR1y4LIy7KVwMgRyeFC5zGIdBiAFIwo9X5utdc9 
> 1uuO07bGn9224vpk87zyizA8Q88Qeee7kco+a0v0f8+Xxz6oAKg9uf3broJ9nl99 
> jp6Pp9QTzlpYFnw0bjMDMI3KRLkAxbWmeuGtBt7tELKFfHoae3RtfCqNitvEhN07 
> rz44xC2dbwPvQdV2UMElX+jS9omk+8oEwgMNvOPXyAsf3NexwcuN0lzoo5MS2OpY 
> kkwbNCD0aeHtreY5BJrXgONmXd58OswZhsCbcvZXqhIJ1MxreCzasXVvF7ZNHp6z 
> daRHSphHWV6/sDLFFfGw 
> =6WLZ 
> -END PGP SIGNATURE- 
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bac79f70-487f-45dd-9d66-c9f397cb3785%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Logging of full trace with Debug set to False

2019-01-28 Thread Kevin Olbrich
Hi Anirudh,

I am using uWSGI and not Gunicorn. At least for uWSGI, with Debug = False, 
it only logs the HTTP status code but not exception (might be the same with 
Gunicorn).
I will try Sentry which provides a clean GUI and notification of new 
problems. This also seems to work for my Celery tasks and Django admin 
commands.

Thank you very much for your reply!

Kevin

Am Montag, 28. Januar 2019 13:25:17 UTC+1 schrieb Anirudh Jain:
>
> You  can setup a logging and debugging logging system using gunicorn in 
> production using flags :-
>
> --log-level debug
> --access-logfile /home/ubuntu/websitelogs.log
>
> For more setting options read gunicorn documentation 
>
> https://docs.gunicorn.org/en/stable/settings.html#logging
>
> On Mon, 28 Jan 2019, 16:50 Michal Petrucha   wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA512
>>
>> On Mon, Jan 28, 2019 at 02:53:55AM -0800, Kevin Olbrich wrote:
>> > Hi!
>> > 
>> > I would like to catch and send all exceptions to a logging system.
>> > When Debug is set to False, all debug related information is lost (just 
>> a 
>> > HTTP 500 error message).
>> > 
>> > While Debug False works perfectly in production, I would like to log 
>> and 
>> > send the exceptions to a backend, where I can save them.
>> > This would allow me to fix bugs, that only occur once every month 
>> (because 
>> > nobody is able to reproduce).
>> > 
>> > Similar approach was the case with Testflight on iOS, where I got a 
>> message 
>> > for every App-crash.
>> > 
>> > How can I handle this?
>> > 
>> > Kind regards
>> > Kevin
>>
>> Hi Kevin,
>>
>> You can set up your backend logging to send logs to Sentry [1], for
>> example. You can either set up your own Sentry instance, or use the
>> commercial offering [2]. If you set up sentry as one of the default
>> logging handlers, it will catch all unhandled exceptions, and you'll
>> get a fancy stack trace for each, including the values of local
>> variables in each stack frame.
>>
>> Cheers,
>>
>> Michal
>>
>>
>> [1]: https://github.com/getsentry/sentry
>> [2]: https://sentry.io/
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1
>>
>> iQIcBAEBCgAGBQJcTuVkAAoJEHA7T/IPM/kl5skQAOVvT+gu33Cn9YuM5152LaN/
>> hO8jQ5qC85k62+Z+3ptx8xsLOSPpbivdrAWOEW2asgRUFpSzdvsvDpF5ARWUlO9D
>> 3s7bTfNqnPATDjEdiBep4ZQd5eWtkw7aMhHOS6gnwl60zEqlH62MIqOj9NFRL5YV
>> MMsCTAnqcB2IqXsiGmpxUvc5c20WHac4ODwOkOBAY4CPd1O6s1bf44LtD2bTaJTR
>> py7KvwKJ+4wkhM89cjnP5etIhdsnPbv+hKry40rji/J/k8VAz2w702jnRc5W6a8d
>> mPlBYfdZS/tfnNDx+TO+fKgwny1xrrE55vXabVgyt3nQF+KQluf2Zw2Q4HzDhhZ+
>> 6L0QU2xR+EzFHsXCdhUAVF9+0h6guJzNQ7qsSz9KlZoGB5a2Jdk8Q4ji/RBVaORx
>> GEZpRw/VWTn7/mLvCdOxOH8J/IMf9avyEm+CK8K23BMFqO7ydmtUIboN/MVQ1UJA
>> 4Xjp3vm1zB5hcaS9AjAJ5/vn9ySPjE9deoBxqUuN7I30Vug/EqqDhBhqOCiiwp4p
>> V6OwPMqhhZig3cvmigvwhZoT+WXUQwrGAGodleBon8ajIUcB1dxyxbPnbeIzSKPg
>> 9lNot8WLlQEwYN7HWVQRMTc0NtLRg4YTI7UZWcwAneznxrCwKyzdQV3PhiN5A1Kh
>> VRcuK/Cf70seqQEarfXL
>> =HFoa
>> -END PGP SIGNATURE-
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/20190128112004.GD10973%40konk.org
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9c197ce1-54d1-4291-9cc4-22b3cb5b58fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Logging of full trace with Debug set to False

2019-01-28 Thread Kevin Olbrich
Hi Michal,

looks very promissing. I read the SDK guide for Django and I realy like it.
Thank you!

Kevin

Am Montag, 28. Januar 2019 12:20:35 UTC+1 schrieb Michal Petrucha:
>
> -BEGIN PGP SIGNED MESSAGE- 
> Hash: SHA512 
>
> On Mon, Jan 28, 2019 at 02:53:55AM -0800, Kevin Olbrich wrote: 
> > Hi! 
> > 
> > I would like to catch and send all exceptions to a logging system. 
> > When Debug is set to False, all debug related information is lost (just 
> a 
> > HTTP 500 error message). 
> > 
> > While Debug False works perfectly in production, I would like to log and 
> > send the exceptions to a backend, where I can save them. 
> > This would allow me to fix bugs, that only occur once every month 
> (because 
> > nobody is able to reproduce). 
> > 
> > Similar approach was the case with Testflight on iOS, where I got a 
> message 
> > for every App-crash. 
> > 
> > How can I handle this? 
> > 
> > Kind regards 
> > Kevin 
>
> Hi Kevin, 
>
> You can set up your backend logging to send logs to Sentry [1], for 
> example. You can either set up your own Sentry instance, or use the 
> commercial offering [2]. If you set up sentry as one of the default 
> logging handlers, it will catch all unhandled exceptions, and you'll 
> get a fancy stack trace for each, including the values of local 
> variables in each stack frame. 
>
> Cheers, 
>
> Michal 
>
>
> [1]: https://github.com/getsentry/sentry 
> [2]: https://sentry.io/ 
> -BEGIN PGP SIGNATURE- 
> Version: GnuPG v1 
>
> iQIcBAEBCgAGBQJcTuVkAAoJEHA7T/IPM/kl5skQAOVvT+gu33Cn9YuM5152LaN/ 
> hO8jQ5qC85k62+Z+3ptx8xsLOSPpbivdrAWOEW2asgRUFpSzdvsvDpF5ARWUlO9D 
> 3s7bTfNqnPATDjEdiBep4ZQd5eWtkw7aMhHOS6gnwl60zEqlH62MIqOj9NFRL5YV 
> MMsCTAnqcB2IqXsiGmpxUvc5c20WHac4ODwOkOBAY4CPd1O6s1bf44LtD2bTaJTR 
> py7KvwKJ+4wkhM89cjnP5etIhdsnPbv+hKry40rji/J/k8VAz2w702jnRc5W6a8d 
> mPlBYfdZS/tfnNDx+TO+fKgwny1xrrE55vXabVgyt3nQF+KQluf2Zw2Q4HzDhhZ+ 
> 6L0QU2xR+EzFHsXCdhUAVF9+0h6guJzNQ7qsSz9KlZoGB5a2Jdk8Q4ji/RBVaORx 
> GEZpRw/VWTn7/mLvCdOxOH8J/IMf9avyEm+CK8K23BMFqO7ydmtUIboN/MVQ1UJA 
> 4Xjp3vm1zB5hcaS9AjAJ5/vn9ySPjE9deoBxqUuN7I30Vug/EqqDhBhqOCiiwp4p 
> V6OwPMqhhZig3cvmigvwhZoT+WXUQwrGAGodleBon8ajIUcB1dxyxbPnbeIzSKPg 
> 9lNot8WLlQEwYN7HWVQRMTc0NtLRg4YTI7UZWcwAneznxrCwKyzdQV3PhiN5A1Kh 
> VRcuK/Cf70seqQEarfXL 
> =HFoa 
> -END PGP SIGNATURE- 
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ab6a1998-b9ac-4dbb-adac-76aa4b3c7855%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding default rows to Django admin inlines

2019-01-28 Thread Kevin Olbrich
Hi!

Maybe I did not fully understand but it seems we indeed don't talk about 
the same.
I already got M2M relation.
If I access the "Jobs" admin-page, I have the option to add inline-options.
On a new object, there are no lines but I can add new.
I would like to add lines for the attributes from M2M relation of (Actions 
-> Attributes).
Every action has a different set of attributes that needs to be defined. If 
I open the admin page for Jobs, it would need to refresh (or AJAX) the form 
to display the correct default set of attributes in the inline area, as 
soon as I choose / change the Action type.

Pseudo: With HTML and JS I would listen for a change event, then AJAX an 
API for the attributes. Then I would clear the inline-area and add new rows 
for each mandatory attribute.

I wonder if this is possible with Django alone, without building a view.

Kind regards
Kevin


Am Samstag, 19. Januar 2019 21:47:45 UTC+1 schrieb Mohammad Etemaddar:
>
> If I get you right you need to add m2m objects with a default value.
> In this situation, you can create an intermediate model to build m2m.
> For example:
> JobActionRel:
> job = fk
> action = fk-to-actions (default=Action.objects.get...)
>
> And use it as through model:
>
> https://docs.djangoproject.com/en/2.1/topics/db/models/#extra-fields-on-many-to-many-relationships
>
> Now, in admin you see the default action.
> Remember, before making it through, create JobActionRels from previous m2m 
> objects.
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/871c12e5-909e-49ab-9f33-a480607e6490%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Logging of full trace with Debug set to False

2019-01-28 Thread Kevin Olbrich
Hi!

I would like to catch and send all exceptions to a logging system.
When Debug is set to False, all debug related information is lost (just a 
HTTP 500 error message).

While Debug False works perfectly in production, I would like to log and 
send the exceptions to a backend, where I can save them.
This would allow me to fix bugs, that only occur once every month (because 
nobody is able to reproduce).

Similar approach was the case with Testflight on iOS, where I got a message 
for every App-crash.

How can I handle this?

Kind regards
Kevin

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d10c100-6674-491d-b88f-2a1f2d92fcbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Disable autoescape globally

2019-01-21 Thread Kevin Olbrich
Hi!

I am using the template engine to build e-mail templates but the autoescape 
function breaks quotes.
Is it possible to disable autoescape globally or in the render function 
using a parameter?

Thank you.

Kevin

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f1a796fc-6c64-4594-bd46-434665525198%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Adding default rows to Django admin inlines

2019-01-18 Thread Kevin Olbrich
Hi!

I have a question regarding inlines in the Django admin interface.

Currently there are following models:
Jobs - holds the Job-ID, an action (FK JobActions) and execution status
JobActions - holds a list of possible actions (like "create a new 
customer") [Also has a ManyToMany against JobAttributes - see below]
JobAttributes - A list of attributes that are possible
JobOptions - values for attributes (FK JobAttributes) for a job (FK Jobs)
JobLog - unlimited rows of text-logs (in this case, API dumps), FK Jobs 
(not of interest here)

An action can be "add new customer". This action needs an attribute 
"customer name".

This scenario works perfectly, I can create new Jobs that have attributes 
but I need to add new lines in the inline part of the admin form.
I have added a ManyToMany-field from JobActions to JobAttributes. This 
gives me a list which action needs which attribute in JobAttributes.

Is it possbile to pre-fill the inline-part of the form with the attributes? 
This would be much easier for input.
Currently there are no rows, I need to add a new line and choose the 
attribute for which I would like to add a value.

*Think of it like a dynamic (support) contact form where you get different 
inputs if you choose a different topic.*

Is this possible with the admin? The relation (which JobActions needs which 
JobAttributes) is available.

Thank you very much.

Kevin

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/228a7f0e-e492-41b1-bc44-04cdff63127b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best Learning Resources

2019-01-17 Thread kevin goemaere
I learned the basics through this 
course: https://www.udemy.com/python-django-dev-to-deployment/
It's verry wel structured and you make a whole project and see all the 
basics of Django.



Op woensdag 16 januari 2019 14:20:15 UTC+1 schreef cale...@gmail.com:
>
> Hi All,
>
> I'm just starting out with Django and python and wondering if anyone can 
> direct me to some goto learning resources. Beginner to Advanced
>
> Thanks
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8efde3a4-c898-4634-8453-76e52e7e829b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


External DB layout, two column as PK, modification not possible

2018-08-01 Thread Kevin Olbrich
Hi!

I got the following table definition on inspect db:

class KevinExample(models.Model):

*code = models.CharField(db_column='Code', primary_key=True, 
max_length=50)  # Field name made lowercase.lineid = 
models.IntegerField(db_column='LineId')  # Field name made lowercase.*
object = models.CharField(db_column='Object', max_length=20, 
blank=True, null=True)  # Field name made lowercase.
loginst = models.IntegerField(db_column='LogInst', blank=True, 
null=True)  # Field name made lowercase.
u_contrattr = models.ForeignKey('KevinExpAttr', models.DO_NOTHING, 
db_column='U_contrattr', max_length=50, blank=True, null=True)  # Field 
name made lowercase.
u_attrlinedata = models.CharField(db_column='U_attrlinedata', 
max_length=50)  # Field name made lowercase.
class Meta:
managed = False
db_table = '@KEVIN_EXAMPLE'
*unique_together = (('code', 'lineid'),)*


Inserting new rows by using the constructor and force_insert works fine but 
refresh_from_db() as well as save() is not possible (duplicate key 
constraint).
Problem is, code + lineid is PK and I have to keep it like this (foreign 
table).

Is there a workaround for this? Is it still impossible to define such PK on 
latest Django?

Kind regards
Kevin

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/857e15d5-e46b-4f1e-b1f3-e5c24b1f3bd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Broken?

2018-05-01 Thread Kevin O'Gorman
It is indeed a string.  The string happens to represent an integer, a key 
of an item in another table.  It is not an external reference because there 
are dated versions of the table and the referent may or may not exist in 
any one of them.  It existed in the table in use at the time the record was 
created and needs to be preserved.

On Sunday, April 29, 2018 at 9:03:07 PM UTC-7, George Lubaretsi wrote:
>
>  File "/raid3/build/comprosloco/oil/models.py", line 172, in __str__
> self.accepted
>
> What is inside this __str__ method? `self.accepted` field name sounds like 
> it could be a date. Return type of __str__ must be a string.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52b2bdea-b4ef-4434-9325-b98e58ae675e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Broken?

2018-04-28 Thread Kevin O'Gorman
So I modified the command so that it brought out all the fields, adding 
them one by one in a .values() call added to the QuerySet.  They all came 
out just fine, every single one, including the timestamp.

As a result, I'm thinking this may be a bug in Django when it is just being 
called on to produce QuerySet[0] and it contains a timestamp.  Or maybe the 
bug depends on some other trigger.  I'm at a crucial point in the use of 
this code, have a workaround, so I won't do anything more with it until 
after our end date this coming Tuesday.  After that I'll decompress for a 
day or so.  Maybe then I'll produce example code complete with test data.  
But I'd have to say the command is about as simple as it's gonna get.

On Saturday, April 28, 2018 at 11:43:48 AM UTC-7, Kevin O'Gorman wrote:
>
> Maybe, but while the log file has undergone some migrations in the past, 
> it has not been much, not recently, and everything is up-to-date now.  
> 'manage makemigrations' detects nothing.
>
> So the question is how I can explore this.
>
> ++ kevin
>
> On Saturday, April 28, 2018 at 7:17:24 AM UTC-7, Jason wrote:
>>
>> Basically, its saying that something is expecting a string, but is 
>> instead getting a datetime object.  Sounds like something changed in your 
>> `oils/models.py` file
>>
>> On Saturday, April 28, 2018 at 7:54:24 AM UTC-4, Kevin O'Gorman wrote:
>>>
>>> I've got a working site, but I made a copy of the database in order to 
>>> do some development work.
>>> I've hit a snag that looks like a problem in the data.
>>>
>>> The odd part is that this database is in production, and my backups have 
>>> the same problem.  So I'm presuming my new code is broken in some way I 
>>> don't understand.
>>> For instance, Ive written a management command to show the problem:
>>>
>>> from django.core.management.base import BaseCommand, CommandError
>>>
>>> from oil.models import Packet, Signature, Log, Voter
>>>
>>> class Command(BaseCommand):
>>> help = 'Quick test'
>>> BaseCommand.requires_migrations_checks = True
>>>
>>>
>>> def handle(self, *args, **options):
>>> voters = Log.objects.all()
>>>     self.stdout.write(repr(voters[0]))
>>>
>>> I'm suspecting a problem has crept into my Log table, because it works 
>>> fine if I change Log on the
>>> second line of handle() to any of the other tables.  If it runs as shown 
>>> here however, I get
>>>
>>> kevin@camelot-x:/build/comprosloco$ manage oiltest
>>> Traceback (most recent call last):
>>>   File "./manage", line 22, in 
>>> execute_from_command_line(sys.argv)
>>>   File "/build/django/django/core/management/__init__.py", line 364, in 
>>> execute_from_command_line
>>> utility.execute()
>>>   File "/build/django/django/core/management/__init__.py", line 356, in 
>>> execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File "/build/django/django/core/management/base.py", line 283, in 
>>> run_from_argv
>>> self.execute(*args, **cmd_options)
>>>   File "/build/django/django/core/management/base.py", line 330, in 
>>> execute
>>> output = self.handle(*args, **options)
>>>   File "/raid3/build/comprosloco/oil/management/commands/oiltest.py", 
>>> line 15, in handle
>>> self.stdout.write(repr(voters[0]))
>>>   File "/build/django/django/db/models/base.py", line 590, in __repr__
>>> u = six.text_type(self)
>>>   File "/raid3/build/comprosloco/oil/models.py", line 172, in __str__
>>> self.accepted
>>> TypeError: sequence item 0: expected str instance, datetime.datetime 
>>> found
>>> kevin@camelot-x:/build/comprosloco$
>>>
>>> And I have no idea how to debug it further.  The schema of Log is
>>> sqlite> .schema oil_log
>>> CREATE TABLE "oil_log" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, 
>>> "packet" integer NOT NULL, "signature" integer NOT NULL, "action" 
>>> varchar(20) NOT NULL, "criteria" varchar(150) NOT NULL, "candidates" 
>>> varchar(100) NOT NULL, "accepted" varchar(10) NOT NULL, "user_id" integer 
>>> NOT NULL REFERENCES "auth_user" ("id"), "timestamp" datetime NOT NULL);
>>> CREATE INDEX "oil_log_packet_ecd59bc4" ON "oil_log" ("packet");
>>> CREATE INDEX "oil_log_user_id_7f26e501" ON "oil_log" ("user_id");
>>> sqlite>
>>>
>>>
>>> Help???
>>>
>>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1c5ffcb5-7212-4ee7-94c0-17f699ced3f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Broken?

2018-04-28 Thread Kevin O'Gorman
Maybe, but while the log file has undergone some migrations in the past, it 
has not been much, not recently, and everything is up-to-date now.  'manage 
makemigrations' detects nothing.

So the question is how I can explore this.

++ kevin

On Saturday, April 28, 2018 at 7:17:24 AM UTC-7, Jason wrote:
>
> Basically, its saying that something is expecting a string, but is instead 
> getting a datetime object.  Sounds like something changed in your 
> `oils/models.py` file
>
> On Saturday, April 28, 2018 at 7:54:24 AM UTC-4, Kevin O'Gorman wrote:
>>
>> I've got a working site, but I made a copy of the database in order to do 
>> some development work.
>> I've hit a snag that looks like a problem in the data.
>>
>> The odd part is that this database is in production, and my backups have 
>> the same problem.  So I'm presuming my new code is broken in some way I 
>> don't understand.
>> For instance, Ive written a management command to show the problem:
>>
>> from django.core.management.base import BaseCommand, CommandError
>>
>> from oil.models import Packet, Signature, Log, Voter
>>
>> class Command(BaseCommand):
>> help = 'Quick test'
>> BaseCommand.requires_migrations_checks = True
>>
>>
>> def handle(self, *args, **options):
>> voters = Log.objects.all()
>> self.stdout.write(repr(voters[0]))
>>
>> I'm suspecting a problem has crept into my Log table, because it works 
>> fine if I change Log on the
>> second line of handle() to any of the other tables.  If it runs as shown 
>> here however, I get
>>
>> kevin@camelot-x:/build/comprosloco$ manage oiltest
>> Traceback (most recent call last):
>>   File "./manage", line 22, in 
>> execute_from_command_line(sys.argv)
>>   File "/build/django/django/core/management/__init__.py", line 364, in 
>> execute_from_command_line
>> utility.execute()
>>   File "/build/django/django/core/management/__init__.py", line 356, in 
>> execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File "/build/django/django/core/management/base.py", line 283, in 
>> run_from_argv
>> self.execute(*args, **cmd_options)
>>   File "/build/django/django/core/management/base.py", line 330, in 
>> execute
>> output = self.handle(*args, **options)
>>   File "/raid3/build/comprosloco/oil/management/commands/oiltest.py", 
>> line 15, in handle
>> self.stdout.write(repr(voters[0]))
>>   File "/build/django/django/db/models/base.py", line 590, in __repr__
>> u = six.text_type(self)
>>   File "/raid3/build/comprosloco/oil/models.py", line 172, in __str__
>> self.accepted
>> TypeError: sequence item 0: expected str instance, datetime.datetime found
>> kevin@camelot-x:/build/comprosloco$
>>
>> And I have no idea how to debug it further.  The schema of Log is
>> sqlite> .schema oil_log
>> CREATE TABLE "oil_log" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, 
>> "packet" integer NOT NULL, "signature" integer NOT NULL, "action" 
>> varchar(20) NOT NULL, "criteria" varchar(150) NOT NULL, "candidates" 
>> varchar(100) NOT NULL, "accepted" varchar(10) NOT NULL, "user_id" integer 
>> NOT NULL REFERENCES "auth_user" ("id"), "timestamp" datetime NOT NULL);
>> CREATE INDEX "oil_log_packet_ecd59bc4" ON "oil_log" ("packet");
>> CREATE INDEX "oil_log_user_id_7f26e501" ON "oil_log" ("user_id");
>> sqlite>
>>
>>
>> Help???
>>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92b25a7f-81ab-46c2-8729-0bdb996b9f75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Broken?

2018-04-28 Thread Kevin O'Gorman
I've got a working site, but I made a copy of the database in order to do 
some development work.
I've hit a snag that looks like a problem in the data.

The odd part is that this database is in production, and my backups have 
the same problem.  So I'm presuming my new code is broken in some way I 
don't understand.
For instance, Ive written a management command to show the problem:

from django.core.management.base import BaseCommand, CommandError

from oil.models import Packet, Signature, Log, Voter

class Command(BaseCommand):
help = 'Quick test'
BaseCommand.requires_migrations_checks = True


def handle(self, *args, **options):
voters = Log.objects.all()
self.stdout.write(repr(voters[0]))

I'm suspecting a problem has crept into my Log table, because it works fine 
if I change Log on the
second line of handle() to any of the other tables.  If it runs as shown 
here however, I get

kevin@camelot-x:/build/comprosloco$ manage oiltest
Traceback (most recent call last):
  File "./manage", line 22, in 
execute_from_command_line(sys.argv)
  File "/build/django/django/core/management/__init__.py", line 364, in 
execute_from_command_line
utility.execute()
  File "/build/django/django/core/management/__init__.py", line 356, in 
execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/build/django/django/core/management/base.py", line 283, in 
run_from_argv
self.execute(*args, **cmd_options)
  File "/build/django/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
  File "/raid3/build/comprosloco/oil/management/commands/oiltest.py", line 
15, in handle
self.stdout.write(repr(voters[0]))
  File "/build/django/django/db/models/base.py", line 590, in __repr__
u = six.text_type(self)
  File "/raid3/build/comprosloco/oil/models.py", line 172, in __str__
self.accepted
TypeError: sequence item 0: expected str instance, datetime.datetime found
kevin@camelot-x:/build/comprosloco$

And I have no idea how to debug it further.  The schema of Log is
sqlite> .schema oil_log
CREATE TABLE "oil_log" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, 
"packet" integer NOT NULL, "signature" integer NOT NULL, "action" 
varchar(20) NOT NULL, "criteria" varchar(150) NOT NULL, "candidates" 
varchar(100) NOT NULL, "accepted" varchar(10) NOT NULL, "user_id" integer 
NOT NULL REFERENCES "auth_user" ("id"), "timestamp" datetime NOT NULL);
CREATE INDEX "oil_log_packet_ecd59bc4" ON "oil_log" ("packet");
CREATE INDEX "oil_log_user_id_7f26e501" ON "oil_log" ("user_id");
sqlite>


Help???

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/419b7f17-c7c4-4650-ae4f-5305bc556e98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Default for varbinary in inspectdb

2018-03-20 Thread Kevin Olbrich
PS: After changing the field to BinaryField, read / write works beautiful.


Am Dienstag, 20. März 2018 14:49:35 UTC+1 schrieb Kevin Olbrich:
>
> Hi,
>
> I just noticed a problem with varbinary fields and inspectdb.
> When inspectdb processes all fields, it creates varbinary as CharField but 
> it needs to be BinaryField.
> Using CharField it is impossible to store non-ASCII (non-text) content in 
> these columns.
>
> I noticed that problem when I tried to insert a mac address (hex) into a 
> varbinary field which needs to be UNHEX()'ed before being inserted.
> CharFields forces str() as the value which saves a binary representation 
> as the value (b'...).
>
> Inspectdb should always be handled as BinaryField because that is what it 
> realy is (currently it is some sort of saving an int as str).
>
> Whats your opinion?
>
> Kind regards
> Kevin
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eca30e74-855d-497b-9117-b3b1337380e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Default for varbinary in inspectdb

2018-03-20 Thread Kevin Olbrich
Hi,

I just noticed a problem with varbinary fields and inspectdb.
When inspectdb processes all fields, it creates varbinary as CharField but 
it needs to be BinaryField.
Using CharField it is impossible to store non-ASCII (non-text) content in 
these columns.

I noticed that problem when I tried to insert a mac address (hex) into a 
varbinary field which needs to be UNHEX()'ed before being inserted.
CharFields forces str() as the value which saves a binary representation as 
the value (b'...).

Inspectdb should always be handled as BinaryField because that is what it 
realy is (currently it is some sort of saving an int as str).

Whats your opinion?

Kind regards
Kevin

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/36547010-a8a2-45ca-97c3-b9c056a10a86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: separate http requests between channels routing and "classic django routing

2018-03-14 Thread Kevin Tewouda
Thanks Andrew
i found the mistake myself, my routing file was like this

http_urlpatterns = [
path('stream', ServerSentEventsConsumer),
path('', AsgiHandler)
]


I think that the second route will match all the default routes, but like 
it is mentionned in the tutorial, we have to use a *regex *path. So i 
change it to this and it works nice!

http_urlpatterns = [
path('stream', ServerSentEventsConsumer),
re_path(r'', AsgiHandler)
]


I think there should be a warning in the tutorial to take particular 
attention with the *path* method introduced in django 2.

Thanks again.

Le mercredi 14 mars 2018 05:19:28 UTC+1, Andrew Godwin a écrit :
>
> You can just use channels.http.AsgiHandler as the consumer/ASGI app to 
> hand off to Django views. It's mentioned in the last paragraph here: 
> http://channels.readthedocs.io/en/latest/topics/routing.html#protocoltyperouter
>
> Andrew
>
> On Tue, Mar 13, 2018 at 9:20 AM, Kevin Tewouda <lewo...@gmail.com 
> > wrote:
>
>> Hello,
>> i am developing an application (a REST one) which have to serve some sse 
>> events to a web application. I saw in the latest documentation how to 
>> create an SSE consumer, but now when i create an http routing for 
>> consumers, i can't serve the others requests using the "classic django view 
>> system". So my question is how can i separate the sse routing from the 
>> other http requests to have all of this working properly.
>> Thanks in advance for your suggestions.
>>
>> Best regards
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/6b19b58f-d5e3-4e31-908b-a9371e31b2cc%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/6b19b58f-d5e3-4e31-908b-a9371e31b2cc%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7eaa6d7f-d088-4797-af61-dc6f3502136d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


separate http requests between channels routing and "classic django routing

2018-03-13 Thread Kevin Tewouda

Hello,
i am developing an application (a REST one) which have to serve some sse 
events to a web application. I saw in the latest documentation how to 
create an SSE consumer, but now when i create an http routing for 
consumers, i can't serve the others requests using the "classic django view 
system". So my question is how can i separate the sse routing from the 
other http requests to have all of this working properly.
Thanks in advance for your suggestions.

Best regards

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6b19b58f-d5e3-4e31-908b-a9371e31b2cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Would old version of mysql caused performance issue in Django

2017-07-18 Thread Kevin Yu
I'm not trying to update database 5.1 to 5.7. I am simplying seeing 
difference in terms of performance when running against different version 
of Mysql with same dataset.

Can you please explain how dumpdata could help?

On Tuesday, July 18, 2017 at 12:46:43 PM UTC-7, sacrac wrote:
>
> why you try update the databases 5.1 to 5.7?
>
> try  dumpdate with manage.py django in .json all apps y then loaddata in 
> new database!
>
> https://docs.djangoproject.com/en/1.11/ref/django-admin/#dumpdata
>
> cheers
>
> On Tue, Jul 18, 2017 at 1:12 PM, Felipe Brunelli de Andrade <
> fbrua...@gmail.com > wrote:
>
>> It seems like some thing in your app view.
>>
>> Did you try to dump real database and run localy in your workstation?
>>
>> 2017-07-18 16:05 GMT-03:00 Kevin Yu <sams...@gmail.com >:
>>
>>>
>>> <https://lh3.googleusercontent.com/-jIXPWhwHNUw/WW5biPCMzlI/De4/BnmWrwpKd88NFW-PswfbXcBNZSN04c36ACLcBGAs/s1600/Screenshot%2Bfrom%2B2017-07-18%2B12-03-18.png>
>>>
>>> I even noticed when i do runserver on my local to connect to the older 
>>> version of mysql db, the starting of dev server is noticeably slower.
>>>
>>> What I mean is here:
>>> kevin@kevin-OptiPlex-7020:~/repo/Infosite_Django/app$ python manage.py 
>>> runserver
>>> Performing system checks...
>>>
>>> System check identified no issues (0 silenced).
>>> July 18, 2017 - 19:00:12
>>> Django version 1.11.2, using settings 'infosite.settings'
>>> Starting development server at http://127.0.0.1:8000/
>>> Quit the server with CONTROL-C.
>>>
>>>
>>> On Tuesday, July 18, 2017 at 11:43:53 AM UTC-7, Felipe wrote:
>>>>
>>>> Try to debug in chrome just press F12 and go to network tab and see 
>>>> the times fot load content
>>>>
>>>> 2017-07-18 15:18 GMT-03:00 Kevin Yu <sams...@gmail.com>:
>>>>
>>>>> I've eliminated the possibility of mysql performance issue by directly 
>>>>> running the query on the database. It's not network issue either since my 
>>>>> ping is just fine.
>>>>>
>>>>>
>>>>> On Tuesday, July 18, 2017 at 11:00:58 AM UTC-7, Kevin Yu wrote:
>>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I'm rewritting an web application using Django 1.11. When i hooked up 
>>>>>> to my test mysql database (version 5.7), the performance is amazing. The 
>>>>>> page renders within 1 second. However, when I connect to the existing 
>>>>>> production mysql (version 5.1), the page takes more than 10 seconds. 
>>>>>>
>>>>>> I installed the debug toolbar, and I found out the the query time is 
>>>>>> actually not the issue. Most of the time are in the CPU. 
>>>>>>
>>>>>> I am wondering whether the Django is having issues with older mysql 
>>>>>> version when Django receives the data and try to map it to objects via 
>>>>>> ORM.
>>>>>>
>>>>>>
>>>>>> <https://lh3.googleusercontent.com/-lti9EnCOwpI/WW5My639ZTI/Des/gUJgzX0Wy5IvrGpf2xGDKFbAkoqN7za2gCLcBGAs/s1600/Screenshot%2Bfrom%2B2017-07-18%2B10-59-30.png>
>>>>>>
>>>>>> -- 
>>>>> 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...@googlegroups.com.
>>>>> To post to this group, send email to django...@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/django-users/ac4201dd-5267-4566-8d0a-82b2b2f043c4%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/django-users/ac4201dd-5267-4566-8d0a-82b2b2f043c4%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> -- 
>>> 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.

Re: Would old version of mysql caused performance issue in Django

2017-07-18 Thread Kevin Yu
Yes, my local database is actually a mysqldump of the production so in
terms of data set, it's the same

On Jul 18, 2017 12:13 PM, "Felipe Brunelli de Andrade" <
fbruandr...@gmail.com> wrote:

It seems like some thing in your app view.

Did you try to dump real database and run localy in your workstation?

2017-07-18 16:05 GMT-03:00 Kevin Yu <samsun...@gmail.com>:

>
> <https://lh3.googleusercontent.com/-jIXPWhwHNUw/WW5biPCMzlI/De4/BnmWrwpKd88NFW-PswfbXcBNZSN04c36ACLcBGAs/s1600/Screenshot%2Bfrom%2B2017-07-18%2B12-03-18.png>
>
> I even noticed when i do runserver on my local to connect to the older
> version of mysql db, the starting of dev server is noticeably slower.
>
> What I mean is here:
> kevin@kevin-OptiPlex-7020:~/repo/Infosite_Django/app$ python manage.py
> runserver
> Performing system checks...
>
> System check identified no issues (0 silenced).
> July 18, 2017 - 19:00:12
> Django version 1.11.2, using settings 'infosite.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
>
>
> On Tuesday, July 18, 2017 at 11:43:53 AM UTC-7, Felipe wrote:
>>
>> Try to debug in chrome just press F12 and go to network tab and see
>> the times fot load content
>>
>> 2017-07-18 15:18 GMT-03:00 Kevin Yu <sams...@gmail.com>:
>>
>>> I've eliminated the possibility of mysql performance issue by directly
>>> running the query on the database. It's not network issue either since my
>>> ping is just fine.
>>>
>>>
>>> On Tuesday, July 18, 2017 at 11:00:58 AM UTC-7, Kevin Yu wrote:
>>>>
>>>> Hi All,
>>>>
>>>> I'm rewritting an web application using Django 1.11. When i hooked up
>>>> to my test mysql database (version 5.7), the performance is amazing. The
>>>> page renders within 1 second. However, when I connect to the existing
>>>> production mysql (version 5.1), the page takes more than 10 seconds.
>>>>
>>>> I installed the debug toolbar, and I found out the the query time is
>>>> actually not the issue. Most of the time are in the CPU.
>>>>
>>>> I am wondering whether the Django is having issues with older mysql
>>>> version when Django receives the data and try to map it to objects via ORM.
>>>>
>>>>
>>>> <https://lh3.googleusercontent.com/-lti9EnCOwpI/WW5My639ZTI/Des/gUJgzX0Wy5IvrGpf2xGDKFbAkoqN7za2gCLcBGAs/s1600/Screenshot%2Bfrom%2B2017-07-18%2B10-59-30.png>
>>>>
>>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/ac4201dd-5267-4566-8d0a-82b2b2f043c4%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/ac4201dd-5267-4566-8d0a-82b2b2f043c4%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/django-users/9efab471-ae94-4ff2-a62c-67650638c4e0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9efab471-ae94-4ff2-a62c-67650638c4e0%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to a topic in the
Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/django-users/_EOK0u_We5k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/

Re: Would old version of mysql caused performance issue in Django

2017-07-18 Thread Kevin Yu


<https://lh3.googleusercontent.com/-jIXPWhwHNUw/WW5biPCMzlI/De4/BnmWrwpKd88NFW-PswfbXcBNZSN04c36ACLcBGAs/s1600/Screenshot%2Bfrom%2B2017-07-18%2B12-03-18.png>

I even noticed when i do runserver on my local to connect to the older 
version of mysql db, the starting of dev server is noticeably slower.

What I mean is here:
kevin@kevin-OptiPlex-7020:~/repo/Infosite_Django/app$ python manage.py 
runserver
Performing system checks...

System check identified no issues (0 silenced).
July 18, 2017 - 19:00:12
Django version 1.11.2, using settings 'infosite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.


On Tuesday, July 18, 2017 at 11:43:53 AM UTC-7, Felipe wrote:
>
> Try to debug in chrome just press F12 and go to network tab and see 
> the times fot load content
>
> 2017-07-18 15:18 GMT-03:00 Kevin Yu <sams...@gmail.com >:
>
>> I've eliminated the possibility of mysql performance issue by directly 
>> running the query on the database. It's not network issue either since my 
>> ping is just fine.
>>
>>
>> On Tuesday, July 18, 2017 at 11:00:58 AM UTC-7, Kevin Yu wrote:
>>>
>>> Hi All,
>>>
>>> I'm rewritting an web application using Django 1.11. When i hooked up to 
>>> my test mysql database (version 5.7), the performance is amazing. The page 
>>> renders within 1 second. However, when I connect to the existing production 
>>> mysql (version 5.1), the page takes more than 10 seconds. 
>>>
>>> I installed the debug toolbar, and I found out the the query time is 
>>> actually not the issue. Most of the time are in the CPU. 
>>>
>>> I am wondering whether the Django is having issues with older mysql 
>>> version when Django receives the data and try to map it to objects via ORM.
>>>
>>>
>>> <https://lh3.googleusercontent.com/-lti9EnCOwpI/WW5My639ZTI/Des/gUJgzX0Wy5IvrGpf2xGDKFbAkoqN7za2gCLcBGAs/s1600/Screenshot%2Bfrom%2B2017-07-18%2B10-59-30.png>
>>>
>>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/ac4201dd-5267-4566-8d0a-82b2b2f043c4%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/ac4201dd-5267-4566-8d0a-82b2b2f043c4%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9efab471-ae94-4ff2-a62c-67650638c4e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Would old version of mysql caused performance issue in Django

2017-07-18 Thread Kevin Yu


I've eliminated the possibility of mysql performance issue by directly 
running the query on the database. It's not network issue either since my 
ping is just fine.


On Tuesday, July 18, 2017 at 11:00:58 AM UTC-7, Kevin Yu wrote:
>
> Hi All,
>
> I'm rewritting an web application using Django 1.11. When i hooked up to 
> my test mysql database (version 5.7), the performance is amazing. The page 
> renders within 1 second. However, when I connect to the existing production 
> mysql (version 5.1), the page takes more than 10 seconds. 
>
> I installed the debug toolbar, and I found out the the query time is 
> actually not the issue. Most of the time are in the CPU. 
>
> I am wondering whether the Django is having issues with older mysql 
> version when Django receives the data and try to map it to objects via ORM.
>
>
> <https://lh3.googleusercontent.com/-lti9EnCOwpI/WW5My639ZTI/Des/gUJgzX0Wy5IvrGpf2xGDKFbAkoqN7za2gCLcBGAs/s1600/Screenshot%2Bfrom%2B2017-07-18%2B10-59-30.png>
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ac4201dd-5267-4566-8d0a-82b2b2f043c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Would old version of mysql caused performance issue in Django

2017-07-18 Thread Kevin Yu
Hi Felipe,

Thanks for the quick response. I've eliminated it's cpu load on the 
production server by directing running the query on the mysql and 
calculation time is very quick. It's unlikely network issue because the 
ping is pretty quick.

mysql query time on the server:
1063 rows in set (0.00 sec)


ping 172.16.100.131
64 bytes from 172.16.100.131: icmp_seq=2 ttl=62 time=0.316 ms


On Tuesday, July 18, 2017 at 11:10:40 AM UTC-7, Felipe wrote:
>
> You need to see de CPU load in server.
>
> In your test you probably are using a local machine with no loading... but 
> your produce server I dont know. You need to see in server the webserver 
> too, try to run django-admin runserver :8000 and see if you have the 
> same issue.
>
> But if you are just connecting to another machine with database, and 
> application is in yur development enviroment, probably is your network.
>
> 2017-07-18 15:00 GMT-03:00 Kevin Yu <sams...@gmail.com >:
>
>> Hi All,
>>
>> I'm rewritting an web application using Django 1.11. When i hooked up to 
>> my test mysql database (version 5.7), the performance is amazing. The page 
>> renders within 1 second. However, when I connect to the existing production 
>> mysql (version 5.1), the page takes more than 10 seconds. 
>>
>> I installed the debug toolbar, and I found out the the query time is 
>> actually not the issue. Most of the time are in the CPU. 
>>
>> I am wondering whether the Django is having issues with older mysql 
>> version when Django receives the data and try to map it to objects via ORM.
>>
>>
>> <https://lh3.googleusercontent.com/-lti9EnCOwpI/WW5My639ZTI/Des/gUJgzX0Wy5IvrGpf2xGDKFbAkoqN7za2gCLcBGAs/s1600/Screenshot%2Bfrom%2B2017-07-18%2B10-59-30.png>
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/21e35905-047c-4d57-9f0c-6012d148597c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/21e35905-047c-4d57-9f0c-6012d148597c%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4280217c-b3e1-459b-9487-76a2776c323f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Would old version of mysql caused performance issue in Django

2017-07-18 Thread Kevin Yu


Hi All,

I'm rewritting an web application using Django 1.11. When i hooked up to my 
test mysql database (version 5.7), the performance is amazing. The page 
renders within 1 second. However, when I connect to the existing production 
mysql (version 5.1), the page takes more than 10 seconds. 

I installed the debug toolbar, and I found out the the query time is 
actually not the issue. Most of the time are in the CPU. 

I am wondering whether the Django is having issues with older mysql version 
when Django receives the data and try to map it to objects via ORM.



-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/21e35905-047c-4d57-9f0c-6012d148597c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help for defining foreign key based on value from another table

2017-06-21 Thread Kevin Yu
I just found out on Django document, there's an example that's for 
manytomany, using 'through' when defining the foreign key. I think this is 
what i need.

Here's the example:

from django.db import models

class Person(models.Model):
name = models.CharField(max_length=128)

def __str__(self):  # __unicode__ on Python 2
return self.name

class Group(models.Model):
name = models.CharField(max_length=128)
members = models.ManyToManyField(Person, through='Membership')

def __str__(self):  # __unicode__ on Python 2
return self.name

class Membership(models.Model):
person = models.ForeignKey(Person, on_delete=models.CASCADE)
group = models.ForeignKey(Group, on_delete=models.CASCADE)
date_joined = models.DateField()
invite_reason = models.CharField(max_length=64)




On Wednesday, June 21, 2017 at 2:49:40 PM UTC-7, Kevin Yu wrote:
>
> I'm working with a legacy database so I have to set managed=False in the 
> model. Here's the 3 related tables:
>
>
> class Branches(models.Model):
> name = models.CharField(max_length=128)
> branchpoint_str = models.CharField(max_length=255)
> dev_lead_id = models.IntegerField(blank=True, null=True)
> source = models.CharField(max_length=255)
> state = models.CharField(max_length=255)
> kind = models.CharField(max_length=255)
> desc = models.TextField(blank=True, null=True)
> approved = models.IntegerField()
> for_customer = models.IntegerField()
> deactivated_at = models.DateTimeField(blank=True, null=True)
> created_at = models.DateTimeField(blank=True, null=True)
> updated_at = models.DateTimeField(blank=True, null=True)
> codb_id = models.IntegerField(blank=True, null=True)
> pm_lead_id = models.IntegerField(blank=True, null=True)
> version = models.CharField(max_length=20, blank=True, null=True)
> path_id = models.IntegerField(blank=True, null=True)
> branchpoint_type = models.CharField(max_length=255, blank=True, 
> null=True)
> branchpoint_id = models.IntegerField(blank=True, null=True)
>
> class Meta:
> managed = False
> db_table = 'branches'
> verbose_name_plural = 'Branches'
>
> class Projects(models.Model):
> id = models.AutoField(primary_key=True)
> name = models.CharField(max_length=40, primary_key=True)
> status = models.CharField(max_length=255)
> platform = models.CharField(max_length=255)
> enabled = models.IntegerField()
> path = models.CharField(max_length=128, blank=True, null=True)
> tag_prefix = models.CharField(max_length=64, blank=True, null=True)
> created_at = models.DateTimeField(blank=True, null=True)
> updated_at = models.DateTimeField(blank=True, null=True)
> codb_id = models.IntegerField(blank=True, null=True)
> template = models.CharField(max_length=64, blank=True, null=True)
> image_path = models.CharField(max_length=128, blank=True, null=True)
> repository_id = models.IntegerField(blank=True, null=True)
> number_scheme = models.CharField(max_length=32)
> special_dir = models.CharField(max_length=32, blank=True, null=True)
> project_family_id = models.IntegerField()
> class Meta:
> managed = False
> db_table = 'projects'
> verbose_name_plural = 'projects'
>
> class BranchesProjects(models.Model):
> # project_id = models.IntegerField()
> # branch_id = models.IntegerField()
> project = models.ForeignKey(Projects, on_delete=models.CASCADE)
> branch = models.ForeignKey(Branches, on_delete=models.CASCADE)
>
> class Meta:
> managed = False
> db_table = 'branches_projects'
>
> I have been able to do the join using raw(). However, the return object is 
> rawqueryset. What I want is queryset so that I can use django-filter to 
> process it. My current raw sql is like this:
> Branches.objects.raw(
> '''SELECT br.id, br.name, br.created_at, br.updated_at,
> br.branchpoint_str, br.source
> FROM branches as br
> LEFT JOIN branches_projects as bp
> ON br.id = bp.branch_id 
> WHERE bp.project_id = "%s" AND source != "other"
> ORDER BY updated_at DES'''
>
>  
> My question is, is there a way to achieve the same result using Django's 
> queryset? I've also explored  the idea of using the extra() in django 
> extra 
> <https://docs.djangoproject.com/en/1.11/ref/models/querysets/#django.db.models.query.QuerySet.extra>
>  but 
> it doesn't really work for me.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsu

Need help for defining foreign key based on value from another table

2017-06-21 Thread Kevin Yu
I'm working with a legacy database so I have to set managed=False in the 
model. Here's the 3 related tables:


class Branches(models.Model):
name = models.CharField(max_length=128)
branchpoint_str = models.CharField(max_length=255)
dev_lead_id = models.IntegerField(blank=True, null=True)
source = models.CharField(max_length=255)
state = models.CharField(max_length=255)
kind = models.CharField(max_length=255)
desc = models.TextField(blank=True, null=True)
approved = models.IntegerField()
for_customer = models.IntegerField()
deactivated_at = models.DateTimeField(blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
updated_at = models.DateTimeField(blank=True, null=True)
codb_id = models.IntegerField(blank=True, null=True)
pm_lead_id = models.IntegerField(blank=True, null=True)
version = models.CharField(max_length=20, blank=True, null=True)
path_id = models.IntegerField(blank=True, null=True)
branchpoint_type = models.CharField(max_length=255, blank=True, 
null=True)
branchpoint_id = models.IntegerField(blank=True, null=True)

class Meta:
managed = False
db_table = 'branches'
verbose_name_plural = 'Branches'

class Projects(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=40, primary_key=True)
status = models.CharField(max_length=255)
platform = models.CharField(max_length=255)
enabled = models.IntegerField()
path = models.CharField(max_length=128, blank=True, null=True)
tag_prefix = models.CharField(max_length=64, blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
updated_at = models.DateTimeField(blank=True, null=True)
codb_id = models.IntegerField(blank=True, null=True)
template = models.CharField(max_length=64, blank=True, null=True)
image_path = models.CharField(max_length=128, blank=True, null=True)
repository_id = models.IntegerField(blank=True, null=True)
number_scheme = models.CharField(max_length=32)
special_dir = models.CharField(max_length=32, blank=True, null=True)
project_family_id = models.IntegerField()
class Meta:
managed = False
db_table = 'projects'
verbose_name_plural = 'projects'

class BranchesProjects(models.Model):
# project_id = models.IntegerField()
# branch_id = models.IntegerField()
project = models.ForeignKey(Projects, on_delete=models.CASCADE)
branch = models.ForeignKey(Branches, on_delete=models.CASCADE)

class Meta:
managed = False
db_table = 'branches_projects'

I have been able to do the join using raw(). However, the return object is 
rawqueryset. What I want is queryset so that I can use django-filter to 
process it. My current raw sql is like this:
Branches.objects.raw(
'''SELECT br.id, br.name, br.created_at, br.updated_at,
br.branchpoint_str, br.source
FROM branches as br
LEFT JOIN branches_projects as bp
ON br.id = bp.branch_id 
WHERE bp.project_id = "%s" AND source != "other"
ORDER BY updated_at DES'''

 
My question is, is there a way to achieve the same result using Django's 
queryset? I've also explored  the idea of using the extra() in django extra 

 but 
it doesn't really work for me.

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1581448d-bb69-4e85-a35c-62d0bfad88ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Raw SQL - How to approach paging and lazy fetching

2017-06-21 Thread Kevin Yu
Thanks Jani. I was able to solve my original issue using your suggestion.

On Friday, June 16, 2017 at 12:54:26 PM UTC-7, Jani Tiainen wrote:
>
> Yes, even there isn't real foreign keys in  the database you can still 
> join models.
>
> Have been doing that few times with legacy database. When defining fkey 
> you need to point it to corresponding field in fkey attributes in your 
> model if it isnt your target model pk.
>
> And you can join nonmanged models with managed just fine.
>
> 16.6.2017 19.26 "Kevin Yu" <sams...@gmail.com > kirjoitti:
>
> Hi Jani,
>
> Thanks for the link. I was aware of this link and actually followed the 
> steps when I started the project. I tried using model but then found out 
> when i need to query a join, it doesn't seem to work unless there's a 
> foreign key between the two models, however, given it's a legacy database, 
> i can't touch the schema at all. Is it possible to query join results with 
> managed=False?
>
> Thanks
>
> On Thursday, June 15, 2017 at 11:31:42 PM UTC-7, Jani Tiainen wrote:
>
>> Hi,
>>
>> Even you do have legacy database, you can use unmanaged models and then 
>> leverage full power of ORM [1].
>>
>> Just create models and in their Meta set managed = False and there you 
>> go. 
>>
>> And what comes to paging - you need to somehow pass offset and limit to 
>> your query.
>>
>> [1] https://docs.djangoproject.com/en/1.11/howto/legacy-databases/
>>
>> On 16.06.2017 02:05, Kevin Yu wrote:
>>
>> Hi All, 
>>
>> I am using raw sql to connect to database. The reason we used raw sql 
>> instead of the Django model is because the database is legacy and is being 
>> shared by multiple applications...
>>
>> I have one use case that I'm struggling right now. Basically I have a 
>> page that fetch more than 1000 results. My query is like this:
>>
>> cursor = connection.cursor()
>> cursor.execute('''
>> SELECT br.id, br.name, br.created_at, br.updated_at,
>> br.branchpoint_str, br.source
>> FROM branches as br
>> LEFT JOIN branches_projects as bp
>> ON br.id = bp.branch_id 
>> WHERE bp.project_id = "%s" AND source != "other"
>> ORDER BY updated_at DESC
>>''', [int(project_id)]
>>)
>>
>> Then in my template, I have this:
>> {% for br in special_branches %}
>>
>>   > link="/files/{{build.image_path}}/build{{build.build_number}}/">
>> {{br.name}}
>> {{br.branchpoint}}
>> {{ br.source|upper }}
>> {{br.updated_at}}
>> {{br.built_at}}
>>   
>> {% endfor %}
>>
>> The current problem is this would create a very long page... I am 
>> wondering how to approach this problem so that I can have different page on 
>> the template, and say 100 result per page, when i click the second page, 
>> then  django will fetch result 100-200.
>>
>> Thanks!
>> -- 
>> 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...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>>
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f6a3df97-8218-4fb8-b200-f4535797e135%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/f6a3df97-8218-4fb8-b200-f4535797e135%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> -- 
>> Jani Tiainen
>>
>> -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/7e4a44fc-e5ce-4562-8b75-09ba065e34f5%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/7e4a44fc-e5ce-4562-8b75-09ba065e34f5

Re: Raw SQL - How to approach paging and lazy fetching

2017-06-16 Thread Kevin Yu
Hi Jani,

Thanks for the link. I was aware of this link and actually followed the 
steps when I started the project. I tried using model but then found out 
when i need to query a join, it doesn't seem to work unless there's a 
foreign key between the two models, however, given it's a legacy database, 
i can't touch the schema at all. Is it possible to query join results with 
managed=False?

Thanks
On Thursday, June 15, 2017 at 11:31:42 PM UTC-7, Jani Tiainen wrote:
>
> Hi,
>
> Even you do have legacy database, you can use unmanaged models and then 
> leverage full power of ORM [1].
>
> Just create models and in their Meta set managed = False and there you go. 
>
> And what comes to paging - you need to somehow pass offset and limit to 
> your query.
>
> [1] https://docs.djangoproject.com/en/1.11/howto/legacy-databases/
>
> On 16.06.2017 02:05, Kevin Yu wrote:
>
> Hi All, 
>
> I am using raw sql to connect to database. The reason we used raw sql 
> instead of the Django model is because the database is legacy and is being 
> shared by multiple applications...
>
> I have one use case that I'm struggling right now. Basically I have a page 
> that fetch more than 1000 results. My query is like this:
>
> cursor = connection.cursor()
> cursor.execute('''
> SELECT br.id, br.name, br.created_at, br.updated_at,
> br.branchpoint_str, br.source
> FROM branches as br
> LEFT JOIN branches_projects as bp
> ON br.id = bp.branch_id 
> WHERE bp.project_id = "%s" AND source != "other"
> ORDER BY updated_at DESC
>''', [int(project_id)]
>)
>
> Then in my template, I have this:
> {% for br in special_branches %}
>
>link="/files/{{build.image_path}}/build{{build.build_number}}/">
> {{br.name}}
> {{br.branchpoint}}
> {{ br.source|upper }}
> {{br.updated_at}}
> {{br.built_at}}
>   
> {% endfor %}
>
> The current problem is this would create a very long page... I am 
> wondering how to approach this problem so that I can have different page on 
> the template, and say 100 result per page, when i click the second page, 
> then  django will fetch result 100-200.
>
> Thanks!
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/f6a3df97-8218-4fb8-b200-f4535797e135%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/f6a3df97-8218-4fb8-b200-f4535797e135%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Jani Tiainen
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7e4a44fc-e5ce-4562-8b75-09ba065e34f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Raw SQL - How to approach paging and lazy fetching

2017-06-15 Thread Kevin Yu
Hi All,

I am using raw sql to connect to database. The reason we used raw sql 
instead of the Django model is because the database is legacy and is being 
shared by multiple applications...

I have one use case that I'm struggling right now. Basically I have a page 
that fetch more than 1000 results. My query is like this:

cursor = connection.cursor()
cursor.execute('''
SELECT br.id, br.name, br.created_at, br.updated_at,
br.branchpoint_str, br.source
FROM branches as br
LEFT JOIN branches_projects as bp
ON br.id = bp.branch_id 
WHERE bp.project_id = "%s" AND source != "other"
ORDER BY updated_at DESC
   ''', [int(project_id)]
   )

Then in my template, I have this:
{% for br in special_branches %}

  
{{br.name}}
{{br.branchpoint}}
{{ br.source|upper }}
{{br.updated_at}}
{{br.built_at}}
  
{% endfor %}

The current problem is this would create a very long page... I am wondering 
how to approach this problem so that I can have different page on the 
template, and say 100 result per page, when i click the second page, then 
 django will fetch result 100-200.

Thanks!

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f6a3df97-8218-4fb8-b200-f4535797e135%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


null=True and blank=False within model fields

2016-08-03 Thread Kevin Brown
Within Django REST framework a discussion sparked 
 about 
how the combination of null=True and blank=False should be handled with 
validation. What side is right in the discussion isn't the question here.

Are there cases where it makes sense to set both `null=True`, which should 
allow for `None` to be set on a field, and to set `blank=False`, which does 
not allow blank values to be set on the field?

And what is considered to be a "blank value" for a field?

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/048e1e36-cf1f-4087-b989-d527994eb79b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Possible bug with forms and arrays? Multiple forms on one view and Array fields in Models ---: Django and Postgres

2015-12-01 Thread Kevin Geyer
I get a strange error and I can't find the solution. The view is used to 
create data entries for a user but with an option to go back and edit hence 
the singular view to deal with an update...

The code works with only one form being pulled into the view but not with 
several, then it gives a nonsensical error. 

This is all in one app with its own set of urls.py

I have entered in the data raw for now in the form field rendered so eg 
interests : [1,2,3,4,5] in those fields
This worked as its should with no errors or abnormalities (data was updated 
in field)  but when i added skills through incremental development it shows 
this error:

 missing "]" in array dimensions
LINE 1: ...akeProfile_skills" SET "user_id" = 11, "skills" = 
 '[0,1,2,3,..

I am using :
postgres1.9
Python3.4
Django 1.8.7

Code:

view.py 

@login_required
def step2(request):

title =" Step 2 of 4 "
# if request.method.upper() == 'POST':
# print('hello free stackoverflow points')

#user_answer = UserAnswer.objects.get(user=request.user, question 
=instance)
#profile, created = Profile.objects.get_or_create(user=request.user)
form2p0 = step2p0Form()
form2p1 = step2p1Form()
form2p2 = step2p2Form()


context ={
"title":title,
"form2p0":form2p0,
"form2p1":form2p1,
"form2p2":form2p2,

}
#skills, created = Skills.objects.get_or_create(user=request.user)
if request.method.upper() == 'POST':

interests, created = 
Interests.objects.get_or_create(user=request.user)
skills, created = Skills.objects.get_or_create(user=request.user)
languages, created = 
Languages.objects.get_or_create(user=request.user)

form2p0 = step2p0Form(request.POST or None, instance= interests)
form2p1 = step2p1Form(request.POST or None, instance= skills)
form2p2 = step2p2Form(request.POST or None, instance= languages)

context ={
"title":title,
"form2p0":form2p0,
"form2p1":form2p1,
"form2p2":form2p2,

}

if  form2p0.is_valid() and form2p1.is_valid() and 
form2p2.is_valid():

instance2p0 =form2p0.save(commit=False)
instance2p1 =form2p1.save(commit=False)
instance2p2 =form2p2.save(commit=False)

interests = form2p0.cleaned_data.get('interests')
instance2p0.user = request.user
instance2p0.interest = interests

skills= form2p1.cleaned_data.get('skills')
instance2p1.user = request.user
instance2p1.skills = skills

languages =  form2p2.cleaned_data.get('languages')
instance2p2.languages = languages

instance2p0.save()
instance2p1.save()
instance2p2.save()


return HttpResponseRedirect(reverse('makeProfile:step3'))

return render(request, "profile/step2.html", context)


form.py 

class step2p0Form(forms.ModelForm):
class Meta:
   model =Interests
   fields = ['interests']

interests = forms.CharField(required = True)

class step2p1Form(forms.ModelForm):
class Meta:
model =Skills
fields = ['skills']

skills = forms.CharField(required = True)

class step2p2Form(forms.ModelForm):
class Meta:
model = Languages
fields =['languages']

languages = forms.CharField()

model.py

class Skills(models.Model):

user = models.OneToOneField(User,primary_key=True)
#skills = models.CharField(max_length = 128, null=True, blank=True)
skills =  ArrayField(models.IntegerField( null=True, blank=True, 
default = -1 ))


class Interests(models.Model):

user = models.OneToOneField(User,primary_key=True)
#interests = models.CharField(max_length = 128, null=True, blank=True)
interests =  ArrayField(models.IntegerField( null=True, blank=True, 
default = -1))


  

class Languages(models.Model):

user = models.OneToOneField(User,primary_key=True)

languages = 
 ArrayField(models.CharField(max_length=50,blank=True,default="None"))



#***SIGNALS***


@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_profile_handler(sender, instance, created, **kwargs):

if not created:
   print("hello#")
   return

profile = Profile(user=instance)
interests = Interests(user=instance)
skills= Skills(user=instance)
languages = Languages(user=instance)

interests.interests = [0]
skills.skills = [0]
languages.languages = ["None"]

skills.save()
interests.save()
languages.save()
profile.save()



DataError at /makeProfile/step2/
missing "]" in array dimensions
LINE 1: ...akeProfile_skills" SET "user_id" = 11, "skills" = 
 '[0,1,2,3,...
 ^
Request Method: 

Re: CSRF cookie not set issue

2015-09-12 Thread Kevin Anyanwu
Hi James,

Thanks for the response... I opened the *rendered* source page in Mozilla
and couldn't find the csrf_token even though I had already added the { %
csrf_token %} . Something seems wrong. Any suggestions moving forward ?

On Sat, Sep 12, 2015 at 12:56 AM, James Schneider <jrschneide...@gmail.com>
wrote:

> In the rendered version sent to the browser, are you able to validate that
> the CSRF token is actually being created and inserted as a hidden element
> in your form?
>
> Also, it doesn't look like any of your buttons are marked as type=submit.
> Not sure if that matters when submitting via JS though.
>
> -James
> On Sep 11, 2015 7:56 PM, "Kevin Anyanwu" <kanya...@fonality.com> wrote:
>
>> Can anyone help ?
>>
>> On Thu, Sep 10, 2015 at 8:34 PM, Kevin Anyanwu <kanya...@fonality.com>
>> wrote:
>>
>>> base_1.html
>>>
>>> 
>>> 
>>>   
>>> 
>>> 
>>> goals
>>> 
>>> 
>>>
>>> 
>>> 
>>> 
>>>
>>>   
>>>   
>>>
>>> 
>>> 
>>> Cirriculmn
>>> Notes
>>> Collaborte
>>> 
>>>
>>>
>>>   
>>> >> charset="utf-8">
>>> 
>>> 
>>> 
>>>   
>>> 
>>>
>>> On Thu, Sep 10, 2015 at 8:49 AM, monoBOT <monobot.s...@gmail.com> wrote:
>>>
>>>> show us the base_1.html
>>>>
>>>> 2015-09-10 16:18 GMT+01:00 <kanya...@fonality.com>:
>>>>
>>>>> By the way, I am using Django 1.8.3 (final)
>>>>>
>>>>>
>>>>> On Thursday, September 10, 2015 at 8:16:11 AM UTC-7,
>>>>> kany...@fonality.com wrote:
>>>>>>
>>>>>> First of all I have done my research and found no reasonable
>>>>>> explanation for my issue. I have a site on heroku that works fine on the
>>>>>> first page, but when I click a button that I have programmed to go to
>>>>>> another page, I obtain the infamous CSRF error. The reason for this error
>>>>>> is CSRF cookie is not set. Here is a description of the background work
>>>>>> done on the dev side:
>>>>>>
>>>>>> 1. Settings.py
>>>>>>
>>>>>> MIDDLEWARE_CLASSES = (
>>>>>> 'django.contrib.sessions.middleware.SessionMiddleware',
>>>>>> 'django.middleware.common.CommonMiddleware',
>>>>>> 'django.middleware.csrf.CsrfViewMiddleware',
>>>>>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>>>>>> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>>>>> 'django.contrib.messages.middleware.MessageMiddleware',
>>>>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>>>>>> #'django.middleware.security.SecurityMiddleware',
>>>>>>  'django.middleware.csrf.CsrfViewMiddleware',
>>>>>> )
>>>>>>
>>>>>> 2. base.py
>>>>>>
>>>>>> >>>>> "/menu/">
>>>>>> {% csrf_token %}
>>>>>>
>>>>>> 
>>>>>> >>>>> placeholder="Email address" type="text">
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>   >>>>> placeholder="Password" type="text">
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>
>>>>>> Log In
>>>>>>
>>>>>> 
>>>>>>
>>>>>>   
>>>>>>
>>>>>> 3. views.py
>>>>>>
>>>>>> def menu(request):
>>>>>>
>>>>>> return render_to_response('home/base_1.html', context_instance =
>>>>>> RequestContext(request, {}) )
>>>>>>
>>>>>> 4. javascript for the function logIn() that is executed when the
>>>>>> button is clicked from (2)
>>>>>>
>>>>>>
>>>>>> function logIn ()
>>>>>> {
>>>>&

Re: CSRF cookie not set issue

2015-09-11 Thread Kevin Anyanwu
Can anyone help ?

On Thu, Sep 10, 2015 at 8:34 PM, Kevin Anyanwu <kanya...@fonality.com>
wrote:

> base_1.html
>
> 
> 
>   
> 
> 
> goals
> 
> 
>
> 
> 
> 
>
>   
>   
>
> 
> 
> Cirriculmn
> Notes
> Collaborte
> 
>
>
>   
>  charset="utf-8">
> 
> 
> 
>   
> 
>
> On Thu, Sep 10, 2015 at 8:49 AM, monoBOT <monobot.s...@gmail.com> wrote:
>
>> show us the base_1.html
>>
>> 2015-09-10 16:18 GMT+01:00 <kanya...@fonality.com>:
>>
>>> By the way, I am using Django 1.8.3 (final)
>>>
>>>
>>> On Thursday, September 10, 2015 at 8:16:11 AM UTC-7,
>>> kany...@fonality.com wrote:
>>>>
>>>> First of all I have done my research and found no reasonable
>>>> explanation for my issue. I have a site on heroku that works fine on the
>>>> first page, but when I click a button that I have programmed to go to
>>>> another page, I obtain the infamous CSRF error. The reason for this error
>>>> is CSRF cookie is not set. Here is a description of the background work
>>>> done on the dev side:
>>>>
>>>> 1. Settings.py
>>>>
>>>> MIDDLEWARE_CLASSES = (
>>>> 'django.contrib.sessions.middleware.SessionMiddleware',
>>>> 'django.middleware.common.CommonMiddleware',
>>>> 'django.middleware.csrf.CsrfViewMiddleware',
>>>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>>>> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>>> 'django.contrib.messages.middleware.MessageMiddleware',
>>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>>>> #'django.middleware.security.SecurityMiddleware',
>>>>  'django.middleware.csrf.CsrfViewMiddleware',
>>>> )
>>>>
>>>> 2. base.py
>>>>
>>>> >>> "/menu/">
>>>> {% csrf_token %}
>>>>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>   >>> placeholder="Password" type="text">
>>>> 
>>>> 
>>>> 
>>>>
>>>> Log In
>>>>
>>>> 
>>>>
>>>>   
>>>>
>>>> 3. views.py
>>>>
>>>> def menu(request):
>>>>
>>>> return render_to_response('home/base_1.html', context_instance =
>>>> RequestContext(request, {}) )
>>>>
>>>> 4. javascript for the function logIn() that is executed when the button
>>>> is clicked from (2)
>>>>
>>>>
>>>> function logIn ()
>>>> {
>>>> alert('Form has been submitted');
>>>> document.getElementById('loginform').submit();
>>>> }
>>>>
>>>> I am seriously bewildered and cannot understand why the base_1.html
>>>> site is not being rendered and I am getting this CSRF error ! Please help
>>>> me,
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>> 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 group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/14ec3bc1-c7ff-4d3e-8065-9eae959720fc%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/14ec3bc1-c7ff-4d3e-8065-9eae959720fc%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> *monoBOT*
>> Visite mi sitio(Visit my site): monobotsoft.es/blog/
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/scpBffl8s3A/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2BxOsGCqOXSCs7dFDTNNfgEgKHk2vsbXNEmFN4LpkgNabgjVNA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CA%2BxOsGCqOXSCs7dFDTNNfgEgKHk2vsbXNEmFN4LpkgNabgjVNA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE1x1E12Yg%3DJWs9Q1vgnVwgJkBLOxU9CKjij5POzQUXFERDkEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: CSRF cookie not set issue

2015-09-10 Thread Kevin Anyanwu
base_1.html



  


goals







  
  



Cirriculmn
Notes
Collaborte



  




  


On Thu, Sep 10, 2015 at 8:49 AM, monoBOT  wrote:

> show us the base_1.html
>
> 2015-09-10 16:18 GMT+01:00 :
>
>> By the way, I am using Django 1.8.3 (final)
>>
>>
>> On Thursday, September 10, 2015 at 8:16:11 AM UTC-7, kany...@fonality.com
>> wrote:
>>>
>>> First of all I have done my research and found no reasonable explanation
>>> for my issue. I have a site on heroku that works fine on the first page,
>>> but when I click a button that I have programmed to go to another page, I
>>> obtain the infamous CSRF error. The reason for this error is CSRF cookie is
>>> not set. Here is a description of the background work done on the dev side:
>>>
>>> 1. Settings.py
>>>
>>> MIDDLEWARE_CLASSES = (
>>> 'django.contrib.sessions.middleware.SessionMiddleware',
>>> 'django.middleware.common.CommonMiddleware',
>>> 'django.middleware.csrf.CsrfViewMiddleware',
>>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>>> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>> 'django.contrib.messages.middleware.MessageMiddleware',
>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>>> #'django.middleware.security.SecurityMiddleware',
>>>  'django.middleware.csrf.CsrfViewMiddleware',
>>> )
>>>
>>> 2. base.py
>>>
>>> 
>>> {% csrf_token %}
>>>
>>> 
>>> 
>>> 
>>> 
>>> 
>>>   >> placeholder="Password" type="text">
>>> 
>>> 
>>> 
>>>
>>> Log In
>>>
>>> 
>>>
>>>   
>>>
>>> 3. views.py
>>>
>>> def menu(request):
>>>
>>> return render_to_response('home/base_1.html', context_instance =
>>> RequestContext(request, {}) )
>>>
>>> 4. javascript for the function logIn() that is executed when the button
>>> is clicked from (2)
>>>
>>>
>>> function logIn ()
>>> {
>>> alert('Form has been submitted');
>>> document.getElementById('loginform').submit();
>>> }
>>>
>>> I am seriously bewildered and cannot understand why the base_1.html site
>>> is not being rendered and I am getting this CSRF error ! Please help me,
>>>
>>>
>>>
>>>
>>>
>>> --
>> 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 group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/14ec3bc1-c7ff-4d3e-8065-9eae959720fc%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *monoBOT*
> Visite mi sitio(Visit my site): monobotsoft.es/blog/
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/scpBffl8s3A/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BxOsGCqOXSCs7dFDTNNfgEgKHk2vsbXNEmFN4LpkgNabgjVNA%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE1x1E1GHk135fGwxVG8e6Gk6EqD51Jv_JsEexE-7r0HuPhkTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Easy to use graphical reporting tools for SQL

2015-07-20 Thread Kevin
In our office we have a Django application that uses a MySQL database. 
Often I am asked to produce various reports that can range from being basic 
dumps of query results or aggregate computations on query results. To do 
this I must connect to the Django shell to use the ORM or write the SQL 
directly. The problem is that it is impossible for the non-developers to 
access reports unless they ask a developer to create the queries, run them, 
and send the result back. This adds to lots of communication overhead and 
delays.

Is there a basic free or open-source application that can connect to MySQL 
and allow non-developers to graphically build their own queries?

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ab5432b-6a89-4942-b103-ca059dceaf98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fixing a poorly written Django website (no unit tests)

2015-03-09 Thread Kevin Ndung'u
On Sunday, March 8, 2015 at 12:16:43 AM UTC+3, Some Developer wrote:
>
> On 06/03/15 16:23, Ilya Kazakevich wrote: 
> > You may start from highest level testing: 
> > 1) create "usage scenarios" for your website. Like "customer opens page 
> > 'foo', and should see 'bar'". You use such scenarios for manual testing, 
> > right? 
> > 2) code such scenarios against Django project. You may use BDD testing 
> > tools (like lettuce or behave), or do it in pure python. You may call 
> > Django views and templates directly (using django unittesting support or 
> > lettuce/harvest), or do it through the browser using Selenium. One 
> > scenario -- one method. Yes, there is a lot of boilerplate code, but you 
> > only need to write it once. BDD tools are used to simplify this process 
> > by writing scenarios on DSL called Gherkin, which is easier. 
> > 
> > This is some kind of "acceptance testing", the one that helps you to be 
> > sure website works like customer expects it to work. Every project 
> > should have one, I believe. 
> > 
> > After it, you may find that some units of your system are complex and 
> > error prone. What is unit? Unit is module, function or even package with 
> > _clear interface_. You then create unit tests against this module. Only 
> > units with complex logic need to be tested. No need to test simple view 
> > that just returns render(): this view is tested as part of high level 
> > testing. But if you have function "calc_user_amount" and complex 
> > business logic stands behind it, you may create unit test for it. 
> > 
> > There are 3 mistakes people do about testing: 
> > 1) Testing each function, even private function, even 1 line function. 
> > It takes a lot of time, and such tests are fragile. You throw'em away 
> > after simple refactoring. 
> > 2) Testing "in the middle of abstraction": I mean testing functions with 
> > out of clear interface, like private functions. If you need to read 
> > function code before writing test (pydoc is not enough), you should not 
> > test this function. Try a higher level of abstraction. 
> > 3) Skipping high level testing: even if all your code is covered with 
> > low-level unit-tests, you still need high level testing like the one 
> > with Selenium to make sure everything works correctly, and when you 
> > refactor your code you use such testing to make sure you did not break 
> > anything. 
> > 
> > So, you start with high level, and then cover _some_ units with unit 
> > test, if you believe they may contain error. 
> > 
>
> Awesome advice. Thanks! 
>
> I bought a book called "Test Driven Development using Python" and have 
> had a look through it a bit. It does seem a bit over the top (write no 
> code until you have a unit test for it in existence even if it is just a 
> one liner view function) but hopefully I'll be able to take some of the 
> advice and use it to fix up my code base. 
>
> Has anyone else read the book? Any opinions? 
>


I have read the book and it got me started in Django when I knew absolutely 
nothing about testing.
Though it might be a bit over the top, it manages to teach you the concepts 
so that you can later on apply on them on your own.
I highly recommend it.

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/24e0e29c-5e3d-4750-aebe-96d49fac247f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Tests failing after adding django-bower app

2015-03-09 Thread Kevin Ndung'u
 I have a peculiar case where after adding the django-bower app to my 
Django project, all of a sudden my tests are failing on the CI server but 
they are passing when I run them locally.

I have posted the details on Stackoverflow. Any help would be greatly 
appreciated. 

https://stackoverflow.com/q/28936003/2390312

Thanks in advance.

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/39cb3705-1901-4b7c-a3db-31fa02f83e31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cURL or wget with contrib.auth and CSRF

2014-12-04 Thread Kevin Trainor
David,

I realize this was a long time ago, wondering if you ever got it working.

I'm battling the same dragon currently.

Step 1: seems to work
wget --save-cookies c:\cifs\cookies.txt --keep-session-cookies 
--no-check-certificate --http-user=myuser --http-password=mypass 
https://www.pdfstore.com/
which will save the session cookie allowing you to perform a second wget 
using the saved cookies

Step 2: Is where I'm getting an error "Error 400 not-valid csrf token"
wget --load-cookies c:\cifs\cookies.txt --no-check-certificate --no-parent 
--recursive https://www.pdfstore.com/pdfvault/?T=null

I'm inclined to think that wget cannot save csrf tokens in the same way it 
can session cookies. Wondering if you ever found a way out of this dragons 
den?

Not sure if it makes a diff but im running on windows7 going through a 
bluecoat proxy on the way out so using Unixutils as it allows me to set the 
proxy config.

Thanks,
Kevin


On Thursday, April 14, 2011 4:32:46 AM UTC-7, David wrote:
>
> Hello, 
>
> I am sorry for asking this, I know similar questions have been asked 
> before but I could not piece together the answer I needed from 
> previous contribution! 
>
> I have a view, for example: 
>
> @login_required 
> def clever_view(request): 
> #Render a PDF to a string 
> response = HttpResponse(content_type='application/pdf') 
> response.write(pdf_as_string) 
> return response 
>
> Now, in a browser, if I request http://my.host.name/clever_view.pdf I 
> get sent to the log in page, I log in, and I get my file. If I don't 
> log out I can later on request http://my.host.name/clever_view.pdf and 
> I get the file strait away. The browser handles the session and csrf 
> cookies perfectly. 
> For clarity, the login requires POST inputs 'username', 'password' and 
> the submit button is called 'submit'. 
>
> Now a client wants to use wget or curl to get the file: 
>
> wget http://my.host.name/clever_view.pdf 
>
> However, all I get are 403 even when I POST the username and password, 
> save the cookies and keep the session cookies. 
>
> So in short, how do I access a view when session and csrftoken cookies 
> are required. 
>
> If someone could show me an example of using curl or wget to access a 
> view that is not wrapped with @csrf_exempt but is wrapped with 
> @login_required I would be very grateful indeed. 
>
> Thanks in advance 
>
> Dave 
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a4bd863c-aa3c-45fd-bf0a-54acd5a8b8b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: heroku django

2014-09-11 Thread Kevin Ndung'u
There is really no difference when you add it to Github or Heroku, in my 
opinion. Achieves the same result in the end.

On Thursday, September 11, 2014 11:42:12 AM UTC+3, ngangsia akumbo wrote:
>
> or should i create my app locally add it on git hub and clone it on heroku
> if that is a better process please can some one guide me through?
>
> On Thursday, September 11, 2014 9:29:39 AM UTC+1, ngangsia akumbo wrote:
>>
>> i have a problem
>> can i create a complete django application on my machine before deplying 
>> it to heroku
>>
>> that is i start by creating the django app on my local linux machine 
>> before trying to deploy it online
>> i a confused here a bit pleas i need some help
>>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/98f85c8a-19be-4796-8ee8-42b89e8206bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: heroku django

2014-09-11 Thread Kevin Ndung'u
Yes, you can. You can develop locally then when the time comes to deploy it 
then add it to Github and subsequently to Heroku.

I personally prefer this since you get to focus on the app first and deploy 
later.

On Thursday, September 11, 2014 11:29:39 AM UTC+3, ngangsia akumbo wrote:
>
> i have a problem
> can i create a complete django application on my machine before deplying 
> it to heroku
>
> that is i start by creating the django app on my local linux machine 
> before trying to deploy it online
> i a confused here a bit pleas i need some help
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7becb5b4-4da0-4ac3-9aba-8a893075a846%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: deploying django on heroku

2014-09-07 Thread Kevin Ndung'u
As it says, just run those commands, setting your username and email, to 
set your git identity (Username and Email address) which is required for 
commits.

On Saturday, September 6, 2014 1:21:09 PM UTC+3, ngangsia akumbo wrote:
>
> i have another error
>
> yems python-getting-started # git commit -m "Demo"
>
> *** Please tell me who you are.
>
> Run
>
>   git config --global user.email "y...@example.com "
>   git config --global user.name "Your Name"
>
> to set your account's default identity.
> Omit --global to set the identity only in this repository.
>
> fatal: unable to auto-detect email address (got 'root@yems.(none)')
>
>
> On Friday, September 5, 2014 4:10:59 PM UTC+1, Koed00 wrote:
>>
>> Looks like Gunicorn can't find your app module hellodjango.wsgi
>> Did you make a wsgi.py in your app folder as described in the Heroku docs?
>>
>> On Friday, September 5, 2014 12:19:25 PM UTC+2, ngangsia akumbo wrote:
>>>
>>> i had a problem trying to deply django on heroku
>>>
>>> yems bphotel # foreman start
>>> 11:13:37 web.1  | started with pid 9269
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9269] [INFO] Starting 
>>> gunicorn 19.1.1
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9269] [INFO] Listening 
>>> at: http://0.0.0.0:5000 (9269)
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9269] [INFO] Using 
>>> worker: sync
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9276] [INFO] Booting 
>>> worker with pid: 9276
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9276] [ERROR] Exception 
>>> in worker process:
>>> 11:13:37 web.1  | Traceback (most recent call last):
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 507, in 
>>> spawn_worker
>>> 11:13:37 web.1  | worker.init_process()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 
>>> 114, in init_process
>>> 11:13:37 web.1  | self.wsgi = self.app.wsgi()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 66, in 
>>> wsgi
>>> 11:13:37 web.1  | self.callable = self.load()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, 
>>> in load
>>> 11:13:37 web.1  | return self.load_wsgiapp()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, 
>>> in load_wsgiapp
>>> 11:13:37 web.1  | return util.import_app(self.app_uri)
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 356, in 
>>> import_app
>>> 11:13:37 web.1  | __import__(module)
>>> 11:13:37 web.1  | ImportError: No module named hellodjango.wsgi
>>> 11:13:37 web.1  | Traceback (most recent call last):
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 507, in 
>>> spawn_worker
>>> 11:13:37 web.1  | worker.init_process()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 
>>> 114, in init_process
>>> 11:13:37 web.1  | self.wsgi = self.app.wsgi()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 66, in 
>>> wsgi
>>> 11:13:37 web.1  | self.callable = self.load()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, 
>>> in load
>>> 11:13:37 web.1  | return self.load_wsgiapp()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, 
>>> in load_wsgiapp
>>> 11:13:37 web.1  | return util.import_app(self.app_uri)
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 356, in 
>>> import_app
>>> 11:13:37 web.1  | __import__(module)
>>> 11:13:37 web.1  | ImportError: No module named hellodjango.wsgi
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9276] [INFO] Worker 
>>> exiting (pid: 9276)
>>> 11:13:37 web.1  | Traceback (most recent call last):
>>> 11:13:37 web.1  |   File "/usr/local/bin/gunicorn", line 11, in 
>>> 11:13:37 web.1  | sys.exit(run())
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 74, 
>>> in run
>>> 11:13:37 web.1  | WSGIApplication("%(prog)s [OPTIONS] 
>>> [APP_MODULE]").run()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 185, in 
>>> run
>>> 11:13:37 web.1  | super(Application, self).run()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 71, in 
>>> run
>>> 11:13:37 web.1  | Arbiter(self).run()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 169, in 
>>> run
>>> 11:13:37 web.1  | self.manage_workers()
>>> 11:13:37 web.1  |   File 
>>> 

TypeError : Unable to save m2m relation modelform

2014-08-14 Thread kevin
Type Error : 'ExtendedTag' instance expected, got 

I had created m2m field (required false). When I tried to save form with 
parent select (from multiple choice field), It rises type error. When I 
tried to save it without selecting parent and category, it work fine. I 
couldn't able to figure out what I am missing. 
Code Snipped (full available at https://github.com/Pattinson/m2mdemo)

models.py

class BasicTag(models.Model):
name = models.CharField(max_length=150, verbose_name="Tag Name")
image_class = models.CharField(max_length=30, blank=True)
color = models.CharField(max_length=10, blank=True)

def __unicode__(self):
return self.name

class ExtendedTag(models.Model):
parent = models.ManyToManyField(BasicTag, blank=True,
related_name="parent")
category = models.ManyToManyField(BasicTag, blank=True,
  related_name="category")

def __unicode__(self):
return self._id

class CombineTag(BasicTag, ExtendedTag):
"""

"""

forms.py

class CombineTagForm(forms.ModelForm):
class Meta:
model = CombineTag


I had follow official doc 

 which 
say that

If your model has a many-to-many relation and you specify commit=False when 
you save a form, Django cannot immediately save the form data for the 
many-to-many relation. This is because it isn’t possible to save 
many-to-many data for an instance until the instance exists in the database.

Errors

Request Method: POST
Request URL: http://127.0.0.1:8080/
Django Version: 1.6.5
Exception Type: TypeError
Exception Value:

'ExtendedTag' instance expected, got 
Exception Location: 
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in _add_items, line 649
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path:

['/home/virus/project/m2mdemo',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
Server time: Thu, 14 Aug 2014 18:37:29 +
Traceback Switch to copy-and-paste view

/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in 
get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
▶ Local vars
/home/virus/project/m2mdemo/tag/views.py in add
form.save_m2m() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/forms/models.py in save_m2m
f.save_form_data(instance, cleaned_data[f.name]) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in save_form_data
setattr(instance, self.attname, data) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in *set*
manager.add(*value) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in add
self._add_items(self.source_field_name, self.target_field_name, *objs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in _add_items
raise TypeError("'%s' instance expected, got %r" % 
(self.model._meta.object_name, obj)) ...
▶ Local vars

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b211f94e-5927-404c-a35a-f6020acfc73c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Sending mass email in Django

2014-07-28 Thread Kevin Ndung'u

Hi people,

I am currently maintaining a website where at times I may need to send 
around 10,000+ emails at a time.

I just want to ask on what methods you may consider Django best practices 
e.g. in efficiency when sending mail to a list of this size?

I am currently handling this as a celery task and sending the emails 
through Mandrill  transactional email service 

Currently, this is how I am handling it:

from django.core.mail import EmailMultiAlternatives, get_connection
from models import Subscriber

connection = get_connection()
recipients = [i.email for i in Subscriber.objects.all()]

for sub in subscribers:
msg = EmailMultiAlternatives(title, content, sender, [sub])
msg.attach_alternative(content, "text/html")
recipient_list.append(msg)

connection.send_messages(recipients)

Is it better to split the list into smaller chinks to reduce the size of 
the requests or which other implementation methods can I consider?

Thanks

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/16702abe-7923-4cf7-b51d-15fb19438d6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Version number comparison and beta

2014-05-01 Thread Kevin Golding
Hi all
I'm trying to update some existing code so that it will be compatible with 
1.7, in particular the use of settings.AUTH_USER_MODEL instead of 
get_user_model().
Given the differences I'm going to have to check the version numbers and 
then have two alternatives eg:

if StrictVersion(get_version()) >= StrictVersion('1.7'):
   new code
else:
   old code

However the current version number for 1.7 is 1.7b3, which is treated as being 
less than 1.7 according to StrictVersion.
In order to get it to work the way I want right now I'm going to have to 
compare with a version number such as 1.7a1, 
but this is going to look pretty ugly going forward.

What is the best practice for doing version number comparisons taking into 
account the existence of beta version numbers?

Thanks
Kevin

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c74612d3-87c7-4f4e-a709-416038fe1860%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Announcing native Chameleon template engine support in Django

2013-11-08 Thread Kevin
Hello Django users!

  Today I sat down and wrote a native template Loader for Chameleon support 
in Django.  For those not familiar with this template engine, it was used 
in the previously infamous Zope and later Plone web frameworks.  It uses 
mostly XHTML formatting and documentation generation, and is supposedly 
very fast!  You can find the project over on my BitBucket page here:

https://bitbucket.org/kveroneau/django-chameleon-templates

  The README file explains it's usage, and it also contains some example 
templates and a standard Django view to see it in action.  The project 
itself has drop-in replacements for Django's own filesystem.Loader and 
app_directories.Loader, so using it with your existing Django projects 
couldn't be easier.  On top of these drop-in replacement, it has another 
Loader which instead of using TEMPLATE_DIRS like filesystem.Loader does, it 
uses another settings variable called CHAMELEON_TEMPLATES, which uses the 
exact same format.

  This project can for example help those moving from either Pyramid or a 
Zope/Plone solution over to Django.  As it uses the Django API natively, 
including it's context variables.  Furthermore, I also included Django's 
URL Reversal into Chameleon, so you can still properly generate your URLs 
like normal.  There is even a METAL macro to generate the CSRF_TOKEN 
construct.

  It does not support Django's native template tags and filters, but most 
of them aren't really needed.  If you have your own custom tags or filters, 
they will need to be recoded for Chameleon.  Adding new METAL macros takes 
on a similar method to how you add new template tags and filters.  You mere 
just create a macros/ directory inside your apps directory, and place .pt 
template files in there with the macro definitions.  The filename is used 
for the namespace inside the Chameleon template engine.  For example, say 
you have a macro file called example.pt with the following contents:


  Hello, World

To use this macro inside any other template in your project, you merely use 
either of the following:



- Or -


  Kevin


Wonderful, isn't it?  It makes working with Chamelon inside Django super 
simple and very Django-like.

I hope to soon add the ability to add new expressions into the template 
engine using some sort of registry, similar to how Django's own template 
engine adds new tags.

Let me know if you have any questions or comments about this Django app.

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d691b6d2-a2e3-489f-b8e7-cd9a810e1d92%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Bootstrap and Django together at last!

2013-06-01 Thread Kevin
Hello Artem,

  There are no requirements but Django, and my blog post is essentially the 
README file:
http://www.pythondiary.com/blog/May.25,2013/django-bootstrap-theme-ready.html

  After looking at the packages you provided below, here is my assessment 
on why I created my own based on what these existing ones do.  I have used 
Django bootstrap apps/themes/etc in the past and I literally hated them 
all.  They didn't do what I wanted, or required too much work to get 
working.  My Django app is just that, an app!  Place it in your goddamn 
INSTALLED_APPS and your done!  I've included an example project to show 
just how easy it is to use compared to existing solutions I have seen.

django-modern-template:  The project layout it creates adds a lot of extra 
files, why isn't this an app, why did the developer make it an entire 
project?  I may use it, if I could easily integrate it into existing 
projects.

django-bootstrap-template:  This one comes with it's own "project layout".  
I want something that uses Django as is, not something that I need to use 
an entirely new project layout for.  This package also doesn't include 
Djangofied(is that a real word?) bootstrap example templates to get a 
project up and running very super quickly:
http://twitter.github.io/bootstrap/getting-started.html#examples

In contrast to my new package, it includes every single bootstrap example 
template turned into a "proper" Django template, which can easily be 
extended.  Check out the example project...

django-twitter-bootstrap:  This is better than the previous one, but still 
doesn't include any templates, it merely bundles all the static files into 
a Django app... Not much effort or thought on the developers when putting 
this together.

django-bootstrapped:  I have used this one in the past, I attempted to love 
it... But again, it's missing some key features, such as the bootstrap 
example templates for a quick start.

  This is why most people create their own solution because existing 
solutions don't seem to do what they want out of the box.  It is entirely 
your choice which one of these bootstrap packages you use, I'm not going to 
force you to use any particular package.  This is why open source is great, 
because we as developers have something called "choice".

Best Regards,
  Kevin Veroneau

On Saturday, 1 June 2013 11:17:22 UTC-5, Artem Zinoviev wrote:
>
> https://github.com/nigma/django-modern-template
> https://bitbucket.org/danjac/django-bootstrap-template
> https://github.com/estebistec/django-twitter-bootstrap
> https://github.com/rbrady/django-bootstrapped
>
> and all templates include bootstrap and other things:
> https://www.djangopackages.com/grids/g/project-templates/
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Kevin
Hello Nik,

  Yes, I can definitely understand the frustrations a PHP developer may 
have when moving away from it.  PHP is very unique in that's it's one of 
the rare web technologies which has a deployment like it does.  The 
original Active Server Pages and CGI also share the same deployment 
scheme.  Usually programming languages which were not originally intended 
for the web use complex deployment structures, as seen with Python, Ruby, 
and ASP.Net.  I am in agreement that deployment shouldn't be difficult.  I 
have successfully deployed many Django powered websites, on private 
servers, and on cloud services such as RedHat OpenShift and 
PythonAnywhere.  Kudos to PythonAnywhere for creating such a remarkable 
service, and their service will definitely be mentioned in the course.  
Originally I was going to focus the course around PythonAnywhere, where 
students would create an account there and do all their development in the 
cloud service.  However, since I wanted to focus on the utter basics of the 
framework for at least the first couple chapters, I thought mentioning this 
service would take time away from actually learning Django.

  Needless to say, there will be at least a couple chapters which provide a 
good basis for a successful deployment and how to troubleshoot issues along 
the way.

Best Regards,
  Kevin Veroneau
  PythonDiary.com

On Tuesday, 28 May 2013 16:37:06 UTC-5, Nikolas Stevenson-Molnar wrote:
>
> Deployment in general is something you should be sure to cover. 
> Especially when people are coming from the PHP world, deployment is 
> quite different. It seems like there are often questions on this list 
> around deployment problems, and they are often fairly trivial issues. 
>
> _Nik 
>
> On 5/28/2013 2:01 PM, Subodh Nijsure wrote: 
> > This is all IMHO. 
> > 
> > One of the thing that has been missing from many django books: 
> > 
> > How do you "marry" the current best practices for --deploying-- large 
> > scale web applications when using django. 
> > 
> > What are the best practices for enabling, monitoring caching? 
> > Implementing search using haystack or some other extensions? 
> > Would be interesting to find out, learn from best practices regarding 
> > how large  software development teams work on django projects. 
> > 
> > -Subodh 
> > 
> > On Tue, May 28, 2013 at 11:34 AM, Kevin <kver...@gmail.com > 
> wrote: 
> >> Sean, 
> >> 
> >>   Thank you for your input.  Having those types of examples would 
> actually 
> >> be a great idea for the course, as these are some of the most popular 
> >> website being developed in our social web 2.0 these days. 
> >> 
> >>   As for your thought on inputting financial data, I actually built a 
> >> personal financial manager in Django, and Django has the form 
> facilities to 
> >> validate complex financial forms and tell the user to correct any 
> issues 
> >> with their input.  This would actually be a great idea for an example 
> as 
> >> well, since Django manages form validation very well.  I have this 
> personal 
> >> application up on my BitBucket page if you wanted to take a look at it, 
> >> here's a link to the actual app: 
> >> 
> >> 
> https://bitbucket.org/kveroneau/django-pim/src/fffb63b6d03050b30d134bbe39d862e5004a90da/pcbank?at=default
>  
> >> 
> >>   Keep in mind that this app is some of my much earlier work, stuff I 
> built 
> >> when I was first learning the framework.  This was first built on 
> Django 1.2 
> >> I believe, so it still does use function-based generic views.  I do 
> have it 
> >> running currently on a website, and use it all the time to manage my 
> >> personal financial data, such as bills and debt. 
> >> 
> >> 
> >> Best Regards, 
> >>   Kevin Veroneau 
> >>   PythonDiary.com 
> >> 
> >> 
> >> On Tuesday, 28 May 2013 12:29:20 UTC-5, SeanJ wrote: 
> >>> Kevin, 
> >>> 
> >>> Looking forward to what you come up with.  I'd be willing to be a 
> guinea 
> >>> pig for the course. 
> >>> 
> >>> First, I am a hobbyist developer (Java, Groovy/Grails, 
> JS/Jquery/HTML5, 
> >>> PL/SQL, Python/Django), not a pro, and relatively new at it.  My day 
> job is 
> >>> a Software QA Manager for 40,000+ employee ERP Web App. 
> >>> Just for the fun of it I've been exploring Django.  I've been through 
> all 
> >>> the usual places on the web (djangoproject, djangobook, and others, 
> and all 
> >>> the youtube tutorials) and I'm curr

Bootstrap and Django together at last!

2013-05-28 Thread Kevin
Hello everyone!

  I thought I'd provide a recently released Django app I built.  I have 
listed it on several Django communities including my blog, but I feel it 
would also be great to everyone if I also provide a link here as well.

https://bitbucket.org/kveroneau/django-bootstrap-theme

  Now your wondering, why should you use this?  Well, it's a Django app!  
And it makes integrating Bootstrap into your project super easy.  It comes 
packed with all the Bootstrap example HTML templates in Django template 
format which you can easily extend into your own project.  There is an 
example project to display how this is done as well.  There is also a wide 
variety of templatetags for specifically working with Django templates and 
bootstrap.  Need to add a bunch of stars on a template to display a rating 
for a model?  No problem, there's a template filter for that!  Need to 
create a modal window with as little effort as possible?  Not a problem, 
use the new modal template block tag and your set!  If you've been using 
bootstrap with Django before this, you'll immediately want to convert over 
just because of all the shear helpers included to make using bootstrap in 
Django so much easier and less stressful!

  The documentation is on my blog post announcing the app itself:

http://www.pythondiary.com/blog/May.25,2013/django-bootstrap-theme-ready.html

  It explains all the available "base templates" you can extend, and the 
available templatetags.

Best Regards,
  Kevin Veroneau
  PythonDiary.com

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Kevin
Hello Subodh,

  Thank you for your input.  I actually have a large amount of knowledge in 
caching with Django, and all my Django powered sites using caching in some 
form or another.  There is an entire section devoted to caching, and if any 
indicator on how long I made Chapter 1 and how long Chapter 2 is going to 
be...  I am sure the caching chapter will be nothing short than thorough.  
There are so many ways you can use caching in Django, and most people don't 
understand which method to use when, and a large amount of developers don't 
even know how to "uncache" template fragments, which will also be shown in 
the course.  I use template fragment caching in lots of website, but how 
does one uncache them after a model has been updated?  I'll be showing this 
awesome secret in the course.  It's something every Django developer should 
know, as it creates a very optimal and high speed application.  I strive to 
hit the database as little as possible, I monitor the amount of SQL queries 
using the infamous Django Debug Toolbar(which will also be mentioned in the 
course).  I will also be going through the steps I use to create a Django 
website, what I start with, and what I do closer to actual deployment, and 
how I test various functions before deployment.

  My Uarica project actually uses Haystack, and I have experience in that 
too.

  The chapter on Revision Systems will cover all the popular SCM software 
and the pros and cons when using them in a "team environment", so you'll be 
covered there as well.  I am trying to make this course as extensive as 
possible, covering many aspects which other tutorials or books either don't 
cover at all, or just get your toe wet for a page.  This course has entire 
chapters dedicated to using a single app, and to integrate it into your 
overall Django website.  It's definitely going to be worth the price of 
admission, and should prove useful to both seasoned vets and novices alike.

  I do plan on having many chapters on different deployment methods, one 
chapter which will be there for sure is deployment using uWSGI, as it is 
gaining popularity and it is also my deployment method of choice.  uWSGI 
has lots of potential and can scale up Django websites with ease.  
Unfortunately this tool isn't expressed much on many Django tutorials and 
books, so many people do not understand how to use it's numerous amount of 
options to deploy a successful multi-tier Django server farm.

Best Regards,
  Kevin Veroneau
  PythonDiary.com

On Tuesday, 28 May 2013 16:01:23 UTC-5, Subodh Nijsure wrote:
>
> This is all IMHO. 
>
> One of the thing that has been missing from many django books: 
>
> How do you "marry" the current best practices for --deploying-- large 
> scale web applications when using django. 
>
> What are the best practices for enabling, monitoring caching? 
> Implementing search using haystack or some other extensions? 
> Would be interesting to find out, learn from best practices regarding 
> how large  software development teams work on django projects. 
>
> -Subodh 
>
> On Tue, May 28, 2013 at 11:34 AM, Kevin <kver...@gmail.com > 
> wrote: 
> > Sean, 
> > 
> >   Thank you for your input.  Having those types of examples would 
> actually 
> > be a great idea for the course, as these are some of the most popular 
> > website being developed in our social web 2.0 these days. 
> > 
> >   As for your thought on inputting financial data, I actually built a 
> > personal financial manager in Django, and Django has the form facilities 
> to 
> > validate complex financial forms and tell the user to correct any issues 
> > with their input.  This would actually be a great idea for an example as 
> > well, since Django manages form validation very well.  I have this 
> personal 
> > application up on my BitBucket page if you wanted to take a look at it, 
> > here's a link to the actual app: 
> > 
> > 
> https://bitbucket.org/kveroneau/django-pim/src/fffb63b6d03050b30d134bbe39d862e5004a90da/pcbank?at=default
>  
> > 
> >   Keep in mind that this app is some of my much earlier work, stuff I 
> built 
> > when I was first learning the framework.  This was first built on Django 
> 1.2 
> > I believe, so it still does use function-based generic views.  I do have 
> it 
> > running currently on a website, and use it all the time to manage my 
> > personal financial data, such as bills and debt. 
> > 
> > 
> > Best Regards, 
> >   Kevin Veroneau 
> >   PythonDiary.com 
> > 
> > 
> > On Tuesday, 28 May 2013 12:29:20 UTC-5, SeanJ wrote: 
> >> 
> >> Kevin, 
> >> 
> >> Looking forward to what you come up with.  I'd be willing to be a 
> guinea 
> &g

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Kevin
Sean,

  Thank you for your input.  Having those types of examples would actually 
be a great idea for the course, as these are some of the most popular 
website being developed in our social web 2.0 these days.

  As for your thought on inputting financial data, I actually built a 
personal financial manager in Django, and Django has the form facilities to 
validate complex financial forms and tell the user to correct any issues 
with their input.  This would actually be a great idea for an example as 
well, since Django manages form validation very well.  I have this personal 
application up on my BitBucket page if you wanted to take a look at it, 
here's a link to the actual app:

https://bitbucket.org/kveroneau/django-pim/src/fffb63b6d03050b30d134bbe39d862e5004a90da/pcbank?at=default

  Keep in mind that this app is some of my much earlier work, stuff I built 
when I was first learning the framework.  This was first built on Django 
1.2 I believe, so it still does use function-based generic views.  I do 
have it running currently on a website, and use it all the time to manage 
my personal financial data, such as bills and debt.

Best Regards,
  Kevin Veroneau
  PythonDiary.com


On Tuesday, 28 May 2013 12:29:20 UTC-5, SeanJ wrote:
>
> Kevin,
>  
> Looking forward to what you come up with.  I'd be willing to be a guinea 
> pig for the course.
>  
> First, I am a hobbyist developer (Java, Groovy/Grails, JS/Jquery/HTML5, 
> PL/SQL, Python/Django), not a pro, and relatively new at it.  My day job is 
> a Software QA Manager for 40,000+ employee ERP Web App.
> Just for the fun of it I've been exploring Django.  I've been through all 
> the usual places on the web (djangoproject, djangobook, and others, and all 
> the youtube tutorials) and I'm currently redeveloping 2 apps in django that 
> I originally wrote in other languages/frameworks -- just as an exercise to 
> see how django handles them.
>  
> Second, My 2 cents on your outline and my request for content:  I know 
> with its newsy roots django excels in the blog/wiki/social posting space so 
> there is a bit of glut in the django tutorial world for these types of 
> examples, but I'm coming from a business web perspective and I don't find 
> much out there on incorporating user number input (financial or other 
> quantity) type data from forms which is then processed through some 
> business logic in the view and redisplayed for validation by the user 
> before being comitted to the database for storage.
>  
> Apart from those 2 cents, your outline looks good.  And I think JQuery is 
> almost as much a part of the finished product as HTML these days.  I think 
> many will benefit from learning how to incorporate that library.
>  
> Regards,
>  
> Sean
>  
> On Monday, May 27, 2013 3:02:58 PM UTC-7, Kevin wrote:
>
>> Hello everyone!
>>
>>   It's been quite sometime since I have been on here, well I came back 
>> with some great news!  I am currently in the process of building an online 
>> Django web course aimed at both new and old Django developers.  I will be 
>> charging a minimal fee for access to the entire course, but the first 3 
>> chapters of the main sections will be free for everyone to read and enjoy.  
>> The course software itself is built using Django naturally.
>>
>>   The course software has been completed and uploaded online.  I am now 
>> in the lengthily process of writing up all the chapters, quizzes, example 
>> code, and full projects.  This is going to be a large amount of work, 
>> however at the current moment this is my only job and that is why I am 
>> planning on charging for admittance.  I am aiming to have a large amount of 
>> it completed by around the middle of June and ready for public consumption 
>> shortly after.
>>
>>   I have decided to give a lucky few free access to the entire course for 
>> the purpose of reviewing and providing me with feedback.  If you are 
>> interested, please reply back to me and explain why I should select you.  I 
>> will then select 5 lucky individuals and email them their access 
>> credentials and a link to the actual course's website when it's ready.
>>
>>   Here's a little background information about myself, since I haven't 
>> been on here recently.  I am the current maintainer and author of 
>> PythonDiary.com, which has been a relatively successful Python blog since 
>> January of 2012.  Over 500 users visit the blog each day, and if a new 
>> article is available this amount can increase to over 1,000 hits.  Many of 
>> my articles and tutorials are related to Django, and most of my user base 
>> uses Django or wants to learn it.  I have received many requests from users 
>> t

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Kevin
A small update, I just completed the first chapter and laid out the rest of 
the chapters which will be made available.  You can view the current 
chapter list on my Uarica project page:

http://uarica.com/+12

Here's the link to the chapter list of the "Core Framework" section:
http://www.uarica.com/kveroneau/django-course/Apps/Wiki/CoreFramework

Let me know what you think of the current list of Chapters, I know "jQuery" 
isn't technically part of the Core Framework, but it's not an app either.  
Anything which doesn't require external Django apps will be placed in "Core 
Framework".  Many people seem to be asking about jQuery and Django, and 
it's one of the top search terms coming to my blog, so expect this chapter 
to be extensive.

On Monday, 27 May 2013 17:02:58 UTC-5, Kevin wrote:
>
> Hello everyone!
>
>   It's been quite sometime since I have been on here, well I came back 
> with some great news!  I am currently in the process of building an online 
> Django web course aimed at both new and old Django developers.  I will be 
> charging a minimal fee for access to the entire course, but the first 3 
> chapters of the main sections will be free for everyone to read and enjoy.  
> The course software itself is built using Django naturally.
>
>   The course software has been completed and uploaded online.  I am now in 
> the lengthily process of writing up all the chapters, quizzes, example 
> code, and full projects.  This is going to be a large amount of work, 
> however at the current moment this is my only job and that is why I am 
> planning on charging for admittance.  I am aiming to have a large amount of 
> it completed by around the middle of June and ready for public consumption 
> shortly after.
>
>   I have decided to give a lucky few free access to the entire course for 
> the purpose of reviewing and providing me with feedback.  If you are 
> interested, please reply back to me and explain why I should select you.  I 
> will then select 5 lucky individuals and email them their access 
> credentials and a link to the actual course's website when it's ready.
>
>   Here's a little background information about myself, since I haven't 
> been on here recently.  I am the current maintainer and author of 
> PythonDiary.com, which has been a relatively successful Python blog since 
> January of 2012.  Over 500 users visit the blog each day, and if a new 
> article is available this amount can increase to over 1,000 hits.  Many of 
> my articles and tutorials are related to Django, and most of my user base 
> uses Django or wants to learn it.  I have received many requests from users 
> to expand on my Django tutorials, however I lack the personal time required 
> to write these articles.  To that affect, I have ultimately decided to 
> create an entire Django web-based course for a very low cost.  The cost is 
> much cheaper than a typical Django book available today and will touch on 
> more advanced concepts and also explain how to integrate and use popular 
> 3rd party Django apps.  After reading many Django books, I always see them 
> missing on some key concepts or don't explain how to use particular 3rd 
> party apps.  I have been building Django powered websites since around 2010 
> and have a large amount of experience with the framework that I can share 
> with others.
>
> Best Regards,
>   Kevin Veroneau
>   PythonDiary.com
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Creating a "Django Course" and would like some feedback

2013-05-27 Thread Kevin
Hello everyone!

  It's been quite sometime since I have been on here, well I came back with 
some great news!  I am currently in the process of building an online 
Django web course aimed at both new and old Django developers.  I will be 
charging a minimal fee for access to the entire course, but the first 3 
chapters of the main sections will be free for everyone to read and enjoy.  
The course software itself is built using Django naturally.

  The course software has been completed and uploaded online.  I am now in 
the lengthily process of writing up all the chapters, quizzes, example 
code, and full projects.  This is going to be a large amount of work, 
however at the current moment this is my only job and that is why I am 
planning on charging for admittance.  I am aiming to have a large amount of 
it completed by around the middle of June and ready for public consumption 
shortly after.

  I have decided to give a lucky few free access to the entire course for 
the purpose of reviewing and providing me with feedback.  If you are 
interested, please reply back to me and explain why I should select you.  I 
will then select 5 lucky individuals and email them their access 
credentials and a link to the actual course's website when it's ready.

  Here's a little background information about myself, since I haven't been 
on here recently.  I am the current maintainer and author of 
PythonDiary.com, which has been a relatively successful Python blog since 
January of 2012.  Over 500 users visit the blog each day, and if a new 
article is available this amount can increase to over 1,000 hits.  Many of 
my articles and tutorials are related to Django, and most of my user base 
uses Django or wants to learn it.  I have received many requests from users 
to expand on my Django tutorials, however I lack the personal time required 
to write these articles.  To that affect, I have ultimately decided to 
create an entire Django web-based course for a very low cost.  The cost is 
much cheaper than a typical Django book available today and will touch on 
more advanced concepts and also explain how to integrate and use popular 
3rd party Django apps.  After reading many Django books, I always see them 
missing on some key concepts or don't explain how to use particular 3rd 
party apps.  I have been building Django powered websites since around 2010 
and have a large amount of experience with the framework that I can share 
with others.

Best Regards,
  Kevin Veroneau
  PythonDiary.com

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: new to Django and building web applications. Advice with postgresql

2013-05-21 Thread Kevin Daum


On Sunday, May 19, 2013 6:51:09 PM UTC-4, Scott Anderson wrote:
>
>
> I highly recommend *against* waiting for PostgreSQL until deployment. 
> There are significant differences between SQLite, PostgreSQL, and MySQL. If 
> you wait until deployment to test on your production database you will find 
> yourself fixing and changing things at the last minute. Start testing on 
> your production deployment database as soon as possible.
>
>
I'm going to echo Scott's sentiment. I ran into enough 
difficult-to-troubleshoot (or just annoying) issues resulting from 
inconsistencies between sqlite and postgres that I no longer allow my 
developers to use sqlite at all. We now use vagrant to install debian VMs 
running postgres on all our developer machines. We have a shell script that 
automatically creates and configures a database for the project, so it 
doesn't end up taking too much longer to set up than sqlite.

That said, if you're just getting started with django, you probably don't 
want to deal with postgres yet. Feel free to tinker and learn against 
sqlite, but once you start writing code that you're eventually going to put 
into production, I'd start using whatever database you're going to use in 
production.

Kevin 

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Bus Error: 10 (Intro Tutorial)

2013-05-13 Thread Kevin
I had a similar issue with Bus error: 10

Turned out to be an infinite depth recursion loop like James says.  My 
recommendation for anyone who encounters this it to create a unit test for 
the specific situation that causes it or play around with it using 
"./manage.py shell".  You may be able to find a proper exception message.

On Monday, April 23, 2012 12:36:19 PM UTC-6, James wrote:
>
> I found the problem. I had overridden __getattr__ and returned 
> self.value which did not yet exist on the object. This caused a 
> maximum recursion depth RuntimeError. I'm still not sure why this 
> became "Bus error: 10", however. 
>
> James Leard 
>
> On Apr 23, 1:31 pm, Nikolas Stevenson-Molnar  
> wrote: 
> > I would try reinstalling Python and Django. This seemed to resolve the 
> > issue of the original poster. 
> > 
> > _Nik 
> > 
> > On 4/21/2012 3:18 PM, James wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > I just started receiving the same error "Bus error: 10". I made a 
> > > small code change and 
> > > it suddenly appeared. I've reverted but that doesn't seem to matter. 
> > > Very odd behavior. 
> > > I'll continue debugging. My settings: 
> > 
> > > Python 2.7.1 
> > > OS:X Lion 10.7.3 
> > > Django 1.4.0 
> > 
> > > James Leard 
> > 
> > > On Apr 20, 7:58 am, Tom Evans  wrote: 
> > >> On Thu, Apr 19, 2012 at 5:11 PM, Harald Sigh Andertun 
> > 
> > >>  wrote: 
> > >>> I'm sorry. Actually that was not the solution. It works sometimes 
> now, which 
> > >>> it didn't before. I'll attach a screenshot. 
> > >>> I'm on mac (OS X Lion). 
> > >> A bus error occurs due to unaligned memory access, or access to a non 
> > >> existent memory address. In the absence of an actual bug (which 
> others 
> > >> would see), this clearly indicates that one or another of the C 
> > >> libraries used by python conflicts with it. 
> > 
> > >> This could happen if you compiled a C library to use with python, 
> like 
> > >> one of the many python packages that consist of a small C library 
> > >> (mysql and postgresql DB adaptors, PIL, many others), and use it with 
> > >> a different python than it was compiled against. 
> > 
> > >> It probably has very little to do with django - django is pure python 
> > >> - but with one of the libraries that is used by django or your code. 
> > >> The solution is simple; remove everything, start from scratch and 
> > >> recompile/reinstall everything relevant. 
> > 
> > >> It is probably trickier as OS X does interesting things with python, 
> > >> and most users end up with a system python and a user python. Making 
> > >> sure your installed extensions are compiled and used with the right 
> > >> python is then what is important. 
> > 
> > >> Cheers 
> > 
> > >> Tom

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Trying to figure out ManyToManyField on a legacy database

2013-05-11 Thread kevin
Hi Brian,

It seems like you don't really have an Many To Many relationship between 
your "Song" and "Played" objects.  I can see how you would have multiple 
plays for one song, but considering that the Played model has a track_id, 
would you ever have multiple songs for a single Play?It appears that 
"track_id" is intended to be a foreign key into the Song table, so maybe 
you could consider using a ForeignKey field to refer to your Song through 
your Played object.  Django will automatically create 2-way references so 
you can get to your played objects from your song object::

class Played(models.Model):
  played_id = models.IntegerField(primary_key=True)
  track = models.ForeignKey('Song')
  date_played = models.DateTimeField()
  played_by = models.CharField(max_length=255L)
  played_by_me = models.IntegerField()
  class Meta:
   db_table = 'played'

class Song(models.Model):
  id = models.IntegerField(primary_key=True)
  title = models.CharField(max_length=255L, blank=True)
  class Meta:
  db_table = 'song'

Then, you should be able to get all of the Plays for a particular song::  


s = Song.objects.get(id=1229)
s.title # should be OK still
s.played_set.all() # should be a list of plays.



On Saturday, May 11, 2013 5:33:46 PM UTC-5, Brian Millham wrote:
>
> Hi all,
> I'm just trying to learn Django. I have an existing site that I wrote in 
> PHP, and I'l considering converting it to Django,
>
> I have a legacy database that I don't want to make any changes to. I have 
> the basics working in Django, but am having a problem with a 
> ManyToManyField.
>
> Here are the 2 tables (simplified)
>
> class Played(models.Model):
>   played_id = models.IntegerField(primary_key=True)
>   track_id = models.IntegerField()
>   date_played = models.DateTimeField()
>   played_by = models.CharField(max_length=255L)
>   played_by_me = models.IntegerField()
>   class Meta:
>db_table = 'played'
>
> class Song(models.Model):
>   id = models.IntegerField(primary_key=True)
>   title = models.CharField(max_length=255L, blank=True)
>   #These are what I've tried for ManyToMany with the error
>   played = models.ManyToManyField(Played, db_column='id') # DatabaseError: 
> (1146, "Table 'ampache.song_played' doesn't exist")
>   played = models.ManyToManyField(Played, db_column='track_id') # 
> DatabaseError: (1146, "Table 'ampache.song_played' doesn't exist")
>   played = models.ManyToManyField(Played, db_table = 'played', 
> db_column='id') # DatabaseError: (1054, "Unknown column 'T2.song_id' in 
> 'where clause'")
>   played = models.ManyToManyField(Played, db_table = 'played', 
> db_column='track_id') # DatabaseError: (1054, "Unknown column 'T2.song_id' 
> in 'where  clause'")
>   played = models.ManyToManyField(Played, through = 'played', 
> db_column='id') # AttributeError: 'ManyToManyField' object has no attribute 
> '_m2m_reverse_name_cache'
>   class Meta:
>db_table = 'song'
>
> The code to produce the errors:
>
>> from djmusic.models import Song, Played
>> s = Song.objects.get(id=1229)
>> print s.title # Prints the title correctly
>> print s.played.all() # Generates one of the above errors
>>
>
> I know it's gotta be something simple I'm missing here. If I can get this 
> figured out, there's a good chance that I'll convert my old PHP based site 
> to Django. 
>
> Thanks all!
>  
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




  1   2   3   4   5   >