Re: Nested Model

2019-09-19 Thread Davin Pore


[image: API_Box.JPG]


On Thursday, 19 September 2019 14:35:03 UTC+8, Davin Pore wrote:
>
> Seeking for your kind assistance on how to get the value of this using 
> nested model on django restapi.
>
> [image: image.png]
> Thank you.
>
>

-- 
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/4a58dd13-7669-40e6-b6c4-1768902ec1fd%40googlegroups.com.


rumove upload_to in the database

2019-09-19 Thread Luca Bertolotti
Hello
in the model i have :
file = models.FileField(upload_to='disegni/', blank=True, null=True)

in the database in the column file django save :
disegni/filename.xxx

in which way i can save only the filename and not the folder?

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/05235508-e344-421f-8b7b-3c69466ecce6%40googlegroups.com.


401 unauthorized

2019-09-19 Thread Muhammad Zeeshan Tariq
How we pass token in url using Vuejs and Rest Frame API.

-- 
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/af427412-99c0-4c38-a625-4a0f96c67ac8%40googlegroups.com.


Re: Raju | ITC Infotech - Looking for Backend Developers (Python/Django ORM - New York City )

2019-09-19 Thread Preetham Varanasi
Hi Sipum,
   yeah to save time we have to😉😂


On Wed, Sep 18, 2019 at 3:22 PM Sipum  wrote:

> Hi Preetham,
>
> I know we are in s/w industry and we are well known of copy and paste. But
> u did it here also. 😅😅
> Thanks.
>
>
> On Wed, 18 Sep, 2019, 11:47 AM Preetham Varanasi, <
> varanasipreetham...@gmail.com> wrote:
>
>> Hi Raju,
>> I m interested but can remote possible as currently, I m in India?
>>
>>
>> Thank you
>> Regards
>> Preetham
>>
>> On Wed, Sep 18, 2019 at 8:05 AM Sipum  wrote:
>>
>>> Hi Raju,
>>>
>>> I m interested but can remote possible as currently I m in India?
>>>
>>> Thank you
>>> Regards
>>> Sipum
>>>
>>> On Wed, 18 Sep, 2019, 2:06 AM Raju N Somanna, 
>>> wrote:
>>>
 Hi All

 I've an immediate need for Backend Developers (*Python/Django ORM* -
 New York City) with my client in NYC. As the title suggests my team is
 looking for Python/Django specialist, someone who is good experience
 on ORM.

 Please do let me know if you have any from your contacts/references who
 might be interested in this opportunity.

 *PS: ABOUT US*
 ITC Infotech is a Global IT Consulting Organization with $200 mil+ in
 revenues, 8000+ resources footprint across Americas, Europe, South Africa,
 Asia Pacific and India.
 Presence in the US from the past 17 years, with resources working in
 over 24 states. Our US innovation labs are in San Jose, CA and we also have
 offices in NJ, MI, AR.
 We have plenty of successful use cases across diversified verticals
 including: Banking & Financial Services, Healthcare, Mfg, CPG-Retail,
 Hi-Tech.
 Our technology footprint encompasses: IoT, ML, AI, AR, RPA, Blockchain,
 Big Data, Product Engineering (we own a technology agnostic DevOps
 product), App Dev, Infra, PTC - PLM, ERP, BI, DW, Data Science…
 We are backed by a parent company with over $50 billion market cap and
 over 26,000 employees world-wide.

 Regards
 Raju NS
  raju...@itcinfotech.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/4a35e21e-fef7-46b9-bdc5-72767c3e3196%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/CAGHZBzzY-Rx86JdSQouF%2B6y__rnFkiFDVJrP%3DDvQOsp4kNYpvQ%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/CANFgYc4_VH%2BLLNtpxH4o7ZNOkd8Q_s_40mC1r7nHWKBPNa3LoQ%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/CAGHZBzwrWfNwX1nqD9FFyCzwwJv%2BB6KguXgceWWs-OUNLgQeEQ%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/CANFgYc5f2En%2BLtn%3DJ1KK-uq-g7TmoK6%3D2k3iU9P9srUXOkRSjg%40mail.gmail.com.


Re: Django cms and templates

2019-09-19 Thread MEGA NATHAN
Hi.

you check app name  127.0.0.8/app name




*Regards*
Meganathan G



On Thu, Sep 19, 2019 at 4:30 AM Perceval Maturure 
wrote:

