Re: How to convert the static image files of a readymade template to dynamic

2020-06-05 Thread Gabriel Araya Garcia
..and... why you don't try make theses things that you are asking ?

El 12:03 Vie Jun 5, 2020, Vishesh Mangla 
escribió:

> First of all, if you will use .css file, it would be better. In that you
> can include image the usual way.
>
> But still if you would like it as inline element thenn use “...{% url
> ‘’ %}...”. Mind the single commas and double commas.
>
> Sent from Mail  for
> Windows 10
>
>
>
> *From: *Rabbi Rabbi 
> *Sent: *05 June 2020 20:57
> *To: *Django users 
> *Subject: *How to convert the static image files of a readymade template
> to dynamic
>
>
>
> Please help me to fix this. Do I need to use a double quotation before and
> after the .jpg link?
>
> --
> You received this message because you are subscribed 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/9abe66f6-06d2-4851-a41c-b45ab129033bo%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/CD689EDE-504B-44D6-B043-685D0F7F50D4%40hxcore.ol
> 
> .
>

-- 
You received this message because you are subscribed 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/CAKVvSDC4z-BXqJ9ny6%3DcYE_O2tDr9AT40NjkTQaFZq6xyEKN6Q%40mail.gmail.com.


django tables 2 - delete column and delete_item for inherited tables

2020-06-05 Thread Nader Elsisi
I have just posted

https://stackoverflow.com/questions/62218886/django-tables-2-delete-column-and-delete-item-for-inherited-tables


and didn't get any feedback yet. So I appreciate anyone who can help me

about passing data.


I want to have one abstract function for all my tablelists (one for each
model) and (one delete_item) function in view.

I don't know how to make the delete (column in this table) and pass the
model to the delete_item function in the view

*Tables.py*


 Abstract Table
class abs_Table(tables.Table):

