Re: Help needed

2021-02-22 Thread neha bhurke
I have created the form
this is my views.py.

def newdata(request):
if request.method == "POST":
MyDataform = Dataform(request.POST)
if MyDataform.is_valid():
MyDataform.save()
results = machinelist.objects.all()
#result = data.objects.all()
return redirect('/', {'data': results})
else:
MyDataform=Dataform()
results = machinelist.objects.all()
result = insert.objects.all()
return redirect('/',{'data': results},{'record':result})
else:
results = machinelist.objects.all()
result = insert.objects.all()
return redirect('/', {'data': results},{'record':result})

This is my forms.py

class Dataform(forms.ModelForm):
class Meta:
model = insert
fields = "__all__"

*Regard,*
*Neha Bhurke*

*Precise Industrial Solutions Private Limited*

Mob: +91 7738946067 I O: +91 22 28943214

Add: 115, 1st Floor, Hari Om Plaza, Behind Omkareshwar Mandir, Near
National Park, Borivali (E), Mumbai-400066



On Tue, Feb 23, 2021 at 12:35 PM Danny  wrote:

> Maybe it is not related to the model definition, but rather the .save()
> object?
>
> On Tuesday, February 23, 2021 at 1:52:04 PM UTC+7 bhurk...@gmail.com
> wrote:
>
>> I have done all these codes but it is saving only the current date .
>> Any other method
>> *Regard,*
>> *Neha Bhurke*
>>
>> *Precise Industrial Solutions Private Limited*
>>
>> Mob: +91 7738946067 <+91%2077389%2046067> I O: +91 22 28943214
>> <+91%2022%202894%203214>
>>
>> Add: 115, 1st Floor, Hari Om Plaza, Behind Omkareshwar Mandir, Near
>> National Park, Borivali (E), Mumbai-400066
>>
>>
>>
>> On Tue, Feb 23, 2021 at 12:10 PM Omkar Parab  wrote:
>>
>>> datetime=models.DateTimeField(auto_now=False) ?
>>> Or remove "auto_now"
>>> datetime=models.DateTimeField()
>>>
>>> On Tue, Feb 23, 2021, 11:34 AM neha bhurke  wrote:
>>>
 Hello everyone,

 I am trying to select the custom date but
 datetime=models.DateTimeField(auto_now=True)
 is only taking current date 
 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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/b1c53101-c7c6-403f-9b43-6713d7f66c07n%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...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAJY8mfxi-bxtyMVWiOWCESK969Ok6nZaoyhWNSLvFO_0tEGp1Q%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/c98c61c4-f767-4917-88e2-aed03c91c7can%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/CAEwf5Q2ZhT%2BSPP%2BQrEy-8VYswxNqSE5FmTX-%2BPR6H_bMXw-bAw%40mail.gmail.com.


Re: Help needed

2021-02-22 Thread Danny
Maybe it is not related to the model definition, but rather the .save() 
object?

On Tuesday, February 23, 2021 at 1:52:04 PM UTC+7 bhurk...@gmail.com wrote:

> I have done all these codes but it is saving only the current date .
> Any other method 
> *Regard,*
> *Neha Bhurke*
>
> *Precise Industrial Solutions Private Limited*
>
> Mob: +91 7738946067 <+91%2077389%2046067> I O: +91 22 28943214 
> <+91%2022%202894%203214>
>
> Add: 115, 1st Floor, Hari Om Plaza, Behind Omkareshwar Mandir, Near 
> National Park, Borivali (E), Mumbai-400066
>
>
>
> On Tue, Feb 23, 2021 at 12:10 PM Omkar Parab  wrote:
>
>> datetime=models.DateTimeField(auto_now=False) ?
>> Or remove "auto_now"
>> datetime=models.DateTimeField()
>>
>> On Tue, Feb 23, 2021, 11:34 AM neha bhurke  wrote:
>>
>>> Hello everyone,
>>>
>>> I am trying to select the custom date but 
>>> datetime=models.DateTimeField(auto_now=True)
>>> is only taking current date 
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/b1c53101-c7c6-403f-9b43-6713d7f66c07n%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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAJY8mfxi-bxtyMVWiOWCESK969Ok6nZaoyhWNSLvFO_0tEGp1Q%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/c98c61c4-f767-4917-88e2-aed03c91c7can%40googlegroups.com.


Re: Help needed

2021-02-22 Thread neha bhurke
I have done all these codes but it is saving only the current date .
Any other method
*Regard,*
*Neha Bhurke*

*Precise Industrial Solutions Private Limited*

Mob: +91 7738946067 I O: +91 22 28943214