> Dear all
>
> I have a django project done with Django 2.1 and successfully made an
> apphook to the cms page bt the problem is that the template file does not
> display model data unless if I remove the syntax { %extends base.html %} at
> the top of the template html file
> What could be causing this?
> Please help
>
> Sent from my iPhone
>
> --
> 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/4CE4415B-DDC4-4074-8F8C-630D98641EE5%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/CAEvDBLc%2B-yyHC4cxsGH8wrk_v-6q-cpgWwK7x0q-6ajkfO2cHQ%40mail.gmail.com.


LoginView Error when going back to login page

2019-09-19 Thread Jodel Asur
I'm having an issue with LoginView when we go back to the login page using 
the browser back button. I've deployed a simple web app (
https://jodelasur.pythonanywhere.com) so you can test for yourself.

Steps to recreate:

   1. Enter invalid (random) credentials and submit. You should see the 
   "Your username didn't match" error.
   2. Enter valid credentials (user: user, password: userpassworduser). You 
   should be logged-in successfully and redirected to home page.
   3. Press the back button.

Actual output: Browser error (Chrome: Confirm Form Resubmission, Firefox: 
Document Expired).
Expected output: Still redirect to home page, since l'm already 
authenticated.

If I don't enter invalid credentials as the first step (i.e. just do steps 
2 and 3), no error page appears, and I get the expected output of being 
redirected to the home page even after pressing the back button.

Here's the repo url if you need to see the code: 
https://github.com/jodelasur/login_view_test.

How do I avoid this error?

-- 
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/6020d918-634c-4e43-a290-c9495efe3897%40googlegroups.com.


Re: Nested Model

2019-09-19 Thread Ayser shuhaib
I’m not sure if I understood your question but for example:
enterprise.type will give you the value of type.

On Thu, 19 Sep 2019 at 10:00, Davin Pore  wrote:

> [image: API_Box.JPG]
>
>
> On Thursday, 19 September 2019 14:35:03 UTC+8, Davin Pore wrote:
>>
>> Seeking for your kind assistance on how to get the value of this using
>> nested model on django restapi.
>>
>> [image: image.png]
>> Thank you.
>>
>> --
> 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/4a58dd13-7669-40e6-b6c4-1768902ec1fd%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/CAE0AZGKOTgThH8sNi5TG3bH-JKaDLZVunZ5BwzbJnthz9jeFXA%40mail.gmail.com.


Update Nested Serializer

2019-09-19 Thread Marsel Beqiri
Hi, I am working with a Django rest api project. SO i need some help. I 
cant create a update for NESTED SERIALIZER. 
models.py

from django.db import models
from datetime import datetime
from django.contrib.auth.models import User


class TimesheetResponse(models.Model):
date = models.DateField("Date")
user = models.ForeignKey(User, default=1, on_delete=models.CASCADE)
date_created = models.DateField(auto_now_add=True)
date_last_updated = models.DateField(auto_now=True)

def __str__(self):
return '{} {}'.format(self.user, self.date, self.date_created, 
self.date_last_updated)


class SubjectType(models.Model):
name = models.CharField(max_length=50)

def __str__(self):
return '{}'.format(self.name)


class Subject(models.Model):
name = models.CharField(max_length=50)
subject_type = models.ForeignKey(SubjectType, default=1, 
on_delete=models.CASCADE,
 related_name='subjects')

def __str__(self):
return '{} {}'.format(self.name, self.subject_type)


class TimesheetResponseUnit(models.Model):
timesheet_response = models.ForeignKey(TimesheetResponse, default=1, 
on_delete=models.CASCADE,
   
related_name='timesheet_response_units')
subject = models.ForeignKey(Subject, default=1, on_delete=models.CASCADE, 
related_name='timesheet_response_units')
time_spent = models.IntegerField(default=0)
comments = models.TextField(max_length=255)

def __str__(self):
return '{} {}'.format(self.subject, self.time_spent)



serializer.py 

from rest_framework import serializers
 
from timesheet.models import TimesheetResponse, TimesheetResponseUnit, 
SubjectType, Subject


class SubjectSerializer(serializers.ModelSerializer):
class Meta:
model = Subject
fields = ['name', 'subject_type']


class SubjectTypeSerializer(serializers.ModelSerializer):
class Meta:
model = SubjectType
fields = ['name']
extra_kwargs = {'id': {'read_only': True}}


class TimesheetResponseUnitSerializer(serializers.ModelSerializer):
class Meta:
model = TimesheetResponseUnit

fields = ['id', 'time_spent', 'comments', 'subject']
# extra_kwargs = {'id': {'read_only': True}}


class TimesheetResponseSerializer(serializers.ModelSerializer):
timesheet_response_units = TimesheetResponseUnitSerializer(many=True)

