Re: Can we use python related api's on the Django templates ?

2020-05-27 Thread Derek
While you cannot use Python operators and functions directly in the 
templates, you can write your own "wrappers" around those you need:

https://docs.djangoproject.com/en/3.0/howto/custom-template-tags/


On Wednesday, 27 May 2020 15:57:34 UTC+2, Daniel Roseman wrote:
>
> On Wednesday, 27 May 2020 13:21:24 UTC+1, ratnadeep ray wrote:
>>
>> Hi all, 
>>
>> Currently I am trying to print the type of a variable from the Django 
>> template html file as follows: 
>>
>> The type of feature list report for version 
>>> {%type(version)%} is
>>
>>
>> For the above, I am getting the following error: 
>>
>> Invalid block tag on line 9: 'type(version)'. Did you forget to register or 
>> load this tag?
>>
>>
>> So what's going wrong here? How can we use the python related api's (like 
>> type) from the html template files? I think inside the {%  %} we can 
>> use python related evaluations. Am I right? 
>>
>> Please throw some lights on this .
>>
>> Thanks. 
>>
>>
> No, you are wrong, and this is explicitly pointed out in the docs (
> https://docs.djangoproject.com/en/3.0/ref/templates/language/):
>
> > bear in mind that the Django template system is not simply Python 
> embedded into HTML. This is by design: the template system is meant to 
> express presentation, not program logic.
>
> --
> DR. 
>

-- 
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/09e739dd-60c8-4360-9f9f-d3270c7901ca%40googlegroups.com.


Re: Migration dependency not added when field is altered

2020-05-27 Thread Durai pandian
When you make any changes to the field, AlterField will be added rather
than AddField.

On Thu, May 28, 2020 at 7:32 AM Erin Masatsugu 
wrote:

> If I have this a model in app A:
> class AppAModel(models.Model):
> name = models.CharField(max_length=50, default="")
>
> and this model in app B:
> class AppBModel(models.Model):
> name = models.CharField(max_length=50, default="")
>
> and a I add a foreign key to AppAModel in app C:
> class AppCModel(models.Model):
> my_field = models.ForeignKey(AppAModel, on_delete=models.CASCADE)
>
> the generated migration file correctly adds a dependency from app C to app
> A:
> class Migration(migrations.Migration):
>
> dependencies = [
> ('app_a', '_app_a_migration'),
> ('app_c', '_app_c_migration'),
> ]
>
> operations = [
> migrations.CreateModel(
> name='AppCModel',
> fields=[
> ('id', models.AutoField(auto_created=True,
> primary_key=True, serialize=False, verbose_name='ID')),
> ('my_field',
> models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
> to='ncm.AppAModel')),
> ],
> ),
> ]
>
> However, if I then update my_field to instead have a foreign key to
> AppBModel, django doesn't add a migration dependency from app C to app B:
> class Migration(migrations.Migration):
>
> dependencies = [
> ('app_c', '_app_c_migration'),
> ]
>
> operations = [
> migrations.AlterField(
> model_name='appcmodel',
> name='my_field',
>
> field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
> to='metals.AppBModel'),
> ),
> ]
>
> I saw the response here
> https://groups.google.com/forum/#!searchin/django-users/migration$20dependency%7Csort:date/django-users/-h9LZxFomLU/ry_yeWGfDQAJ
> so I don't believe this is expected behavior, but can someone confirm?
>
> Thank you!
> Erin
>
> --
> 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/48ab3732-f667-472f-a678-ca9f082315da%40googlegroups.com
> 
> .
>


-- 
Thanks & Regards,


*Durai pandianMobile  : +91-9611051220Email: ddpa...@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/CAJsc%2Boa-PFiracRQiTfWHcw1XnhJSon33ocOTWXdE233Vx2Mag%40mail.gmail.com.


Migration dependency not added when field is altered

2020-05-27 Thread Erin Masatsugu
If I have this a model in app A:
class AppAModel(models.Model):
name = models.CharField(max_length=50, default="")

and this model in app B:
class AppBModel(models.Model):
name = models.CharField(max_length=50, default="")

and a I add a foreign key to AppAModel in app C:
class AppCModel(models.Model):
my_field = models.ForeignKey(AppAModel, on_delete=models.CASCADE)

the generated migration file correctly adds a dependency from app C to app 
A:
class Migration(migrations.Migration):

dependencies = [
('app_a', '_app_a_migration'),
('app_c', '_app_c_migration'),
]

operations = [
migrations.CreateModel(
name='AppCModel',
fields=[
('id', models.AutoField(auto_created=True, 
primary_key=True, serialize=False, verbose_name='ID')),
('my_field', 
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, 
to='ncm.AppAModel')),
],
),
]

However, if I then update my_field to instead have a foreign key to 
AppBModel, django doesn't add a migration dependency from app C to app B:
class Migration(migrations.Migration):

dependencies = [
('app_c', '_app_c_migration'),
]

operations = [
migrations.AlterField(
model_name='appcmodel',
name='my_field',

field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, 
to='metals.AppBModel'),
),
]

I saw the response here 
https://groups.google.com/forum/#!searchin/django-users/migration$20dependency%7Csort:date/django-users/-h9LZxFomLU/ry_yeWGfDQAJ
 
so I don't believe this is expected behavior, but can someone confirm?

Thank you!
Erin

-- 
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/48ab3732-f667-472f-a678-ca9f082315da%40googlegroups.com.


Re: IntegrityError: NOT NULL constraint failed

2020-05-27 Thread sunday honesty
Thanks Samuel it worked

On Thu, May 28, 2020, 12:23 AM Samuel Nogueira  wrote:

> In your Comment model you have a author field wich is a ForeignKey. The
> error is pointing exactly to that field, since it is a not null field. To
> overcome this you must pick the ID of the logged user and set the author
> field with the user ID. You can do that in your views.py the same way as
> you did in new_comment.post = post, only changing .post for .author and
> matching it with request.user. the line will look like this
> new_comment.author = request.user. remember to put it before
> new_comment.save()
>
>
>
> *De: *sunday honesty 
> *Enviado:*quarta-feira, 27 de maio de 2020 19:36
> *Para: *Django users 
> *Assunto: *IntegrityError: NOT NULL constraint failed
>
>
>
> I try to let user add comments to blog post am making... When I run
> makemigrations and migrate, everything seemed fine . The form displayed
> well but shows the following error when I fill the form and click on the
> submit button. Django.db.utils.IntegrityError: NOT NULL constraint failed:
> blog_comment.author_id
>
>
>
> Am new to Django and following a tutorial. The tutorial doesn't have users
> except the super user. I learnt about users and so I let user register to
> use the blog. The tutorial provided a name field in the form so commenter
> can enter their name. Here, I want to use the current user for this
> field(see my models.py below to see how I have done this). Any help to
> solve this will be appreciated.
>
>
>
> PS: I have seen similar questions like this and deleted my migrations file
> and re-ran migrations but it didn't still work.
>
>
>
> #models.py
>
> class Comment(models.Model):
>
> post = models.ForeignKey(Post, on_delete=models.CASCADE,
> related_name='comments')
>
> author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE,)
>
> comment = models.TextField()
>
> created = models.DateTimeField(auto_now_add=True)
>
> updated = models.DateTimeField(auto_now=True)
>
> active = models.BooleanField(default=True)
>
>
>
> class Meta:
>
> ordering = ('created',)
>
>
>
> def __str__(self):
>
> return f'Comment by {self.author} on {self.post}'
>
>
>
> #forms.py
>
> class CommentForm(forms.ModelForm):
>
>
>
> class Meta:
>
> model = Comment
>
> fields = ('comment',)
>
>
>
> #views.py
>
> login_required
>
> def post_detail(request, post, pk):
>
> post = get_object_or_404(Post, id=pk, slug=post, status='published')
>
> comments = post.comments.filter(active=True)
>
> new_comment = None
>
>
>
> if request.method == 'POST':
>
> comment_form = CommentForm(data=request.POST)
>
> if comment_form.is_valid():
>
> new_comment = comment_form.save(commit=False)
>
> new_comment.post = post
>
> new_comment.save()
>
> else:
>
> comment_form = CommentForm()
>
> return render(request,
>
> 'post_detail.html',
>
> {'post': post,
>
> 'comments': comments,
>
> 'new_comment': new_comment,
>
> 'comment_form': comment_form})
>
>
>
> --
>
> 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/87349ba6-bb75-477c-a84b-9e15be428a5b%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/5ecef62c.1c69fb81.ab057.4da7%40mx.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/CALcuGNtreJ4koB6v22TtGKsPSD9-w4%3DzFR_v63u5c%3Dk6rNJUXA%40mail.gmail.com.


