These are chat archives for django/django

19th
Jul 2017
Bon Osonwanne
@osonwanne
Jul 19 2017 02:15
has anyone built user authentication (register/login with Django-registration) on top of Wagtail CMS before?
John
@flyboy1565
Jul 19 2017 02:34
@badcoder28 , can you provide the query you are attempting. This shouldn't be too hard.. something like Diagnosis.objects.filter(is_success=true)
That true should be capitalized
@delirious44 , please give and example of your model
Roel
@roelzkie15
Jul 19 2017 03:29
@flyboy1565 this is not something you can achieve by simple filtering since it returns a queryset of Diagnosis instances and the output is a multi dimensional collections.
by the way i was able to achieved it by doing a for loop after getting the queryset
John
@flyboy1565
Jul 19 2017 03:36
ya, first you have to get all the objects.. then if you only want to put the reference to it afterward into an array.. simple and easy
Anish Shrestha
@annshress
Jul 19 2017 07:33
@badcoder28 you could.
  1. get id of the True diagnosis instance you want. Say id1
  2. And get another True diagnosis using .filter(id__lt=id1).aggregate(id2=Max('id'))
    this will give you {id2: <some id>} which has is_success=True and is below the id1
  3. Finally you could - .filter(id__gt=id2).filter(id__lte=id1)
Or that's some way. But I don't think this is a django question though.
Roel
@roelzkie15
Jul 19 2017 07:46
@annshress hi there i was able to produce the result using for loop. thanks but i have another question here https://stackoverflow.com/questions/45181841/how-to-query-previous-items-of-a-given-criteria ill be glad if you could help
Anish Shrestha
@annshress
Jul 19 2017 08:02
Yea i answered you question.
Still the procedure is same as mentioned here.
Miracle Ayodele
@iammiracle
Jul 19 2017 08:04
@annshress do you have any clue to saving a list of items in database? i tried saving but this is what was saved [u'32', u'47', u'84', u'69'] which i think when i want to query will be seen as string
but i need them to be seen individually
Anish Shrestha
@annshress
Jul 19 2017 08:05
@koderNeptune Have you asked this question on stakoverflow?
Miracle Ayodele
@iammiracle
Jul 19 2017 08:05
not yet
Anish Shrestha
@annshress
Jul 19 2017 08:05
Detail your problem there maybe?
Miracle Ayodele
@iammiracle
Jul 19 2017 08:06
alright let me do that and share the link
Anish Shrestha
@annshress
Jul 19 2017 08:07
which db are you using?
Miracle Ayodele
@iammiracle
Jul 19 2017 08:07
mysql
Anish Shrestha
@annshress
Jul 19 2017 08:12
@badcoder28 Did it work?
Miracle Ayodele
@iammiracle
Jul 19 2017 08:44
@annshress
Anish Shrestha
@annshress
Jul 19 2017 08:59
@koderNeptune
Hey
Miracle Ayodele
@iammiracle
Jul 19 2017 08:59
hi @annshress
Anish Shrestha
@annshress
Jul 19 2017 08:59
What if you could use Onetomanyfield
for guessed number
and to prevent other people from using same choice.
you could filter the values down to those which has not been chosen inside Form.
As myfield.choices = unselected_guesses_queryset
furthermore, I think
mysql provides jsonfield which can store arrays.
give it a try first. And let me know.
Miracle Ayodele
@iammiracle
Jul 19 2017 09:03
okay instead of Onetomanyfield, i should try jsonfield? @annshress
Anish Shrestha
@annshress
Jul 19 2017 09:03
But this can cause problems filtering in the form.
Yea try either and choose the one that suits you.
Roel
@roelzkie15
Jul 19 2017 10:30
@annshress hi thanks! its working ! glad you are a great help!
Job Matheka
@jobm
Jul 19 2017 11:54
Hey Pythonistas.
Has anyone here been able to work with the box api from a python script, I am having trouble fetching refresh and access tokens.
Anish Shrestha
@annshress
Jul 19 2017 13:44
@koderNeptune
onetomany field in is exactly created using foreignkey.
where you create Foreignkey in the Many side
@badcoder28 glad it helped
Anish Shrestha
@annshress
Jul 19 2017 13:52
I get you, but diving into your problem with partial information can be problematic for me right now. So that's a bummer. Maybe other can help.
brianbola
@brianbola
Jul 19 2017 15:08
can some one tell me how i embed html in the send_mail function ?
ive used this so far can send a txt email but format doesnt look nice