Add: 115, 1st Floor, Hari Om Plaza, Behind Omkareshwar Mandir, Near
National Park, Borivali (E), Mumbai-400066



On Tue, Feb 23, 2021 at 12:10 PM Omkar Parab  wrote:

> datetime=models.DateTimeField(auto_now=False) ?
> Or remove "auto_now"
> datetime=models.DateTimeField()
>
> On Tue, Feb 23, 2021, 11:34 AM neha bhurke  wrote:
>
>> Hello everyone,
>>
>> I am trying to select the custom date but
>> datetime=models.DateTimeField(auto_now=True)
>> is only taking current date 
>> 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/b1c53101-c7c6-403f-9b43-6713d7f66c07n%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/CAJY8mfxi-bxtyMVWiOWCESK969Ok6nZaoyhWNSLvFO_0tEGp1Q%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/CAEwf5Q2k2Ah3j_eSmCpjZSkfDEFKDqRySULc8Wb5kOQSwJaTRg%40mail.gmail.com.


Re: Help needed

2021-02-22 Thread Omkar Parab
datetime=models.DateTimeField(auto_now=False) ?
Or remove "auto_now"
datetime=models.DateTimeField()

On Tue, Feb 23, 2021, 11:34 AM neha bhurke  wrote:

> Hello everyone,
>
> I am trying to select the custom date but
> datetime=models.DateTimeField(auto_now=True)
> is only taking current date 
> 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/b1c53101-c7c6-403f-9b43-6713d7f66c07n%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/CAJY8mfxi-bxtyMVWiOWCESK969Ok6nZaoyhWNSLvFO_0tEGp1Q%40mail.gmail.com.


Re: django voluntary work.

2021-02-22 Thread Sharif Mehedi
>>> Hello @Sharif,
>>> Do you have any experience with the following:-
>>>

   1. version control? git or svn? 
  2. docker?
   

>>>* Regards,*

>>>* Gilwell Muhati | +254 710 739 116 |*
>>>* ~~“The mind is its own place and in itself can make a heaven of hell, 
a hell of heaven…”~~John Milton*

Hello Gilwell Muhati,

I have experience with git (version control), and as with docker, I took a 
tutorial and set up a docker container environment with wsl-2 (Ubuntu 18.04 
Bionic), I understand how docker works and can work with docker.

Thank you for considering me to include in your team. I will be glad to get 
instructions from you in getting started on your workflow.

Regards,
- Mehedi
On Monday, February 22, 2021 at 10:31:33 PM UTC+6 gilw...@gmail.com wrote:

> Hello @Sharif,
> Do you have any experience with the following:-
>
>1. version control? git or svn? 
>2. docker?
>
>
>
>
>
> *Regards,Gilwell Muhati | +254 710 739 116 | *
> *~~“The mind is its own place and in itself can make a heaven of hell, a 
> hell of heaven…”~~John Milton *
>
>
> On Mon, Feb 22, 2021 at 6:55 PM Sharif Mehedi  
> wrote:
>
>> Hello everybody,
>> I am trying to start a career in development. I can work around any 
>> problem with python. I have gone through a fair amount of django 
>> documentation.
>> I am looking forward to work as a volunteer on any professional django 
>> project that should boost my learning and also assist on building a resume. 
>> I am not expecting any payment. If you hire me and see that I can assist on 
>> your work flow, then I am hoping I can join your team as a paid contributor.
>> It would be a great help if anybody suggest anybody else where there is 
>> such a scope to join as a volunteer.
>> Thank you for spending your time in reading this.
>> - Mehedi
>>
>> -- 
>> 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/fbeb0825-2860-407d-8764-70e6de4759a9n%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/a699f454-902f-4448-8ec8-33543985f5dbn%40googlegroups.com.


Help needed

2021-02-22 Thread neha bhurke
Hello everyone,

I am trying to select the custom date but 
datetime=models.DateTimeField(auto_now=True)
is only taking current date 
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/b1c53101-c7c6-403f-9b43-6713d7f66c07n%40googlegroups.com.


Re: Try to save multiple files using a one to many fields django

2021-02-22 Thread Ryan Nowakowski



On February 21, 2021 11:04:49 PM CST, jose angel encinas ramos 
 wrote:
>hello everyone, i working in my inventory django app, in this project i
>try 
>to create a new area and in to each area has a posible to save
>multiples 
>pdf.
>so, when i try to save pdf in some new area have this error in terminal
>
>'''
>django.db.utils.IntegrityError: null value in column "microbusiness_id"
>
>violates not-null constraint
>DETAIL:  Failing row contains (3,
>documents/Informe_de_TeleTrabajo.docx, 
>2021-02-22 04:25:32.352176+00, 2021-02-22 04:25:32.352206+00, null).
>
>[22/Feb/2021 04:25:32] "POST /add_pdf HTTP/1.1" 500 18705
>
>but its save it and does't show anything 

That error is telling you that you are trying to save a DocumentPdf without the 
required associated MicroBusiness. When you create the DocumentPdfForm, use the 
kwarg "instance" to initialize the form with a DocumentPdf with a non-null 
MicroBusiness.

>'''
>Model:
>'''
>class MicroBusiness(models.Model):
>#models micro business
>name = models.CharField(max_length=50)
>img = models.ImageField(upload_to='areas_logo', null=True, blank=True)
>comments = models.TextField(blank=True, null=True)
>
>#actions
>created = models.DateTimeField(auto_now_add=True)
>update = models.DateTimeField(auto_now=True)
>
>class Meta:
>verbose_name = 'MicroBusiness'
>verbose_name_plural = 'MicroBusinesses'
>
>def __str__(self):
>return self.name
>
>class DocumentsPdf(models.Model):
>document = models.FileField(upload_to='documents', null=False,
>blank=False)
>microbusiness = models.ForeignKey('MicroBusiness',
>on_delete=models.CASCADE, 
>null=False, blank=False)
>
>#actions
>created = models.DateTimeField(auto_now_add=True)
>update = models.DateTimeField(auto_now=True)
>
>class Meta:
>verbose_name = 'DocumentPdf'
>verbose_name_plural = 'DocumentPdfs'
>
>def __str__(self):
>return "%s" % self.document
>'''
>Form:
>'''
>class DocumentPdfForm(forms.ModelForm):
>  #Documents pdf
>class Meta():
>model = DocumentsPdf
>fields = ('document',)
>'''
>Views:
>'''
>@permission_required('is_superuser')
>@login_required
>def AreasViews(request, id):
>pdfdoc = DocumentsPdf.objects.all()
>try:
>data = MicroBusiness.objects.get(id = id)
>except MicroBusiness.DoesNotExist:
>raise Http404('Data does not exist')
>context ={
>'pdfdoc': pdfdoc,
>'data':data,
>}
>return render(request,'inventory/organization/Areas.html',context)
>
>@permission_required('is_superuser')
>@login_required
>def save_pdf(request,form,template_name):
>#function save documents
>data = dict()
>if request.method == 'POST':
>if form.is_valid():
>""" import pdb
>pdb.set_trace() """
>form.save()
>data['form_is_valid'] = True
>pdfdoc = DocumentsPdf.objects.all()
>data['areas_mb'] = render_to_string('
>inventory/organization/all_documents.html',{'pdfdoc':pdfdoc})
>else:
>data['form_is_valid'] = False
>context = {
>'form':form
>}
>data['html_form'] =
>render_to_string(template_name,context,request=request)
>return JsonResponse(data)
>
>@permission_required('is_superuser')
>@login_required
>def createpdf(request):
>#this function add document 
>if request.method == 'POST':
>form = DocumentPdfForm(request.POST or None, request.FILES)
>else:
>form = DocumentPdfForm()
>return save_pdf(request,form,'inventory/organization/upload.html')
>
>
>'''

-- 
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/02F09D34-5F12-4227-BB50-7B27DD577752%40fattuba.com.


Re: Why is this acting like a permanent redirect?

2021-02-22 Thread David Nugent
Hi Robert,

To point out the most likely cause of the issue: LOGIN_REDIRECT_URL is a url, 
not a route name.

Possibly could use a reverse_lazy('login-redirect') here after import 
django.urls, but - untested.

Regards,
David


On 23 February 2021 at 07:07:52, Robert F 
(robert...@gmail.com) wrote:

I have a Django view that I redirect a user to after they login:

# settings.py
LOGIN_REDIRECT_URL = 'login-redirect'

# account/urls.py
urlpatterns = [
path('', include('django.contrib.auth.urls')),
...
]

# home/views.py
from account.models import Member

def login_redirect(request):
"""
Redirect member to appropriate page when they log in.
"""
member = Member.objects.get(user__id__exact=request.user.id)
if member.has_profile:
return redirect('homepage', member_id=member.id)
else:
return redirect('profile-create', member_id=member.id)

If I start Django's development server and execute this code when the condition 
```member.has_profile = True```, Django redirects me to the homepage view as 
expected.  But if I then go into the database and set has_profile to False, 
restart the web server, and execute code again, my website acts as if the code 
isn't executed.  Instead, I'm sent immediately to the homepage view again.  I 
can see this by looking at the terminal console:

[19/Feb/2021 ...] "GET /account/login/ HTTP/1.0" 200 4268   # I'm using 
Django's default login method
[19/Feb/2021 ...] "POST /account/login HTTP/1.0" 302 0
[19/Feb/2021 ...] "GET /home/login_redirect/ HTTP/1.0" 200 4599

This happens even though I am restarting the server and clearing my browser's 
cache.  In fact, I can edit the login_redirect function so that it only 
contains a single line ```pass``` and I'm still sent to the homepage after 
logging in.

def login_redirect(request):
pass

Why is this happening?  I'm not doing a permanent redirect.  And should I not 
be using the redirect method in my login_redirect method to send a user to a 
different page depending on whether or not they have a profile?


--
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/8423cc0d-b83b-4115-b9fa-6a28e93210d8n%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/etPan.6034527c.2a96f626.ceb2%40uniquode.io.


Why is this acting like a permanent redirect?

2021-02-22 Thread Robert F
I have a Django view that I redirect a user to after they login:

# settings.py
LOGIN_REDIRECT_URL = 'login-redirect'

# account/urls.py
urlpatterns = [
path('', include('django.contrib.auth.urls')),
...
]

# home/views.py
from account.models import Member

def login_redirect(request):
"""
Redirect member to appropriate page when they log in.
"""
member = Member.objects.get(user__id__exact=request.user.id)
if member.has_profile:
return redirect('homepage', member_id=member.id)
else:
return redirect('profile-create', member_id=member.id)

If I start Django's development server and execute this code when the 
condition ```member.has_profile = True```, Django redirects me to the 
homepage view as expected.  But if I then go into the database and set 
has_profile to False, restart the web server, and execute code again, my 
website acts as if the code isn't executed.  Instead, I'm sent immediately 
to the homepage view again.  I can see this by looking at the terminal 
console:

[19/Feb/2021 ...] "GET /account/login/ HTTP/1.0" 200 4268   # I'm 
using Django's default login method
[19/Feb/2021 ...] "POST /account/login HTTP/1.0" 302 0
[19/Feb/2021 ...] "GET /home/login_redirect/ HTTP/1.0" 200 4599

This happens even though I am restarting the server and clearing my 
browser's cache.  In fact, I can edit the login_redirect function so that 
it only contains a single line ```pass``` and I'm still sent to the 
homepage after logging in.

def login_redirect(request):
pass

Why is this happening?  I'm not doing a permanent redirect.  And should I 
not be using the redirect method in my login_redirect method to send a user 
to a different page depending on whether or not they have a profile?

-- 
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/8423cc0d-b83b-4115-b9fa-6a28e93210d8n%40googlegroups.com.


Re: django voluntary work.

2021-02-22 Thread gilwell muhati
Hello @Sharif,
Do you have any experience with the following:-

   1. version control? git or svn?
   2. docker?





*Regards,Gilwell Muhati | +254 710 739 116 | *
*~~“The mind is its own place and in itself can make a heaven of hell, a
hell of heaven…”~~John Milton *


On Mon, Feb 22, 2021 at 6:55 PM Sharif Mehedi 
wrote:

> Hello everybody,
> I am trying to start a career in development. I can work around any
> problem with python. I have gone through a fair amount of django
> documentation.
> I am looking forward to work as a volunteer on any professional django
> project that should boost my learning and also assist on building a resume.
> I am not expecting any payment. If you hire me and see that I can assist on
> your work flow, then I am hoping I can join your team as a paid contributor.
> It would be a great help if anybody suggest anybody else where there is
> such a scope to join as a volunteer.
> Thank you for spending your time in reading this.
> - Mehedi
>
> --
> 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/fbeb0825-2860-407d-8764-70e6de4759a9n%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/CALO4FhEtxYMd3YnZUPMe%2BZSz5Yh83iNT6-at4f1jOjQSYkvQhQ%40mail.gmail.com.


django voluntary work.

2021-02-22 Thread Sharif Mehedi
Hello everybody,
I am trying to start a career in development. I can work around any problem 
with python. I have gone through a fair amount of django documentation.
I am looking forward to work as a volunteer on any professional django 
project that should boost my learning and also assist on building a resume. 
I am not expecting any payment. If you hire me and see that I can assist on 
your work flow, then I am hoping I can join your team as a paid contributor.
It would be a great help if anybody suggest anybody else where there is 
such a scope to join as a volunteer.
Thank you for spending your time in reading this.
- Mehedi

-- 
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/fbeb0825-2860-407d-8764-70e6de4759a9n%40googlegroups.com.


django.core.exceptions.FieldError: Related Field got invalid lookup: relation_type