RES: IntegrityError: NOT NULL constraint failed

2020-05-27 Thread Samuel Nogueira
In your Comment model you have a author field wich is a ForeignKey. The error is pointing exactly to that field, since it is a not null field. To overcome this you must pick the ID of the logged user and set the author field with the user ID. You can do that in your views.py the same way as you did in new_comment.post = post, only changing .post for .author and matching it with request.user. the line will look like this new_comment.author = request.user. remember to put it before new_comment.save()  De: sunday honestyEnviado:quarta-feira, 27 de maio de 2020 19:36Para: Django usersAssunto: IntegrityError: NOT NULL constraint failed I try to let user add comments to blog post am making... When I run makemigrations and migrate, everything seemed fine . The form displayed well but shows the following error when I fill the form and click on the submit button. Django.db.utils.IntegrityError: NOT NULL constraint failed: blog_comment.author_id Am new to Django and following a tutorial. The tutorial doesn't have users except the super user. I learnt about users and so I let user register to use the blog. The tutorial provided a name field in the form so commenter can enter their name. Here, I want to use the current user for this field(see my models.py below to see how I have done this). Any help to solve this will be appreciated. PS: I have seen similar questions like this and deleted my migrations file and re-ran migrations but it didn't still work. #models.pyclass Comment(models.Model):    post = models.ForeignKey(Post, _on_delete_=models.CASCADE, related_name='comments')    author = models.ForeignKey(get_user_model(), _on_delete_=models.CASCADE,)    comment = models.TextField()   created = models.DateTimeField(auto_now_add=True)  updated = models.DateTimeField(auto_now=True)    active = models.BooleanField(default=True) class Meta:    ordering = ('created',) def __str__(self):    return f'Comment by {self.author} on {self.post}' #forms.pyclass CommentForm(forms.ModelForm): class Meta:    model = Comment    fields = ('comment',) #views.pylogin_requireddef post_detail(request, post, pk):    post = get_object_or_404(Post, id=pk, slug=post, status='published')    comments = post.comments.filter(active=True)    new_comment = None if request.method == 'POST':    comment_form = CommentForm(data="">    if comment_form.is_valid():    new_comment = comment_form.save(commit=False)    new_comment.post = post    new_comment.save()    else:    comment_form = CommentForm()    return render(request,    'post_detail.html',    {'post': post,    'comments': comments,    'new_comment': new_comment,    'comment_form': comment_form}) -- 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/87349ba6-bb75-477c-a84b-9e15be428a5b%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/5ecef62c.1c69fb81.ab057.4da7%40mx.google.com.


RES: RES: Re: Deploy on heroku with Geodjango/ postgis

2020-05-27 Thread Samuel Nogueira
Sure! Here it is: https://github.com/SamuelNoB/Primeiro-Projeto-Django-REST Sorry if my requirements.txt is messy. I didn’t set properly my venv and it pulled all packages of my system  De: Mujahid AbbasEnviado:quarta-feira, 27 de maio de 2020 19:16Para: Django usersAssunto: RES: Re: Deploy on heroku with Geodjango/ postgis Could you share you GitHub repo so that I'll help 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/9693b29a-12f0-47a1-8610-b5ccabacd2e3%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/5ecef15e.1c69fb81.c0757.7d59%40mx.google.com.


IntegrityError: NOT NULL constraint failed

2020-05-27 Thread sunday honesty
I try to let user add comments to blog post am making... When I run 
makemigrations and migrate, everything seemed fine . The form displayed well 
but shows the following error when I fill the form and click on the submit 
button. Django.db.utils.IntegrityError: NOT NULL constraint failed: 
blog_comment.author_id

Am new to Django and following a tutorial. The tutorial doesn't have users 
except the super user. I learnt about users and so I let user register to use 
the blog. The tutorial provided a name field in the form so commenter can enter 
their name. Here, I want to use the current user for this field(see my 
models.py below to see how I have done this). Any help to solve this will be 
appreciated.

PS: I have seen similar questions like this and deleted my migrations file and 
re-ran migrations but it didn't still work.

#models.py
class Comment(models.Model):
post = models.ForeignKey(Post, on_delete=models.CASCADE, 
related_name='comments')
author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE,)
comment = models.TextField()   
created = models.DateTimeField(auto_now_add=True)  
updated = models.DateTimeField(auto_now=True)
active = models.BooleanField(default=True)

class Meta:
ordering = ('created',)

def __str__(self):
return f'Comment by {self.author} on {self.post}'

#forms.py
class CommentForm(forms.ModelForm):

class Meta:
model = Comment
fields = ('comment',)

#views.py
login_required
def post_detail(request, post, pk):
post = get_object_or_404(Post, id=pk, slug=post, status='published')
comments = post.comments.filter(active=True)
new_comment = None

if request.method == 'POST':
comment_form = CommentForm(data=request.POST)
if comment_form.is_valid():
new_comment = comment_form.save(commit=False)
new_comment.post = post
new_comment.save()
else:
comment_form = CommentForm()
return render(request,
'post_detail.html',
{'post': post,
'comments': comments,
'new_comment': new_comment,
'comment_form': comment_form})

-- 
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/87349ba6-bb75-477c-a84b-9e15be428a5b%40googlegroups.com.


Re: Read Text file in django

2020-05-27 Thread Mujahid Abbas
Well

On Thu 28 May, 2020, 2:37 AM Ammar M. Adam,  wrote:

> Welcome 😊 anytime 😁
> On May 27, 2020 23:30, "Lansana Sangare"  wrote:
>
>> Thanks guy, it works now
>>
>> Ammar M. Adam  schrieb am Di., 26. Mai 2020,
>> 23:43:
>>
>>> The FileField Must have a function for that
>>> Use help(django.models.FileField)
>>> It must have some sort of FileField.read() or something like that.
>>> Am also a beginner but I think this should work with you 😉.
>>> On May 26, 2020 23:34, "Lansana Sangare"  wrote:
>>>
 Good evening people,
 i'm a beginner at django, i try to read a text file in django template
 but i only get the data.txt in template. how can i open and read the
 content of the text file in templates. Below you can see the html
 section and the output. Thanks in advance

 Django model:

 class Patienten(models.Model):
 Name = models.CharField(max_length=50)
 Vorname = models.CharField(max_length=50, null=True)
 Geburtsdatum = models.DateField(max_length=10)
 Strasse = models.CharField(max_length=100)
 Ort = models.CharField(max_length=100, null=True)
 Datum = models.DateField(max_length=10, null=True)
 Versicherungsnummer = models.CharField(max_length=50)
 Letzte_Diagnose = models.CharField(max_length=500)
 Schrittinfos = models.FileField(max_length=100, null=True)



 html part:

 Patientendaten
 {% for post in posts%}
 Patient:{{ post.Name }}
 Geburtsdatum:{{ post.Geburtsdatum|linebreaksbr }}
 Versicherungsnummer:{{ post.Versicherungsnummer }}
 Letzte Diagnose:{{ post.Letzte_Diagnose }}
 Ort:{{ post.Ort }}
 Datum:{{ post.Datum }}
 Schrittinfos:{{ post.Schrittinfos }}

 *html Output Part in Templates :*
 Patient:Sangare

 Geburtsdatum:1990-05-30

 Versicherungsnummer:D0469556541990

 Letzte Diagnose:Gelenkschmerzen

 Ort:Essen

 Datum:May 26, 2020

 Schrittinfos:data.txt


 --
 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/073bceca-3b93-4eb4-9647-873b7a7aa0fe%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/CAHs1H7utBp5rC9av1JM-qAgpRFe7mxiCx%3DS8KUWPJ05DGOHe%3Dw%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/CAF4Pwrs4Ax8d9P-b%2B8PWdeNNU8R2KLh4x%3D94OQVWpn2MUALYLw%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/CAHs1H7v_zV03DTA8Sd5LomUKnChBeG0yaj89uT%3DtXYsrBVJysQ%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/CAN%2BPCf1a68p26%3D3oAHzqQF7sWaXE%2B02HbcwvD0PKVH6f8mjs%3Dg%40mail.gmail.com.


RES: Re: Deploy on heroku with Geodjango/ postgis

2020-05-27 Thread Mujahid Abbas
Could you share you GitHub repo so that I'll help 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/9693b29a-12f0-47a1-8610-b5ccabacd2e3%40googlegroups.com.


Re: Optimized Query

2020-05-27 Thread Soumen Khatua
Actually I want to fetch all users from User table and users location from
Location table which is many to many relation from same Profile table. Is
it possible???

On Thu 28 May, 2020, 2:54 AM Soumen Khatua, 
wrote:

> Now I'm facing one problem whenever I'm trying to iterate a loop I'm
> getting too many SQL variables. Actually after iterating the loop I want to
> render all the value in the template.
> if could you resolve this it would be very good for me.
> Thank you for your time and response
>
> Regards,
> Soumen
>
>
> On Thu, May 28, 2020 at 2:12 AM Chetan Ganji 
> wrote:
>
>>
>> Profile.objects.filter().select_related("user").prefetch_related("location")
>>
>> On Thu, May 28, 2020, 2:01 AM Soumen Khatua 
>> wrote:
>>
>>> I also know about this concept but I don't how I can achieve it, Could
>>> you give me an example?
>>> Suppose I have:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *class Profile(models.Model):user = models.OneToOneField(
>>> settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
>>> related_name="profile")location = models.ManyToManyField(Location)*
>>>
>>>
>>> Thank you
>>>
>>> Regards,
>>> Soumen
>>>
>>> On Wed, May 27, 2020 at 7:20 PM Chetan Ganji 
>>> wrote:
>>>
 select_related for fk and prefetch_related for m2m in django, you can
 chain them together

 Regards,
 Chetan Ganji
 +91-900-483-4183
 ganji.che...@gmail.com
 http://ryucoder.in


 On Wed, May 27, 2020 at 4:51 PM Soumen Khatua <
 soumenkhatua...@gmail.com> wrote:

> Hi Folks,
> I have many to many relationships and Foreign Key in the table, I'm
> using select_realted(foreign key filed name) to optimize the query but I
> want to fetch many to many and foreign key at the same time , How I can do
> this in very optimized way?
>
> Thank You
> Regards,
> Soumen
>
> --
> 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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%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/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%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/CAPUw6WZXtTJssu6SwO8_BiTDxDnzJtKYy9j1hQsMR74jKYC6aA%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/CAMKMUjth%3DNm%2BUa74bz1PiRYFGhKU-PER9_Y_XQdHRQ23KMbp7Q%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/CAPUw6WY0T5U10NpzTXcsmdsvx641cdDiYJaU%2B3DEjzmb3iPDEA%40mail.gmail.com.


Re: Optmized Query

2020-05-27 Thread Soumen Khatua
Now I'm facing one problem whenever I'm trying to iterate a loop I'm
getting too many SQL variables. Actually after iterating the loop I want to
render all the value in the template.
if could you resolve this it would be very good for me.
Thank you for your time and response

Regards,
Soumen


On Thu, May 28, 2020 at 2:12 AM Chetan Ganji  wrote:

>
> Profile.objects.filter().select_related("user").prefetch_related("location")
>
> On Thu, May 28, 2020, 2:01 AM Soumen Khatua 
> wrote:
>
>> I also know about this concept but I don't how I can achieve it, Could
>> you give me an example?
>> Suppose I have:
>>
>>
>>
>>
>>
>>
>>
>> *class Profile(models.Model):user = models.OneToOneField(
>> settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
>> related_name="profile")location = models.ManyToManyField(Location)*
>>
>>
>> Thank you
>>
>> Regards,
>> Soumen
>>
>> On Wed, May 27, 2020 at 7:20 PM Chetan Ganji 
>> wrote:
>>
>>> select_related for fk and prefetch_related for m2m in django, you can
>>> chain them together
>>>
>>> Regards,
>>> Chetan Ganji
>>> +91-900-483-4183
>>> ganji.che...@gmail.com
>>> http://ryucoder.in
>>>
>>>
>>> On Wed, May 27, 2020 at 4:51 PM Soumen Khatua 
>>> wrote:
>>>
 Hi Folks,
 I have many to many relationships and Foreign Key in the table, I'm
 using select_realted(foreign key filed name) to optimize the query but I
 want to fetch many to many and foreign key at the same time , How I can do
 this in very optimized way?

 Thank You
 Regards,
 Soumen

 --
 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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%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/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%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/CAPUw6WZXtTJssu6SwO8_BiTDxDnzJtKYy9j1hQsMR74jKYC6aA%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/CAMKMUjth%3DNm%2BUa74bz1PiRYFGhKU-PER9_Y_XQdHRQ23KMbp7Q%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/CAPUw6WZAY41ksoCccKGuM%2BRSYtyMBiQeYaZAZGz4v-T2_t_Jow%40mail.gmail.com.


Re: Read Text file in django

2020-05-27 Thread Ammar M. Adam
Welcome 😊 anytime 😁
On May 27, 2020 23:30, "Lansana Sangare"  wrote:

> Thanks guy, it works now
>
> Ammar M. Adam  schrieb am Di., 26. Mai 2020, 23:43:
>
>> The FileField Must have a function for that
>> Use help(django.models.FileField)
>> It must have some sort of FileField.read() or something like that.
>> Am also a beginner but I think this should work with you 😉.
>> On May 26, 2020 23:34, "Lansana Sangare"  wrote:
>>
>>> Good evening people,
>>> i'm a beginner at django, i try to read a text file in django template
>>> but i only get the data.txt in template. how can i open and read the
>>> content of the text file in templates. Below you can see the html
>>> section and the output. Thanks in advance
>>>
>>> Django model:
>>>
>>> class Patienten(models.Model):
>>> Name = models.CharField(max_length=50)
>>> Vorname = models.CharField(max_length=50, null=True)
>>> Geburtsdatum = models.DateField(max_length=10)
>>> Strasse = models.CharField(max_length=100)
>>> Ort = models.CharField(max_length=100, null=True)
>>> Datum = models.DateField(max_length=10, null=True)
>>> Versicherungsnummer = models.CharField(max_length=50)
>>> Letzte_Diagnose = models.CharField(max_length=500)
>>> Schrittinfos = models.FileField(max_length=100, null=True)
>>>
>>>
>>>
>>> html part:
>>>
>>> Patientendaten
>>> {% for post in posts%}
>>> Patient:{{ post.Name }}
>>> Geburtsdatum:{{ post.Geburtsdatum|linebreaksbr }}
>>> Versicherungsnummer:{{ post.Versicherungsnummer }}
>>> Letzte Diagnose:{{ post.Letzte_Diagnose }}
>>> Ort:{{ post.Ort }}
>>> Datum:{{ post.Datum }}
>>> Schrittinfos:{{ post.Schrittinfos }}
>>>
>>> *html Output Part in Templates :*
>>> Patient:Sangare
>>>
>>> Geburtsdatum:1990-05-30
>>>
>>> Versicherungsnummer:D0469556541990
>>>
>>> Letzte Diagnose:Gelenkschmerzen
>>>
>>> Ort:Essen
>>>
>>> Datum:May 26, 2020
>>>
>>> Schrittinfos:data.txt
>>>
>>>
>>> --
>>> 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/073bceca-3b93-4eb4-9647-873b7a7aa0fe%
>>> 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/CAHs1H7utBp5rC9av1JM-qAgpRFe7mxiCx%
>> 3DS8KUWPJ05DGOHe%3Dw%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/CAF4Pwrs4Ax8d9P-b%2B8PWdeNNU8R2KLh4x%
> 3D94OQVWpn2MUALYLw%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/CAHs1H7v_zV03DTA8Sd5LomUKnChBeG0yaj89uT%3DtXYsrBVJysQ%40mail.gmail.com.


Re: Optmized Query

2020-05-27 Thread Chetan Ganji
Profile.objects.filter().select_related("user").prefetch_related("location")

On Thu, May 28, 2020, 2:01 AM Soumen Khatua 
wrote:

> I also know about this concept but I don't how I can achieve it, Could
> you give me an example?
> Suppose I have:
>
>
>
>
>
>
>
> *class Profile(models.Model):user = models.OneToOneField(
> settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
> related_name="profile")location = models.ManyToManyField(Location)*
>
>
> Thank you
>
> Regards,
> Soumen
>
> On Wed, May 27, 2020 at 7:20 PM Chetan Ganji 
> wrote:
>
>> select_related for fk and prefetch_related for m2m in django, you can
>> chain them together
>>
>> Regards,
>> Chetan Ganji
>> +91-900-483-4183
>> ganji.che...@gmail.com
>> http://ryucoder.in
>>
>>
>> On Wed, May 27, 2020 at 4:51 PM Soumen Khatua 
>> wrote:
>>
>>> Hi Folks,
>>> I have many to many relationships and Foreign Key in the table, I'm
>>> using select_realted(foreign key filed name) to optimize the query but I
>>> want to fetch many to many and foreign key at the same time , How I can do
>>> this in very optimized way?
>>>
>>> Thank You
>>> Regards,
>>> Soumen
>>>
>>> --
>>> 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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%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/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%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/CAPUw6WZXtTJssu6SwO8_BiTDxDnzJtKYy9j1hQsMR74jKYC6aA%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/CAMKMUjth%3DNm%2BUa74bz1PiRYFGhKU-PER9_Y_XQdHRQ23KMbp7Q%40mail.gmail.com.


Re: Optmized Query

2020-05-27 Thread Soumen Khatua
I also know about this concept but I don't how I can achieve it, Could
you give me an example?
Suppose I have:







*class Profile(models.Model):user = models.OneToOneField(
settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
related_name="profile")location = models.ManyToManyField(Location)*


Thank you

Regards,
Soumen

On Wed, May 27, 2020 at 7:20 PM Chetan Ganji  wrote:

> select_related for fk and prefetch_related for m2m in django, you can
> chain them together
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Wed, May 27, 2020 at 4:51 PM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>> I have many to many relationships and Foreign Key in the table, I'm using
>> select_realted(foreign key filed name) to optimize the query but I want to
>> fetch many to many and foreign key at the same time , How I can do this in
>> very optimized way?
>>
>> Thank You
>> Regards,
>> Soumen
>>
>> --
>> 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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%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/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%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/CAPUw6WZXtTJssu6SwO8_BiTDxDnzJtKYy9j1hQsMR74jKYC6aA%40mail.gmail.com.


Re: Read Text file in django

2020-05-27 Thread Lansana Sangare
Thanks guy, it works now

Ammar M. Adam  schrieb am Di., 26. Mai 2020, 23:43:

> The FileField Must have a function for that
> Use help(django.models.FileField)
> It must have some sort of FileField.read() or something like that.
> Am also a beginner but I think this should work with you 😉.
> On May 26, 2020 23:34, "Lansana Sangare"  wrote:
>
>> Good evening people,
>> i'm a beginner at django, i try to read a text file in django template
>> but i only get the data.txt in template. how can i open and read the
>> content of the text file in templates. Below you can see the html
>> section and the output. Thanks in advance
>>
>> Django model:
>>
>> class Patienten(models.Model):
>> Name = models.CharField(max_length=50)
>> Vorname = models.CharField(max_length=50, null=True)
>> Geburtsdatum = models.DateField(max_length=10)
>> Strasse = models.CharField(max_length=100)
>> Ort = models.CharField(max_length=100, null=True)
>> Datum = models.DateField(max_length=10, null=True)
>> Versicherungsnummer = models.CharField(max_length=50)
>> Letzte_Diagnose = models.CharField(max_length=500)
>> Schrittinfos = models.FileField(max_length=100, null=True)
>>
>>
>>
>> html part:
>>
>> Patientendaten
>> {% for post in posts%}
>> Patient:{{ post.Name }}
>> Geburtsdatum:{{ post.Geburtsdatum|linebreaksbr }}
>> Versicherungsnummer:{{ post.Versicherungsnummer }}
>> Letzte Diagnose:{{ post.Letzte_Diagnose }}
>> Ort:{{ post.Ort }}
>> Datum:{{ post.Datum }}
>> Schrittinfos:{{ post.Schrittinfos }}
>>
>> *html Output Part in Templates :*
>> Patient:Sangare
>>
>> Geburtsdatum:1990-05-30
>>
>> Versicherungsnummer:D0469556541990
>>
>> Letzte Diagnose:Gelenkschmerzen
>>
>> Ort:Essen
>>
>> Datum:May 26, 2020
>>
>> Schrittinfos:data.txt
>>
>>
>> --
>> 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/073bceca-3b93-4eb4-9647-873b7a7aa0fe%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/CAHs1H7utBp5rC9av1JM-qAgpRFe7mxiCx%3DS8KUWPJ05DGOHe%3Dw%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/CAF4Pwrs4Ax8d9P-b%2B8PWdeNNU8R2KLh4x%3D94OQVWpn2MUALYLw%40mail.gmail.com.


