Re: [DJANGO-TUTORIAL]

2021-10-08 Thread David Nugent
For interactive web pages, you are (almost) necessarily talking about
javascript.

Given your background and what you're most likely to be doing next, I would
suggest looking at D3.js - Data-Driven Documents (d3js.org)
. It is a somewhat large but very mature library for
visual representation and has a strong following in scientific applications
and is a good investment of your time to learn.

Regards, David

On Sat, Oct 9, 2021 at 1:17 AM Chakresh Singh <
chakresh.si...@alumni.iitgn.ac.in> wrote:

> Dear All,
> I am beginning my first task on Django. I come from a physics background
> and am a novice in web development.
> My aim is to develop an interactive web-page where users see some keywords
> and can choose a pair, which then connects them with a line.
> I should be able to record these pairs and make a graph out of it. This is
> basically to teach freshers about network growth mechanisms.
>
> Any suggestions and help on this would be highly appreciated.
>
> Regards
> Chakresh
> post-doc CRI-Paris
>
> --
> 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/204caf87-5bd9-416f-a0ac-95d30a3e10ban%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/CAE5VhgVSBU_PxJQ7HjMDx%2BnRUJE8tvj5u2quUGNay-UG-wz%2B_w%40mail.gmail.com.


Re:

2021-10-08 Thread Sebastian Jung
Hello,

Your app tries to insert a new entry in table auth.users. in this table a
User exists with id=2 and you get this constraint error. Please truncate
auth.users table and try it again.

Regards

ola neat  schrieb am Fr., 8. Okt. 2021, 18:12:

> Hello guys
> I've got this issue i don't understand, before i deployed my  APIS to
> heroku everything was working perfectly, but now that i deployed I'm
> getting this error, pls can anyone 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/CAHLKn727okM8xWxX2o7ZgSLT6pDFXQf_oS6NC-83K7zkv9NhXw%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/CAKGT9mz-hLnzKVtPSh5WsGhG1CO-afPLJtqwSBz2mHTibgpPZw%40mail.gmail.com.


Re: DateTime widget in default CreateView form

2021-10-08 Thread Anil Felipe Duggirala
On Fri, Oct 8, 2021, at 10:57 AM, Iyanuoluwa Loko wrote:
> The date-time has to accept a date, and if you input the date in the 
> textbox in the accepted django format, it will work fine. To have the 
> calendar icon, it is a widget, and you ycan call it by editing the HTML 
> input type, or adding the widget to the views.py

Thanks very much for that clarification Iyanuoluwa. Could you tell me how 
exactly I would add that 'Calendar' widget to my views.py (or my forms.py?)?

thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9bdedb33-1ef8-44d6-b988-a0e0389c471c%40www.fastmail.com.


Re: DateTime widget in default CreateView form

2021-10-08 Thread Iyanuoluwa Loko
The choice is not a widget per se. The date-time in the model will accept a
date time input, however, the calendar icon is a widget, and doesn't come
automatically.
The date-time has to accept a date, and if you input the date in the
textbox in the accepted django format, it will work fine. To have the
calendar icon, it is a widget, and you ycan call it by editing the HTML
input type, or adding the widget to the views.py

On Fri, 8 Oct 2021, 16:49 Anil Felipe Duggirala, 
wrote:

> On Fri, Oct 8, 2021, at 8:41 AM, MR INDIA wrote:
> > Answer to this query on stack overflow
> > <
> https://stackoverflow.com/questions/27321692/override-a-django-generic-class-based-view-widget
> >
> > Raw link:
> >
> https://stackoverflow.com/questions/27321692/override-a-django-generic-class-based-view-widget
> > Hope this helps,
>
> Thanks very much for the link MR INDIA.
> That is exactly what Im looking to do, however, its not working for me for
> some reason.
> How can I check if I am getting the desired result in my rendered HTML?
> I am working with a DateTimeField. So I should be getting a
> type='datetime' in the  tag correct?
>
> I don't understand why other fields like a CharField with choices,
> automatically, renders a  tag on my form, without even specifying a
> widget for it as described in the link. Is it not expected that a
> DateTimeField would render the type:'datetime' in the html form? (without
> any additional modifications). The link above was created 6 years ago, has
> this not changed in all that time?
>
> I will show you what I have:
>
> --models.py--
> class Lesson(models.Model):
> ...
> time = models.DateTimeField("Fecha y Hora")
>
> --views.py--
> class LessonCreateView(CreateView):
> model = Lesson
> template_name = 'new_lesson.html'
> form_class = LessonForm
>
> def form_valid(self, form):  # new
> form.instance.instructor = self.request.user
> return super().form_valid(form)
>
> --forms.py--
> class LessonForm(forms.ModelForm):
>
> class Meta:
> model = Lesson
> fields = ['title', 'time', 'nivel']
> widgets = {
> 'time': forms.DateTimeInput()
> }
>
> In my rendered HTML I however get a type="text" for the 'time' field.
> Thanks very much for your 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/e60942df-354c-44a6-b041-e132aa61566a%40www.fastmail.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/CACq4Q2ZOr4M5rshJm7CGEnoo8pyc5ytNLV8CHbVsP2rXRBmhPg%40mail.gmail.com.


Re: [DJANGO-TUTORIAL]

2021-10-08 Thread Adebayo Michael
Firstly, try to have a basic knowledge on HTML and CSS. Before you start
Django.
They are relatively simple to understand.
 Check w3 school for tutorial on them.

On Fri, 8 Oct 2021, 3:17 pm Chakresh Singh, <
chakresh.si...@alumni.iitgn.ac.in> wrote:

> Dear All,
> I am beginning my first task on Django. I come from a physics background
> and am a novice in web development.
> My aim is to develop an interactive web-page where users see some keywords
> and can choose a pair, which then connects them with a line.
> I should be able to record these pairs and make a graph out of it. This is
> basically to teach freshers about network growth mechanisms.
>
> Any suggestions and help on this would be highly appreciated.
>
> Regards
> Chakresh
> post-doc CRI-Paris
>
> --
> 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/204caf87-5bd9-416f-a0ac-95d30a3e10ban%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/CABh6EfHgnoYHa-YeM%3Dz8tAtOh_peZYL1E2XDr0UYC8%3DK-06qJg%40mail.gmail.com.


Re: DateTime widget in default CreateView form

2021-10-08 Thread Anil Felipe Duggirala
On Fri, Oct 8, 2021, at 8:41 AM, MR INDIA wrote:
> Answer to this query on stack overflow 
> 
> Raw link: 
> https://stackoverflow.com/questions/27321692/override-a-django-generic-class-based-view-widget
> Hope this helps, 

Thanks very much for the link MR INDIA.
That is exactly what Im looking to do, however, its not working for me for some 
reason.
How can I check if I am getting the desired result in my rendered HTML?
I am working with a DateTimeField. So I should be getting a type='datetime' in 
the  tag correct?

I don't understand why other fields like a CharField with choices, 
automatically, renders a  tag on my form, without even specifying a 
widget for it as described in the link. Is it not expected that a DateTimeField 
would render the type:'datetime' in the html form? (without any additional 
modifications). The link above was created 6 years ago, has this not changed in 
all that time?

I will show you what I have:

--models.py--
class Lesson(models.Model):
...
time = models.DateTimeField("Fecha y Hora")

--views.py--
class LessonCreateView(CreateView):
model = Lesson
template_name = 'new_lesson.html'
form_class = LessonForm

def form_valid(self, form):  # new
form.instance.instructor = self.request.user
return super().form_valid(form)

--forms.py--
class LessonForm(forms.ModelForm):

class Meta:
model = Lesson
fields = ['title', 'time', 'nivel']
widgets = {
'time': forms.DateTimeInput()
}