class Meta:
model = TimesheetResponse
fields = ['date', 'user', 'timesheet_response_units']
extra_kwargs = {'id': {'read_only': True}}

def create(self, validated_data):
timesheet_response_units = 
validated_data.pop('timesheet_response_units')
timesheet_response = super(TimesheetResponseSerializer, 
self).create(validated_data)
for timesheet_response_unit_data in timesheet_response_units:
timesheet_response_unit = 
TimesheetResponseUnit(**timesheet_response_unit_data,

timesheet_response=timesheet_response)
timesheet_response_unit.save()
return timesheet_response

 def update(self, instance, validated_data): 


Any idea how to build a def update?

-- 
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/4a7f8032-961a-4e84-9ebb-4464ff132aba%40googlegroups.com.


Image not loading

2019-09-19 Thread Joseph Emeka
The highlighted section of the code is not loading the image was the 
solution

-- 
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/c00e4b4c-f270-4180-b072-951a92283882%40googlegroups.com.


Re: Image not loading

2019-09-19 Thread King Strips


On Thu, Sep 19, 2019 at 2:20 PM Joseph Emeka 
wrote:

> The highlighted section of the code is not loading the image was the
> solution
>
> --
> 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/c00e4b4c-f270-4180-b072-951a92283882%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/CAAoB22k6XTHYVibdRXFbrBqyU4cfn6v-FaPjckUfo5pEu-Ov%3DQ%40mail.gmail.com.


Re: Update Nested Serializer

2019-09-19 Thread Ayser shuhaib
Use a view.py  to add, update or delete data in your model.py

Check ViewSets.

https://www.django-rest-framework.org/api-guide/viewsets/



On Thu, 19 Sep 2019 at 16:20, Marsel Beqiri 
wrote:

> Hi, I am working with a Django rest api project. SO i need some help. I
> cant create a update for NESTED SERIALIZER.
> models.py
>
> from django.db import models
> from datetime import datetime
> from django.contrib.auth.models import User
>
>
> class TimesheetResponse(models.Model):
> date = models.DateField("Date")
> user = models.ForeignKey(User, default=1, on_delete=models.CASCADE)
> date_created = models.DateField(auto_now_add=True)
> date_last_updated = models.DateField(auto_now=True)
>
> def __str__(self):
> return '{} {}'.format(self.user, self.date, self.date_created, 
> self.date_last_updated)
>
>
> class SubjectType(models.Model):
> name = models.CharField(max_length=50)
>
> def __str__(self):
> return '{}'.format(self.name)
>
>
> class Subject(models.Model):
> name = models.CharField(max_length=50)
> subject_type = models.ForeignKey(SubjectType, default=1, 
> on_delete=models.CASCADE,
>  related_name='subjects')
>
> def __str__(self):
> return '{} {}'.format(self.name, self.subject_type)
>
>
> class TimesheetResponseUnit(models.Model):
> timesheet_response = models.ForeignKey(TimesheetResponse, default=1, 
> on_delete=models.CASCADE,
>
> related_name='timesheet_response_units')
> subject = models.ForeignKey(Subject, default=1, on_delete=models.CASCADE, 
> related_name='timesheet_response_units')
> time_spent = models.IntegerField(default=0)
> comments = models.TextField(max_length=255)
>
> def __str__(self):
> return '{} {}'.format(self.subject, self.time_spent)
>
>
>
> serializer.py
>
> from rest_framework import serializers
>
> from timesheet.models import TimesheetResponse, TimesheetResponseUnit, 
> SubjectType, Subject
>
>
> class SubjectSerializer(serializers.ModelSerializer):
> class Meta:
> model = Subject
> fields = ['name', 'subject_type']
>
>
> class SubjectTypeSerializer(serializers.ModelSerializer):
> class Meta:
> model = SubjectType
> fields = ['name']
> extra_kwargs = {'id': {'read_only': True}}
>
>
> class TimesheetResponseUnitSerializer(serializers.ModelSerializer):
> class Meta:
> model = TimesheetResponseUnit
>
> fields = ['id', 'time_spent', 'comments', 'subject']
> # extra_kwargs = {'id': {'read_only': True}}
>
>
> class TimesheetResponseSerializer(serializers.ModelSerializer):
> timesheet_response_units = TimesheetResponseUnitSerializer(many=True)
>
> class Meta:
> model = TimesheetResponse
> fields = ['date', 'user', 'timesheet_response_units']
> extra_kwargs = {'id': {'read_only': True}}
>
> def create(self, validated_data):
> timesheet_response_units = 
> validated_data.pop('timesheet_response_units')
> timesheet_response = super(TimesheetResponseSerializer, 
> self).create(validated_data)
> for timesheet_response_unit_data in timesheet_response_units:
> timesheet_response_unit = 
> TimesheetResponseUnit(**timesheet_response_unit_data,
> 
> timesheet_response=timesheet_response)
> timesheet_response_unit.save()
> return timesheet_response
>
>  def update(self, instance, validated_data): 
>
>
> Any idea how to build a def update?
>
> --
> 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/4a7f8032-961a-4e84-9ebb-4464ff132aba%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/CAE0AZGLP%2BsEMxm7q7xZbnnyCvav_%3DLEMJYz1xVQuJttL2%3DYTww%40mail.gmail.com.