Re: Parallel or split payment options using paypal

2020-05-27 Thread Kasper Laudrup

Hi John,

On 27/05/2020 19.06, John McClain wrote:

Hello All,

Can anyone provide a method to split payments via paypal. I basically 
want to earn a commission on the sale and pass the balance to the seller 
through my marketplace.




Maybe this would be a better place to ask:

https://www.paypal.com/us/smarthelp/home

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/b70b068e-fcdc-74a3-446d-a32ae4b544f5%40stacktrace.dk.


Parallel or split payment options using paypal

2020-05-27 Thread John McClain
Hello All,

Can anyone provide a method to split payments via paypal. I basically want
to earn a commission on the sale and pass the balance to the seller through
my marketplace.

Thanks,

John

-- 
John McClain

Cell: 085-1977-823
Skype: jmcclain0129
Email: jmcclain0...@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/CAN-hv_r%3DJ2rCLQOSiFQ%3DRBz_h2Po7AZSy2T37fapMX9HpyX19Q%40mail.gmail.com.


Re: How to create chatroom?

2020-05-27 Thread Motaz Hejaze
Read about django channels

On Wed, 27 May 2020, 1:30 pm meera gangani, 
wrote:

> I want to create chatroom in django like slack, where user can post
> messages to the room and at the same time other user can see those message
> immediately
>
> What Can I Do?
> And What are the Libraries I install?
> Please Help Me Out!!
>
>
> Thanks In Advance
> -Meera Gangani
>
> --
> 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/CANaPPP%2BriRwafC3SCJptEZEy3S9iKgJPA0WDoMjvABWCfw6Rzw%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-c%3DWv59y5acTYcZnfQ%3Dct1VWL8Y99EA2Juk0cYMx%3DvORw%40mail.gmail.com.


Re: Regarding redering data in html templates

2020-05-27 Thread VenkataSivaRamiReddy
You got solution for your query?

On Wed, May 27, 2020, 14:52 Ifeanyi Chielo 
wrote:

> at the html file of your template folder, use something like
> {{table1.skin_care1}}
> {{table1.skin_care2}} etc
>
> note skin_care1, skin_care etc are fields in your model table 'table1'
>
> Dr. Chielo C. Ifeanyi
> Chief Programmer,
> Head Webometrics Section
> ICT Unit, UNN
> 08032366433, 08154804230
> ifeanyi.chi...@unn.edu.ng
> http://www.unn.edu.ng/users/ifeanyichielo 
>
>
>
> On Mon, May 25, 2020 at 4:05 PM Karthiki Chowdary <
> karthichowdary...@gmail.com> wrote:
>
>> Hi i was beginner in django and i have a small query in templates.
>> For suppose in the home page of any client browser if we have a button
>> like SKINCARE or HEALTH CARE and if we click on that buttons we need to get
>> the data of all skin care products companies logos/ health care companies
>> logos. For that how i can render data in dictionaries suppose i want to
>> render a static data how can i or i want or render a dynamic data how can i
>> do that with dictionaries so other better option. Please help me out in this
>>
>> --
>> 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/f2306e60-f48f-4e47-959c-763e9659182b%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/CAOcS8H17YqSsVUpHor0%2BWSeq_WJvP5z3Gac33ZPTJD47ScG92g%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/CAGiJVX0jiiu%3DTzyvikU5MLxxS8ESZX4c6Bj7Yn%2B%3DGu8%2Bn6z8ZQ%40mail.gmail.com.


Re: Redirect to login page without losing content of form

2020-05-27 Thread Jan Gregorczyk
Ok. Now I've dealt with this returned None problem, but I still have no 
idea what to do to keep my form content after clicking submit button. Does 
next parmeter generated by login_required contain only link or also form 
content?

W dniu środa, 27 maja 2020 15:58:22 UTC+2 użytkownik Jan Gregorczyk napisał:
>
> *I* have problem similar to this one: 
> https://stackoverflow.com/questions/50272631/django-form-data-lost-on-making-login-required-on-post
> I want answer to be added if user is logged in otherwise redirect user to 
> login page, let him login and then add his answer. My problem is that I 
> lose content of the form. 
> At the moment I'm getting this errror: 
>
> The view questions.views.answer didn't return an HttpResponse object. It 
> returned None instead.
>
>
> def question(request, question_id):
> question = get_object_or_404(Question, pk=question_id)
> form = AnswerForm()
> return render(request, 'questions/question.html', {'question': question, 
> 'form' : form},)
>
> @login_required
> def answer(request, question_id):
> question = get_object_or_404(Question, pk=question_id)
> form = AnswerForm(request.POST) if request.method == 'POST' else 
> AnswerForm()
> if form.is_valid():
> answer = form.save(commit=False)
> answer.author = request.user
> answer.question = question
> answer.save()
> return HttpResponseRedirect(reverse('question', args=(question.id,)))
>
>
>
> 
> {% csrf_token %}
> {{form.as_p}}
> 
> 
>
> form method="post" action="{% url 'login' %}">
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
> 
>

-- 
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/cd4abaec-face-4f8f-8a69-72258fe611b1%40googlegroups.com.


Re: function model which generate a code for model field

2020-05-27 Thread Anselme SERI
the error message is
unsupported format string passed to NoneType.__format__

Le mer. 27 mai 2020 à 13:09, Akinfolarin Stephen <
akinfolarinsteph...@gmail.com> a écrit :

> i feel in your last session you are trying to concatenate a string and an
> integer use the int function to convert it to string then the number will
> show
>
> On Monday, May 25, 2020 at 5:48:29 AM UTC+14, Anselme SERI wrote:
>>
>> from django.db import models
>>>
>>>
>>> def codeid():
>>> lastid = MyModel.objects.last(id)
>>> autocode = ''
>>> if lastid == 0:
>>> autocode = 'BAC1'
>>> elif lastid != 0:
>>> if len(lastid) <= 8:
>>> lastid += 1
>>> autocode = 'D/BAC/' + lastid
>>> elif 9 < len(lastid) <= 98:
>>> lastid += 1
>>> autocode = 'D/BAC/000' + lastid
>>> elif 99 < len(lastid) <= 998:
>>> lastid += 1
>>> autocode = 'D/BAC/00' + lastid
>>> return autocode
>>>
>>>
>>> class MyModel(models.Model):
>>> libelle = models.CharField('Libellé', max_length=100)
>>> code = models.CharField(max_length=30, unique=True, 
>>> auto_created=codeid())
>>>
>>> def __str__(self):
>>> return self.code
>>>
>>>
>> Hello,
>>
>> I try  to to write a correct function for my model which  generate a str
>> + incremental number according last id model.
>>
>> Pleaz 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/b6a63f0d-1dbd-4700-b94a-31e6caec7225%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/CACbA33odA8jvyJfs8a2nujz-vuwmN3bGyZzCHZa_zT6BmWzQvA%40mail.gmail.com.