SN = tables.Column(empty_values=(), orderable=False)
delete = tables.LinkColumn('delete_item', args=[A('pk'),
?Model???],  attrs={
 'a': {'class': 'btn btn-small btn-dark'}
# })


def __init__(self, *args, **kwargs):
super(abs_Table, self).__init__(*args, **kwargs)
self.counter = itertools.count(1)


def render_SN(self, record):

pg = getattr(self, 'paginator', None)
if pg:
v = next(self.counter)
return v + self.paginator.per_page * (self.page.number-1)
else:
return next(self.counter)


class Meta:
model = None
fields = [ 'SN', 'id',  'delete', ]

attrs = {"class": "table-striped table-bordered", 'width': '100%'}
empty_text = "There are no Records matching the search criteria..."

Then for model Table

*Tables.py*


class ModelTable(abs_Table):


class Meta(abs_Table.Meta):
model = modelname
fields = abs_Table.Meta.fields+[selected_model_fields]

*Views.py*



  def delete_item(request, pk, delmodel):
obj = get_object_or_404(delmodel, id=pk)


if request.method == "POST":

obj.delete()

return redirect("../")
else:
pass


context = {
'object': obj
}

return render(request, '/delete_confirmation.html', context)

-- 
You received this message because you are subscribed 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%2BkREvqnPgZ9z9j93PVd32F6dGcdtFe1dNuPkA--qx6YecJEOQ%40mail.gmail.com.


RE: How to convert the static image files of a readymade template to dynamic

2020-06-05 Thread Vishesh Mangla
First of all, if you will use .css file, it would be better. In that you can include image the usual way.But still if you would like it as inline element thenn use “...{% url ‘’ %}...”. Mind the single commas and double commas.Sent from Mail for Windows 10 From: Rabbi RabbiSent: 05 June 2020 20:57To: Django usersSubject: How to convert the static image files of a readymade template to dynamic Please help me to fix this. Do I need to use a double quotation before and after the .jpg link? -- You received this message because you are subscribed 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/9abe66f6-06d2-4851-a41c-b45ab129033bo%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/CD689EDE-504B-44D6-B043-685D0F7F50D4%40hxcore.ol.


How to convert the static image files of a readymade template to dynamic

2020-06-05 Thread Rabbi Rabbi


[image: Annotation 2020-06-05 124726.png]
Please help me to fix this. Do I need to use a double quotation before and 
after the .jpg link? 

-- 
You received this message because you are subscribed 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/9abe66f6-06d2-4851-a41c-b45ab129033bo%40googlegroups.com.


Validation always True for CharField but not with DateField in FormSet

2020-06-05 Thread Rookie
StackOverflow: 
https://stackoverflow.com/questions/62206149/validation-always-true-blank-false-for-charfield-but-not-with-datefield

I have an inlineformset_factory containing a field. When this field is a 
CharField (blank=False) and I run is_valid() on the formset, True is always 
returned even though the CharField is left blank. When I replace the 
CharField with a DateField (default=timezone.now(), blank=False), 
is_valid() will return True only when the field is filled as expected. Why 
is the CharField always returning True when running is_valid() on the 
formset but the DateField does not? Note that I want the CharField to 
behave like the DateField.

Interestingly enough, the formset behaves as expected when both the 
CharField and DateField are present.

Code below is shown with title and date but I have tried with *only* title 
and *only *date as described above. I believe there is a bug causing this 
issue.

models.py

class Author(models.Model):
author = models.CharField(max_length=128)
description = models.CharField(max_length=1000)

class Book(models.Model):
author = models.ForeignKey(Author, on_delete=models.CASCADE)
title = models.CharField(blank=False)
date = models.DateField(default=timezone.now(), blank=False)


forms.py

class AuthorForm(forms.ModelForm):
class Meta:
model = Author
fields = ('author', 'description')

class BookForm(forms.ModelForm):
class Meta:
model = Book
fields = ('title', 'date')

BookFormSet = forms.inlineformset_factory(
Author,
Book,
form=BookForm,
fields=('title', 'date'),
extra=1,
can_delete=False,
can_order=False
)


views.py

class CreateAuthorView(CreateView):
template_name = "author_create.html"
model = Author
form_class = AuthorForm

def get_context_data(self, **kwargs):
context = super(CreateAuthorView, self).get_context_data(**
kwargs)
if self.request.POST:
form = self.get_form(self.form_class)
context["book"] = BookFormSet(self.request.POST, instance=
form.instance)
else:
context["book"] = BookFormSet()
return context

def form_valid(self, form):
context = self.get_context_data()
book = context["book"]

print(form.data.get("author"))
print("book.is_valid()", book.is_valid()) # ***This always 
prints True when only CharField is part of Book model***

return redirect(self.get_success_url())

def get_success_url(self):
return reverse("author_list")


author_create.html


{% csrf_token %}

{{ form }}


{{ book.management_form }}
{% for book_form in book %}

{{ book_form }}

{% endfor %}

Submit Author


-- 
You received this message because you are subscribed 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/d36c6de5-c04a-41e0-946f-3faa2aa23c5bo%40googlegroups.com.


Re: Django IIS windows

2020-06-05 Thread Mehdi Baneshi
asp.net iis c#
django ubuntu python

On Fri, Jun 5, 2020 at 8:13 AM  wrote:

> This guy has explained it all and that too step by step. May be you could
> refer to this link –
>
>
>
>
> https://www.mattwoodward.com/2016/07/23/running-a-django-application-on-windows-server-2012-with-iis/
>
>
>
> Thanks,
>
> Gurmeet Kaur
>
> IT  Developer cum Consultant
>
>
>
> *From:* django-users@googlegroups.com  *On
> Behalf Of *Larry Martell
> *Sent:* June 4, 2020 10:11 PM
> *To:* django-users@googlegroups.com
> *Subject:* Re: Django IIS windows
>
>
>
> On Thu, Jun 4, 2020 at 10:05 PM Giovanni Silva  wrote:
>
> Hello.
>
>
>
> I need help to set up my Django Project in my IIS server.
>
>
>
> Does anyone has a tutorial or a link to help me to configure it?
>
>
>
> I did this once and it was incredibly painful. If there is any way you can
> deploy on Linux do so. It will improve your quality of life immeasurably.
>
> --
> You received this message because you are subscribed 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/CACwCsY5p7wFtmKZ%2BE4Tmmsf9bDdPh86QHFKQaEOLtG0yGt%3D-jA%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/000a01d63aeb%2450a192a0%24f1e4b7e0%24%40gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO9mP8aVpc6ah2fs0H1%3DBQY618t_g1DNFEJdR3AaZFwCThce4Q%40mail.gmail.com.


Re: How to add entries dynamically

2020-06-05 Thread 'MH' via Django users
Thank you. I will look into that :)

On Friday, June 5, 2020 at 3:23:21 PM UTC+2, Andréas Kühne wrote:
>
> Hi,
>
> This is a fairly common practice - I found this:
>
> https://dev.to/zxenia/django-inline-formsets-with-class-based-views-and-crispy-forms-14o6
>
> When googling for "inline formsets" because that's what you want. You can 
> of course choose some other tutorial - but I think this one explains it ok. 
> You will also need to do some javascript to get it working.
>
> Regards,
>
> Andréas
>
>
> Den fre 5 juni 2020 kl 15:00 skrev 'MH' via Django users <
> django...@googlegroups.com >:
>
>> Hi 
>>
>> I am coding a personal cookbook just for fun. On one site I want to be 
>> able to enter the ingredients, including the corresponding amount. So, I 
>> don't want to put all of that in one textarea, but in separate fields, so 
>> that I could recalculate the ingredient's amount if I have to cook for more 
>> people.
>>
>> Now to my question. Let's assume I enter 10 pcs. eggs. Then I would like 
>> to have a button that says "add one more ingredient". You see such things 
>> very often on websites and then another input line pops up, while the 
>> previous entries stay in their place. Do you know how to do that with 
>> django?
>>
>> Best regards
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f80fb1e0-7b2f-47bb-bd2e-7cec5edad579o%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/d05bfcb4-21e9-47c9-a5ed-e6dfb7d1cb4eo%40googlegroups.com.


Re: Possible Django bug I am considering raising

2020-06-05 Thread Ramiro Morales
Remember you can not juat open/report an issue and bisect the git commit
which could have introduced the change in behavior, but also, if it gets
confirmed as a real bug, you can fix it yourself so to not delay yourself
in your current project. With the nice side effect that the fix will
benefit many others.

Another option would be: If you can't or don't want to do what I suggest
above then Are you willing to commit to funding another Django contributor
to get this immediate attention & personalised service so to be able to
solve the issue affecting your current project/client?

On Fri, Jun 5, 2020, 7:50 AM 'OwlHoot' via Django users <
django-users@googlegroups.com> wrote:

>
>
> On Thursday, 4 June 2020 23:45:53 UTC+1, Tim Graham wrote:
>
> You can try to find the commit that introduced the issue:
>> https://docs.djangoproject.com/en/dev/internals/contributing/triaging-tickets/#bisecting-a-regression
>>
>
> I'm happy to try and do this, i.e. produce a simple test case that fails,
> and then find the commit that first caused this, provided I am assured that
> if I can then a Django maintainer/developer will jump on this and fix it
> pronto!
>
> If the result will be added to some list where someone will think about
> maybe fixing it in six months, and then only if anyone else complains, I'll
> have long since moved on to another project and/or another client and the
> issue will be of no interest to 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/016c2855-ec5e-4880-ac18-c4f5660732dbo%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/CAO7PdF8%3DDfYBbd4UxwvRfdxvgRx9fRp_fm9jLMN1AGVz9YeZjA%40mail.gmail.com.


Re: How to add entries dynamically

2020-06-05 Thread Andréas Kühne
Hi,

This is a fairly common practice - I found this:
https://dev.to/zxenia/django-inline-formsets-with-class-based-views-and-crispy-forms-14o6

When googling for "inline formsets" because that's what you want. You can
of course choose some other tutorial - but I think this one explains it ok.
You will also need to do some javascript to get it working.

Regards,

Andréas


Den fre 5 juni 2020 kl 15:00 skrev 'MH' via Django users <
django-users@googlegroups.com>:

> Hi
>
> I am coding a personal cookbook just for fun. On one site I want to be
> able to enter the ingredients, including the corresponding amount. So, I
> don't want to put all of that in one textarea, but in separate fields, so
> that I could recalculate the ingredient's amount if I have to cook for more
> people.
>
> Now to my question. Let's assume I enter 10 pcs. eggs. Then I would like
> to have a button that says "add one more ingredient". You see such things
> very often on websites and then another input line pops up, while the
> previous entries stay in their place. Do you know how to do that with
> django?
>
> Best regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f80fb1e0-7b2f-47bb-bd2e-7cec5edad579o%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/CAK4qSCfBChSegn3u2iA_fwnsHGm2Nf9DehiNfAgi9E_LEKb0Wg%40mail.gmail.com.


Re: Possible Django bug I am considering raising

2020-06-05 Thread René Fleschenberg
Hi,

the code you posted on stackoverflow is not sufficient to reproduce the
problem. It would be good to provide a minimal reproducible example (see
also https://stackoverflow.com/help/minimal-reproducible-example).

Regards,
René

-- 
You received this message because you are subscribed 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/85bf94fa-d3ae-6b10-dae4-6c52aa58b3c3%40fleschenberg.net.


How to add entries dynamically

2020-06-05 Thread 'MH' via Django users
Hi 

I am coding a personal cookbook just for fun. On one site I want to be able 
to enter the ingredients, including the corresponding amount. So, I don't 
want to put all of that in one textarea, but in separate fields, so that I 
could recalculate the ingredient's amount if I have to cook for more people.

Now to my question. Let's assume I enter 10 pcs. eggs. Then I would like to 
have a button that says "add one more ingredient". You see such things very 
often on websites and then another input line pops up, while the previous 
entries stay in their place. Do you know how to do that with django?

Best regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f80fb1e0-7b2f-47bb-bd2e-7cec5edad579o%40googlegroups.com.


Re: Possible Django bug I am considering raising

2020-06-05 Thread 'OwlHoot' via Django users


On Thursday, 4 June 2020 23:45:53 UTC+1, Tim Graham wrote:

You can try to find the commit that introduced the issue: 
> https://docs.djangoproject.com/en/dev/internals/contributing/triaging-tickets/#bisecting-a-regression
>

I'm happy to try and do this, i.e. produce a simple test case that fails, 
and then find the commit that first caused this, provided I am assured that 
if I can then a Django maintainer/developer will jump on this and fix it 
pronto!

If the result will be added to some list where someone will think about 
maybe fixing it in six months, and then only if anyone else complains, I'll 
have long since moved on to another project and/or another client and the 
issue will be of no interest to 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/016c2855-ec5e-4880-ac18-c4f5660732dbo%40googlegroups.com.


Re: Hi

2020-06-05 Thread S K
It is not that important. If you have any specific settings in your earlier
pycharm projects click on first one. Or if you have settings in separate
config file locate that finally you can choose not to import anything.

On Fri, 5 Jun, 2020, 11:52 am Pawan Goswami, 
wrote:

> Please kindly help me what is right fir solution here ..
>
> Regards
> Pawan...
>
> --
> You received this message because you are subscribed 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/CAM%3DXy2rhWTxsef_PGkOKPCMapEBT2sL%3Dt2nG0LaDe13E3XN_5Q%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/CAL17tVAX-wGk_w%2B312iCWRMrtks3VfLSVwHE-VXJkScMitP_6g%40mail.gmail.com.