In my rendered HTML I however get a type="text" for the 'time' field.
Thanks very much for your 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/e60942df-354c-44a6-b041-e132aa61566a%40www.fastmail.com.


[DJANGO-TUTORIAL]

2021-10-08 Thread Chakresh Singh
Dear All, 
I am beginning my first task on Django. I come from a physics background 
and am a novice in web development. 
My aim is to develop an interactive web-page where users see some keywords 
and can choose a pair, which then connects them with a line.
I should be able to record these pairs and make a graph out of it. This is 
basically to teach freshers about network growth mechanisms. 

Any suggestions and help on this would be highly appreciated. 

Regards
Chakresh
post-doc CRI-Paris

-- 
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/204caf87-5bd9-416f-a0ac-95d30a3e10ban%40googlegroups.com.


Quick question for web hosting production

2021-10-08 Thread Patrick Luke Astrero
I want to ask a quick question guys that, is it possible to host 2 apps in 
one cloud service? like for example, angular for the front end and django 
for the backend? and they would use one ip address right but on a different 
port?


-- 
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/ca218ee3-0953-4eb6-b3c6-26c1473a21ebn%40googlegroups.com.


Re: Problem re-rendering ClearableFileInput on validation error

2021-10-08 Thread Jesus Antonio Sv
Did you find a solution for this?

On Saturday, December 12, 2020 at 1:13:39 AM UTC+9 michael@gmail.com 
wrote:

> Note that if the user decides to upload a new file on step 2, the field 
> will then be re-rendered with the uploaded file object, which also ends up 
> rendering a blank file input. Is there a case where FileField.bound_data() 
> should return anything else than the initial value?
>
>
>
> On Fri, Dec 11, 2020 at 10:36 AM Michael Goffioul  
> wrote:
>
>> When a form containing a ClearableFileInput is re-rendered (e.g. due to 
>> validation error of some other field), and the clear checkbox was checked 
>> on the first submit, the widget is rendered without initial value, as empty 
>> file input.
>>
>> For instance, let's says there's a model with ImageField and all the 
>> form/view mechanics to edit the model. You edit a model instance that has 
>> an uploaded image already:
>> 1. on initial render, the field is rendered with the clear checkbox and 
>> link to existing file
>> 2. submit the form with some invalid data (e.g. there's another field in 
>> the form that does not validate)
>> 3. on re-render, the field is rendered as empty file input, without clear 
>> checkbox and link
>>
>> AFAICS, this is because:
>> - ClearableFileInput.value_from_datadict() returns False
>> - FileField.bound_data() returns False: it only returns initial data if 
>> submitted data is None or FILE_INPUT_CONTRADICTION
>> - BoundField.value() returns False
>> - BoundField.as_widget() renders field with value set to False
>>
>> I find it non-intuitive that the field is re-rendered as blank, as if 
>> there was no initial data. Is this the intended behavior? Or am I missing 
>> something?
>>
>> Michael.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/4133479d-8781-48d5-9e13-8080504a5749n%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/8e4e4169-44e1-4fbd-9b4c-ab87a4056fe4n%40googlegroups.com.


Re: Send PDF as an email's attachment ( Working with xhtml2pdf library)

2021-10-08 Thread MR INDIA
Answer to this query on stack overflow 

Raw link: 
https://stackoverflow.com/questions/33218629/attaching-pdfs-to-emails-in-django
Hope this helps, 
A fellow django developer
On Friday, 8 October 2021 at 00:19:36 UTC+5:30 sreebas...@gmail.com wrote:

> Did you solve it? I need a similar solution.
>
> On Saturday, May 1, 2021 at 5:13:21 AM UTC+6 wwran...@gmail.com wrote:
>
>> Hi Dudes, Im working with pisa from xhtml2pdf LIB in order to get a pdf. 
>> That works OK, but i cant figure out how to attach the generated pdf to  an 
>> email  in order to send it . Anyone dealt with this? I would appreciate any 
>> help on this!
>>
>> *View*:
>>
>>   def get(self,request,*args,**kwargs):
>> try:
>>
>> mailServer = 
>> smtplib.SMTP(settings.EMAIL_HOST,settings.EMAIL_PORT)
>> print(mailServer.ehlo())
>> mailServer.starttls()
>> print(mailServer.ehlo())
>>
>> 
>> mailServer.login(settings.EMAIL_HOST_USER,settings.EMAIL_HOST_PASSWORD)
>> print("conectando...")
>> email_to=[]
>> email_to.append("emailto...@gmail.com")
>> subject="ADICRA - Comprobrante de Pago"
>> template= get_template('pagos/invoice.html')
>> context={
>> 'sale': PagosHead.objects.get(pk=self.kwargs['pk']),
>>
>> 'comp': {'name':'ADICRA','ruc':'Av. Directorio Adicra 
>> 101','address':'C.A.B.A.'},
>>
>> 'icon': 
>> '{}{}'.format(settings.STATIC_URL,'core/img/adicrareng.jpg'),
>>
>> 
>> 'equis':'{}{}'.format(settings.STATIC_URL,'pagos/img/x.jpg'),
>> }
>> html=template.render(context)
>> response= HttpResponse(content_type='application/pdf')
>>
>> #response['Content-Disposition']='attachment; 
>> filename="pago.pdf"' #Para Descargar
>>
>> pisaStatus=pisa.CreatePDF(html, 
>> dest=response,link_callback=self.link_callback)
>>
>> mensaje = EmailMessage(subject, body=pdf, 
>> from_email=settings.EMAIL_HOST_USER, to=email_to)
>> print("Acá antes del attach")
>> mensaje.attach('pago.pdf', pisaStatus,'application/pdf')
>> mensaje.content_subtype = "pdf"  
>> mensaje.encoding = 'us-ascii'
>> mensaje.send()
>> #mailServer.sendmail(settings.EMAIL_HOST_USER,
>>  #   email_to,
>>   #  mensaje.as_string())
>> print("Correo enviado correcamente")
>> return response
>> except Exception as e:
>> print(e)
>> return HttpResponse(reverse_lazy('pagos:list'))
>>
>

-- 
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/7366b7b6-ae23-44cd-bceb-b7b340ecbefcn%40googlegroups.com.


Re: DateTime widget in default CreateView form

2021-10-08 Thread MR INDIA

Answer to this query on stack overflow 

Raw link: 
https://stackoverflow.com/questions/27321692/override-a-django-generic-class-based-view-widget
Hope this helps, 
A fellow django developer
On Friday, 8 October 2021 at 07:44:10 UTC+5:30 Anil Felipe Duggirala wrote:

> On Thu, Oct 7, 2021, at 5:50 PM, sum abiut wrote:
> > You can use modelform.
> >
> > in your form.py you can do something like this
> >
> > # setup date picker start
> > class DateInput(forms.DateInput):
> > input_type = 'date'
> >
> > class Formname(forms.ModelForm):
> > class Meta:
> > model= yourmodel
> > fields = ('datefield')
> > widgets ={'datefield': DateInput() }
>
> Thank you for the quick response Sum. I am still unsure about the usage of 
> ModelForm, do I need to specify somewhere that the CreateView should use 
> the ModelForm I define instead of the default form?
> Where am I supposed to declare the 'class Formname...' ? (Is this supposed 
> to be done in the models.py file or in the forms.py file?) 
> Previously you meant the forms.py file right ? (not 'form.py')
> The fields list is supposed to be in [] and not in () right?
>
> Why doesn't the default form, that is automatically generated from the 
> model when one uses the CreateView class based view , include the correct 
> widgets?
>
> thanks again,
>

-- 
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/e55edffa-b709-4ad6-88b7-1e9c83b7e33dn%40googlegroups.com.