Re: function model which generate a code for model field

2020-05-27 Thread Anselme SERI
When I test the function you offer 'self.id' returns 'None'

Le mer. 27 mai 2020 à 13:09, Akinfolarin Stephen <
akinfolarinsteph...@gmail.com> a écrit :

> i feel in your last session you are trying to concatenate a string and an
> integer use the int function to convert it to string then the number will
> show
>
> On Monday, May 25, 2020 at 5:48:29 AM UTC+14, Anselme SERI wrote:
>>
>> from django.db import models
>>>
>>>
>>> def codeid():
>>> lastid = MyModel.objects.last(id)
>>> autocode = ''
>>> if lastid == 0:
>>> autocode = 'BAC1'
>>> elif lastid != 0:
>>> if len(lastid) <= 8:
>>> lastid += 1
>>> autocode = 'D/BAC/' + lastid
>>> elif 9 < len(lastid) <= 98:
>>> lastid += 1
>>> autocode = 'D/BAC/000' + lastid
>>> elif 99 < len(lastid) <= 998:
>>> lastid += 1
>>> autocode = 'D/BAC/00' + lastid
>>> return autocode
>>>
>>>
>>> class MyModel(models.Model):
>>> libelle = models.CharField('Libellé', max_length=100)
>>> code = models.CharField(max_length=30, unique=True, 
>>> auto_created=codeid())
>>>
>>> def __str__(self):
>>> return self.code
>>>
>>>
>> Hello,
>>
>> I try  to to write a correct function for my model which  generate a str
>> + incremental number according last id model.
>>
>> Pleaz 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/b6a63f0d-1dbd-4700-b94a-31e6caec7225%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/CACbA33oZNwDfKBTPPgvz41rZ6K-crA6efZc-ARVKPiDeap5Kjw%40mail.gmail.com.


Re: Redirect to login page without losing content of form

2020-05-27 Thread Kasper Laudrup

Hi Jan,

On 27/05/2020 14.01, Jan Gregorczyk wrote:

At the moment I'm getting this errror:

The view questions.views.answer didn't return an HttpResponse object. It 
returned None instead.



Consider what will happen if the form is *not* valid, ie. this statement 
returns false:


if form.is_valid():

Remember that functions in Python without an explicit return will 
implicitly return None.


That should hopefully make it clear.

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/377a741e-e5d1-1b5d-1a91-e194a9d116a9%40stacktrace.dk.


Re: Can we use python related api's on the Django templates ?