2021-02-22 Thread Jonas Kiefer

Hi folks,

i implemetned the following models:

```python
class MetadataRelation(models.Model):
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
from_metadata = models.ForeignKey('Metadata', on_delete=models.CASCADE, 
related_name='from_metadatas')
to_metadata = models.ForeignKey('Metadata', on_delete=models.CASCADE, 
related_name='to_metadatas')
relation_type = models.CharField(max_length=255, null=True, blank=True, 


class Metadata(Resource):
...
related_metadatas = models.ManyToManyField('self', through=
'MetadataRelation', symmetrical=False, related_name='related_to+', blank=
True)
```

I want to filter a queryset of `Metadata` objects by the related field 
called `relation_type` like: `Metadata.objects.filter(
metadata_type=MetadataEnum.SERVICE.value,
is_active=True).exclude(related_metadatas__relation_type
=MetadataRelationEnum.HARVESTED_THROUGH.value) django raises 
django.core.exceptions.FieldError: Related Field got invalid lookup: 
relation_type. 

Why i can't use the related fields as filters if i use the through argument 
for the m2m field?


greetings

Jonas

-- 
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/80e10688-94a5-407a-bd9f-6065f23e8224n%40googlegroups.com.


Re: Job related query

2021-02-22 Thread Raphael Polanco
Dear Group Members.

Leaving personnel information on public forums is a security risk. Perhaps
it's best to share directly with the interested party,

Regards,

R. Polanco



On Sun, Feb 21, 2021 at 10:32 PM neha bhurke  wrote:

> If your are from mumbai location just mail me your resume
> *Regard,*
> *Neha Bhurke*
>
>
>
>
>
> On Sat, Feb 20, 2021 at 9:16 PM mubashar ilyas 
> wrote:
>
>> how to apply for this job?
>>
>> On Fri, Feb 19, 2021 at 10:02 AM neha bhurke 
>> wrote:
>>
>>> Hello everyone,
>>>
>>> We are looking for a python Django web app developer should have the
>>> total knowledge about python Django and should be experienced person at
>>> least for 2-3 years..
>>> If anyone  interested …
>>>
>>> --
>>> 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/c8e7ef0a-c72f-405f-94ce-00d953a77c52n%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/CA%2BLLMZb-kjaEpS__xnofNzq0pHx7pvHu%2BaSTW22rZgNbbajWXA%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/CAEwf5Q1BO%3DTGhsxtLQEaQjpAtWXDZw-%3DOptnTjLZ3B8m7g%3DbHA%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/CAJoAtS%3D_qi3Gj9mKutor7Csz%2BES766c533gsjhMO3xa4dJUFuQ%40mail.gmail.com.


Re: AttributeError: type object 'User' has no attribute 'objects'

2021-02-22 Thread georgia...@gmail.com
Sorry I have the same similar problem, please help, thank you!!
I put the question on stackoverflow, there are questions and reference 
materials attached.

So you can click the link to enter : 
https://stackoverflow.com/questions/66310704/attributeerror-type-object-product-has-no-attribute-objects

for
File "C:\Users\georgiawang\PycharmProjects\libshopapp\store\views.py", line 
195, in updateItem** product = Product.objects.get(id=productId) 
AttributeError: type object 'Product' has no attribute 'objects'**
sagar ninave 在 2020年4月27日 星期一下午11:10:21 [UTC+8] 的信中寫道:

> i got answer 
>
> i was doing this:
> from .models import User
> user = User.objects.filter(pk=user_id) 
>
> instead i do this:
> from .models import MyUser
> user =  MyUser.objects.filter(pk=user_id) 
>
>
> error gone
>
>
>
>
> On Mon, Apr 27, 2020 at 6:57 AM Kasper Laudrup  
> wrote:
>
>> Hi Sagar,
>>
>> On 27/04/2020 14.25, sagar ninave wrote:
>> > i am getting this error
>> > 
>>
>> It's hard to guess since you don't show where your User class comes
>> from, but it doesn't seem like its inheriting from the Django model class.
>>
>> The error message is quite clear. Look at your User model.
>>
>> Btw. just a hint: please try to "return early". It is quite difficult to
>> see which else branches are connected to which if statements in the code
>> following the one throwing the exception.
>>
>> 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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/96eba188-98e9-4284-cbab-a3aa3c909c05%40stacktrace.dk
>> .
>>
>
>
> -- 
>
> 
>  
> sagar ninave
> about.me/sagarninave 
> 
>  
>

-- 
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/6c631cbb-2294-4350-b136-e6ef38d9f022n%40googlegroups.com.