Re: Image not loading

2019-09-19 Thread Tosin Ayoola
I don't know if I'm write on but u're not referencing the source of the
image wit the arc attribute,  but rather u using the style attribute

On Sep 19, 2019 16:11, "Joseph Emeka"  wrote:

> Thanks for you reply I do not really understand it. i bought the template
> to use the layout for a project, using django framework. the css, js and
> other files ares was written by the designer. Secondly i have run necessary
> terminal command to collect assets and setting for for static files. find
> attached the template head
>
> On Thursday, September 19, 2019 at 3:32:14 PM UTC+1, King Strips wrote:
>>
>> 
>>
>> On Thu, Sep 19, 2019 at 2:20 PM Joseph Emeka  wrote:
>>
>>> The highlighted section of the code is not loading the image was the
>>> solution
>>>
>>> --
>>> 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/ms
>>> gid/django-users/c00e4b4c-f270-4180-b072-951a92283882%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/63e40e60-7273-4897-995b-067a229e686a%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/CAHLKn72pR0ruydA8YPrjhCxV3jFHnosT5VFSAEGFFgefsumZAA%40mail.gmail.com.


Re: Staticfiles on S3

2019-09-19 Thread Elias Coutinho
I put in S3 in Permissions> CORS Configuration the following:

 
  
 * 
 GET 
 PUT 
 POST 
 DELETE 
 3000 
 * 
  
 

And solved! It would be interesting if you could send these CORS through 
the system.

Thank you guys.

Em quarta-feira, 4 de setembro de 2019 17:06:29 UTC-3, Elias Coutinho 
escreveu:
>
> Guys good afternoon,
>
> I managed to put my static folder in s3, the problem is that my effects 
> already lost power. lol
>
> The staticfiles folder where the auxiliary applications are installed stop 
> working, in my case it was django-material, select2 and others.
>
>
>
> If I comment this code 
>  
> that is in the settings of my project it works but does not send anything 
> to Amazon s3.
>
>
>
> Any suggestion?
>

-- 
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/3be545b6-5fd6-4868-8b94-ae17c76d88fa%40googlegroups.com.


Re: Raju | ITC Infotech - Looking for Backend Developers (Python/Django ORM - New York City )

2019-09-19 Thread Alfredo Sumague
I'm interested and willing to relocate to NY.

Thanks,
Alfredo Sumague

On Tue, Sep 17, 2019 at 1:35 PM Raju N Somanna  wrote:

> Hi All
>
> I've an immediate need for Backend Developers (*Python/Django ORM* - New
> York City) with my client in NYC. As the title suggests my team is looking
> for Python/Django specialist, someone who is good experience on ORM.
>
> Please do let me know if you have any from your contacts/references who
> might be interested in this opportunity.
>
> *PS: ABOUT US*
> ITC Infotech is a Global IT Consulting Organization with $200 mil+ in
> revenues, 8000+ resources footprint across Americas, Europe, South Africa,
> Asia Pacific and India.
> Presence in the US from the past 17 years, with resources working in over
> 24 states. Our US innovation labs are in San Jose, CA and we also have
> offices in NJ, MI, AR.
> We have plenty of successful use cases across diversified verticals
> including: Banking & Financial Services, Healthcare, Mfg, CPG-Retail,
> Hi-Tech.
> Our technology footprint encompasses: IoT, ML, AI, AR, RPA, Blockchain,
> Big Data, Product Engineering (we own a technology agnostic DevOps
> product), App Dev, Infra, PTC - PLM, ERP, BI, DW, Data Science…
> We are backed by a parent company with over $50 billion market cap and
> over 26,000 employees world-wide.
>
> Regards
> Raju NS
>  raju...@itcinfotech.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/4a35e21e-fef7-46b9-bdc5-72767c3e3196%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/CAGF6mrTgdgu%2BMLpJpaTnWZ7rrEFmaZiGje2V-QqYOGMq0nzO1Q%40mail.gmail.com.