2020-05-27 Thread Daniel Roseman
On Wednesday, 27 May 2020 13:21:24 UTC+1, ratnadeep ray wrote:
>
> Hi all, 
>
> Currently I am trying to print the type of a variable from the Django 
> template html file as follows: 
>
> The type of feature list report for version 
>> {%type(version)%} is
>
>
> For the above, I am getting the following error: 
>
> Invalid block tag on line 9: 'type(version)'. Did you forget to register or 
> load this tag?
>
>
> So what's going wrong here? How can we use the python related api's (like 
> type) from the html template files? I think inside the {%  %} we can 
> use python related evaluations. Am I right? 
>
> Please throw some lights on this .
>
> Thanks. 
>
>
No, you are wrong, and this is explicitly pointed out in the docs 
(https://docs.djangoproject.com/en/3.0/ref/templates/language/):

> bear in mind that the Django template system is not simply Python 
embedded into HTML. This is by design: the template system is meant to 
express presentation, not program logic.

--
DR. 

-- 
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/0a73190c-06f6-4151-9777-c691d084b8b3%40googlegroups.com.


Redirect to login page without losing content of form

2020-05-27 Thread Jan Gregorczyk
*I* have problem similar to this one: 
https://stackoverflow.com/questions/50272631/django-form-data-lost-on-making-login-required-on-post
I want answer to be added if user is logged in otherwise redirect user to 
login page, let him login and then add his answer. My problem is that I 
lose content of the form. 
At the moment I'm getting this errror: 

The view questions.views.answer didn't return an HttpResponse object. It 
returned None instead.


def question(request, question_id):
question = get_object_or_404(Question, pk=question_id)
form = AnswerForm()
return render(request, 'questions/question.html', {'question': question, 
'form' : form},)

@login_required
def answer(request, question_id):
question = get_object_or_404(Question, pk=question_id)
form = AnswerForm(request.POST) if request.method == 'POST' else 
AnswerForm()
if form.is_valid():
answer = form.save(commit=False)
answer.author = request.user
answer.question = question
answer.save()
return HttpResponseRedirect(reverse('question', args=(question.id,)))




{% csrf_token %}
{{form.as_p}}



form method="post" action="{% url 'login' %}">
{% csrf_token %}
{{ form.as_p }}




-- 
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/4d2bd93d-3a92-4e14-9b8b-f758616c6cfb%40googlegroups.com.


Re: Optmized Query

2020-05-27 Thread Chetan Ganji
select_related for fk and prefetch_related for m2m in django, you can chain
them together

Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Wed, May 27, 2020 at 4:51 PM Soumen Khatua 
wrote:

> Hi Folks,
> I have many to many relationships and Foreign Key in the table, I'm using
> select_realted(foreign key filed name) to optimize the query but I want to
> fetch many to many and foreign key at the same time , How I can do this in
> very optimized way?
>
> Thank You
> Regards,
> Soumen
>
> --
> 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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%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/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%40mail.gmail.com.


Re: function model which generate a code for model field

2020-05-27 Thread Akinfolarin Stephen
i feel in your last session you are trying to concatenate a string and an 
integer use the int function to convert it to string then the number will 
show

On Monday, May 25, 2020 at 5:48:29 AM UTC+14, Anselme SERI wrote:
>
> from django.db import models
>>
>>
>> def codeid():
>> lastid = MyModel.objects.last(id)
>> autocode = ''
>> if lastid == 0:
>> autocode = 'BAC1'
>> elif lastid != 0:
>> if len(lastid) <= 8:
>> lastid += 1
>> autocode = 'D/BAC/' + lastid
>> elif 9 < len(lastid) <= 98:
>> lastid += 1
>> autocode = 'D/BAC/000' + lastid
>> elif 99 < len(lastid) <= 998:
>> lastid += 1
>> autocode = 'D/BAC/00' + lastid
>> return autocode
>>
>>
>> class MyModel(models.Model):
>> libelle = models.CharField('Libellé', max_length=100)
>> code = models.CharField(max_length=30, unique=True, 
>> auto_created=codeid())
>>
>> def __str__(self):
>> return self.code
>>
>>
> Hello,
>
> I try  to to write a correct function for my model which  generate a str + 
> incremental number according last id model.
>
> Pleaz 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/b6a63f0d-1dbd-4700-b94a-31e6caec7225%40googlegroups.com.


Looking for a solution? Calculating index/offset of a particular record?

2020-05-27 Thread Benjamin Schollnick
I’m trying to optimize a few different things.

I am looking to try to change this into a more database driven routine, instead 
of having to iterate through each and every record.  While not time consuming 
(overall), I would like to try to make it a bit cleaner…

Effectively I am calculating which record the user is actually looking at in 
the gallery.  The UUID is based into the view, and the view then has to figure 
out it’s image XX out of YYY.

 for counter, data in enumerate(catalog_qs, start=1):
 if str(data.uuid) == e_uuid:
 context["page"] = counter
 break

I generalized it to this:

def return_offset_uuid(sorder, fpath, tuuid):
"""
Fetch specific database values only from the database
"""
entries = 
index_data.objects.exclude(ignore=True).exclude(delete_pending=True).filter(
fqpndirectory=fpath.lower().strip()).order_by(*SORT_MATRIX[sorder])
tpk = entries.filter(uuid=tuuid.strip())[0].pk
count = entries.filter(pk__lte=tpk).count() - 1
#answer = user.answer_set.filter(question=question).get()
# return user.answer_set.filter(pk__lte=answer.pk).count() - 1
return count


Which *seemed* to work, except it didn’t.  Yes, I got results:

>>> return_offset_uuid(0, album, "c0543ce7-d156-430d-b08a-5f7379b6e246")# 1
1
>>> return_offset_uuid(0, album, "519f5b9c-e4f4-44e1-aa82-f36aed98e6a9")# 31
4905
>>> return_offset_uuid(0, album, "754fcb51-c3ad-417d-b317-b86305597ae9")# 61
5044
>>> return_offset_uuid(0, album, "b85f18e0-aa17-4192-9c0f-a363d82fa127")# 91
81
>>> return_offset_uuid(0, album, "fe750266-5fb6-467a-929e-c752fa2091ac")  # 
>>> 121
108
>>> return_offset_uuid(0, album, "51d5ea79-1859-402b-85ff-ae3b2adf7173")  # 
>>> 5535
4885

Looking at it, entry “.jpg” is added, it’ll have a larger PK than “ZZZ.jpg” 
which was added two months ago.

Is there a better way to do this?  I’ll keep the for loop if I have to…

- Benjamin


-- 
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/9D43C117-B6EF-4CAD-897C-725C02C67129%40schollnick.net.


Re: Deploy on heroku with Geodjango/ postgis

2020-05-27 Thread Akinfolarin Stephen


On Thursday, May 28, 2020 at 2:45:30 AM UTC+14, Samuel Nogueira wrote:
>
> Hi guys. Does anyone have/know a walkthrough for deploying my django 
> application using geodjango and postgres with postgis on heroku? I was 
> struggling with that yesterday until I've given up.
> I was developing my django app in win10, with python 3.7.7.
>


have you check your error log
 

-- 
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/6a70a76e-3a9e-4251-9207-76cabcb823d7%40googlegroups.com.


Deploy on heroku with Geodjango/ postgis

2020-05-27 Thread Samuel Nogueira
Hi guys. Does anyone have/know a walkthrough for deploying my django
application using geodjango and postgres with postgis on heroku? I was
struggling with that yesterday until I've given up.
I was developing my django app in win10, with python 3.7.7.

-- 
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/CAOJT-cCgiFAAprhqoTT-LDL-aXkq3_i%2BZQfXtK%3DrfWWLADqZrw%40mail.gmail.com.


Re: function model which generate a code for model field

2020-05-27 Thread Kasper Laudrup

Hi Anselme,


On 27/05/2020 13.33, Anselme SERI wrote:


What I want to do is fill in the 'code' field of my 'Diploma' template. 
For example, the first record of the model will have the value 
'BAC1' in the 'code' field, the second 'BAC2', , 'BAC01653' 
.
The approach I have chosen to achieve this objective consists in 
defining a function in the model which will retrieve the value of the 
last id of the last record, increment it then concatenate it to the 
chain to obtain the value of the code field of the new recording. code = 
chain + (lastid + 1) with chain = 'BAC000 ..'. I hope it's clear now?




There might be better ways to do this, but I would override the save() 
method of your model with something like:


def save(self, *args, **kwargs):
self.code = 'BAC{:05}'.format(self.id)
super(MyModel, self).save(*args, **kwargs)

Untested, but hopefully you get the idea.

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/ba1a7ce1-0424-4057-e70a-23258a31d166%40stacktrace.dk.


Can we use python related api's on the Django templates ?

2020-05-27 Thread ratnadeep ray
Hi all, 

Currently I am trying to print the type of a variable from the Django 
template html file as follows: 

The type of feature list report for version 
> {%type(version)%} is


For the above, I am getting the following error: 

Invalid block tag on line 9: 'type(version)'. Did you forget to register or 
load this tag?


So what's going wrong here? How can we use the python related api's (like 
type) from the html template files? I think inside the {%  %} we can 
use python related evaluations. Am I right? 

Please throw some lights on this .

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/2863977e-c712-4746-bbb0-b175bc976a0d%40googlegroups.com.


Re: function model which generate a code for model field

2020-05-27 Thread Anselme SERI
Hello,

I will try to explain it to you in the language I understand best and I
hope that you will have an excellent translator to identify me.

english version
What I want to do is fill in the 'code' field of my 'Diploma' template. For
example, the first record of the model will have the value 'BAC1' in
the 'code' field, the second 'BAC2', , 'BAC01653' .
The approach I have chosen to achieve this objective consists in defining a
function in the model which will retrieve the value of the last id of the
last record, increment it then concatenate it to the chain to obtain the
value of the code field of the new recording. code = chain + (lastid + 1)
with chain = 'BAC000 ..'. I hope it's clear now?

french version
Ce que je souhaite faire, c'est remplir le champ 'code' de mon modele
'Diplôme'. Par exemple le premier enregistrement du modèle aura la valeur
'BAC1' dans le champ 'code', le deuxième 'BAC2',,
'BAC01653' .
L'approche que j'ai retenue pour atteindre ce objectif consiste à   définir
une fonction dans le modèle qui va récupérer la valeur du dernier id du
dernier enregistrerment, l'incrémenter puis la concatener à la chaine pour
obtenir la valeur du champ code du nouvelle enregistrement. code = chaine +
(lastid + 1) avec chaine = 'BAC000..'. J'espère que c'est clair maintenant?

Best regards

Anselme S.



Le mer. 27 mai 2020 à 06:53, Derek  a écrit :

> Its not clear what you mean by "last"; do you mean a record that already
> exists in the database and has a ID value - or do you want the ID of the
> current record?  Either way, the code field should not be resetting the '0'
> to a '1' as this is then misrepresenting the actual data.
>
> PS The logic to create the string looks a bit clunky; why not use rjust to
> get the correct number of prefix zeros?
>
> On Monday, 25 May 2020 22:33:30 UTC+2, Anselme SERI wrote:
>>
>> hello,
>> I am trying to create a function which will recover the last id of my
>> model which I will increment and add to a character string, and I would
>> like to add this new value (x = last id incremented + string) be added to
>> the "code" field "of my model when I make a new recording.
>> How else could we use the id field which automatically increments to
>> perform such an action?
>>
>> Anselme S.
>>
>> Le dim. 24 mai 2020 à 20:12, Kasper Laudrup  a
>> écrit :
>>
>>> Hi Anselme,
>>>
>>> On 24/05/2020 17.48, Anselme SERI wrote:
>>> >
>>> > I try  to to write a correct function for my model which  generate a
>>> str
>>> > + incremental number according last id model.
>>> >
>>>
>>> Your code is obviously wrong for quite a few reasons, but I at least
>>> simply cannot understand what you are trying to achieve.
>>>
>>> What should the "correct function" do?
>>>
>>> The id field of a model is already incremental. Do you simply want to
>>> append that to a string and what do you want to do with that string?
>>>
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/65ffe493-1190-619a-f904-fbe35b60e3e3%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/f8725fd3-bf12-4b82-b1d6-e8569d7220ff%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/CACbA33o_2tQoCXA%2B8iPYE1hFK1SExj%3DQmywp1nsxaV0NX9p9Bg%40mail.gmail.com.


How to create chatroom?

2020-05-27 Thread meera gangani
I want to create chatroom in django like slack, where user can post
messages to the room and at the same time other user can see those message
immediately

What Can I Do?
And What are the Libraries I install?
Please Help Me Out!!


Thanks In Advance
-Meera Gangani

-- 
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/CANaPPP%2BriRwafC3SCJptEZEy3S9iKgJPA0WDoMjvABWCfw6Rzw%40mail.gmail.com.


Optmized Query

2020-05-27 Thread Soumen Khatua
Hi Folks,
I have many to many relationships and Foreign Key in the table, I'm using
select_realted(foreign key filed name) to optimize the query but I want to
fetch many to many and foreign key at the same time , How I can do this in
very optimized way?

Thank You
Regards,
Soumen

-- 
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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%40mail.gmail.com.


Re: Custom Model action in Django Admin

2020-05-27 Thread Anubhav Madhav
Okay!! I have solved it myself:
the mistake was that 'subscribers' is itself a list, so 'to_email' should 
be 'sub' instead of '[sub]'.

Thank You 

On Wednesday, 27 May 2020 14:01:28 UTC+5:30, Anubhav Madhav wrote:
>
> Hello everyone!!
>
> I have stuck in the middle of my project. Please help.
>
>
> I have created a custom function within a model, which sends a newsletter 
> email to the subscribed users. I registered this model action in admins.py 
> , so that I can perform that action using admin panel.
>
> After that, when I go to django admin panel, and perform the action , it 
> shows me an error:
>
> ValueError at /admin/blog/post/
>
> not enough values to unpack (expected 2, got 1)
>
>
> How can I fix this? Please 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/03c64636-cdaa-4328-9f0f-8d324b0794a4%40googlegroups.com.


How to share post to social media from a Django blog

2020-05-27 Thread sunday honesty
Please can someone help me look into this.
I have done everything to use django-social-share but it refused to work with 
the templates I defined.
Can you help me take a look.
https://stackoverflow.com/questions/62038241/how-do-i-make-custom-templates-for-django-social-share

-- 
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/7852f8a9-6559-4ce7-8032-c1bc06e7d2bf%40googlegroups.com.


Re: Regarding redering data in html templates

2020-05-27 Thread Ifeanyi Chielo
at the html file of your template folder, use something like
{{table1.skin_care1}}
{{table1.skin_care2}} etc

note skin_care1, skin_care etc are fields in your model table 'table1'

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo 



On Mon, May 25, 2020 at 4:05 PM Karthiki Chowdary <
karthichowdary...@gmail.com> wrote:

> Hi i was beginner in django and i have a small query in templates.
> For suppose in the home page of any client browser if we have a button
> like SKINCARE or HEALTH CARE and if we click on that buttons we need to get
> the data of all skin care products companies logos/ health care companies
> logos. For that how i can render data in dictionaries suppose i want to
> render a static data how can i or i want or render a dynamic data how can i
> do that with dictionaries so other better option. Please help me out in this
>
> --
> 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/f2306e60-f48f-4e47-959c-763e9659182b%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/CAOcS8H17YqSsVUpHor0%2BWSeq_WJvP5z3Gac33ZPTJD47ScG92g%40mail.gmail.com.


Re: Custom Model action in Django Admin

2020-05-27 Thread Anubhav Madhav
Please refer to this to understand the doubt more clearly: 
https://stackoverflow.com/questions/62038925/custom-model-action-function-in-django-admin
 


On Wednesday, 27 May 2020 14:01:28 UTC+5:30, Anubhav Madhav wrote:
>
> Hello everyone!!
>
> I have stuck in the middle of my project. Please help.
>
>
> I have created a custom function within a model, which sends a newsletter 
> email to the subscribed users. I registered this model action in admins.py 
> , so that I can perform that action using admin panel.
>
> After that, when I go to django admin panel, and perform the action , it 
> shows me an error:
>
> ValueError at /admin/blog/post/
>
> not enough values to unpack (expected 2, got 1)
>
>
> How can I fix this? Please 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/79c9be12-2757-4363-93aa-8cb8e42f2643%40googlegroups.com.


Custom Model action in Django Admin

2020-05-27 Thread Anubhav Madhav
Hello everyone!!

I have stuck in the middle of my project. Please help.


I have created a custom function within a model, which sends a newsletter 
email to the subscribed users. I registered this model action in admins.py 
, so that I can perform that action using admin panel.

After that, when I go to django admin panel, and perform the action , it 
shows me an error:

ValueError at /admin/blog/post/

not enough values to unpack (expected 2, got 1)


How can I fix this? Please 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/545ecfea-e181-4a4a-bc7f-d26856ccfadb%40googlegroups.com.


Re: Regarding redering data in html templates

2020-05-27 Thread Karthiki Chowdary
Thanks

On Wed, 27 May, 2020, 1:04 pm Derek,  wrote:

> Lots of examples out there, but here is one:
>
>
> https://www.gun.io/blog/how-to-list-items-in-a-dictionary-in-a-django-template
>
> For working with static files (such as CSS or images), have a look at:
>
> https://scotch.io/tutorials/working-with-django-templates-static-files
>
> On Monday, 25 May 2020 17:06:25 UTC+2, Karthiki Chowdary wrote:
>>
>> Hi i was beginner in django and i have a small query in templates.
>> For suppose in the home page of any client browser if we have a button
>> like SKINCARE or HEALTH CARE and if we click on that buttons we need to get
>> the data of all skin care products companies logos/ health care companies
>> logos. For that how i can render data in dictionaries suppose i want to
>> render a static data how can i or i want or render a dynamic data how can i
>> do that with dictionaries so other better option. Please help me out in this
>>
> --
> 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/yDu49lWWgQI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/8a4f13dc-c4fe-40aa-a892-0afc6981847c%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/CAOFEE42udTTtOrY6VhQ4%3D56hQ7eHZKUPfC20nCXtDRKR%2BrVw6A%40mail.gmail.com.


Re: Regarding redering data in html templates

2020-05-27 Thread Derek
Lots of examples out there, but here is one:

https://www.gun.io/blog/how-to-list-items-in-a-dictionary-in-a-django-template

For working with static files (such as CSS or images), have a look at:

https://scotch.io/tutorials/working-with-django-templates-static-files

On Monday, 25 May 2020 17:06:25 UTC+2, Karthiki Chowdary wrote:
>
> Hi i was beginner in django and i have a small query in templates. 
> For suppose in the home page of any client browser if we have a button 
> like SKINCARE or HEALTH CARE and if we click on that buttons we need to get 
> the data of all skin care products companies logos/ health care companies 
> logos. For that how i can render data in dictionaries suppose i want to 
> render a static data how can i or i want or render a dynamic data how can i 
> do that with dictionaries so other better option. Please help me out in this
>

-- 
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/8a4f13dc-c4fe-40aa-a892-0afc6981847c%40googlegroups.com.