Re: Template inheritance with dynamic content

2020-11-13 Thread David Nugent
You can achieve what you are looking for using the include directive. Just have your parent and child include the same block and use with… phrase to override variables within the included template. Regards, David On 20201

Re: im a newbe, i'm trying to get the username in a view

2020-11-13 Thread Barbara Leonard
Yes I believe so I did programming years ago but from the error code you are getting I would say try that because the syntex can not process what it does not have. It is telling you it do not have an attribute named user there it can not return such output, so yes try the module area to put in the

Re: im a newbe, i'm trying to get the username in a view

2020-11-13 Thread Apolo Machine
where? in my model service? i'm not quiet understand thanks for responding El vie., 13 nov. 2020 a las 18:53, Barbara Leonard (< barbaraleona...@gmail.com>) escribió: > make an attribute named "user" > > On Fri, Nov 13, 2020 at 2:27 PM Apolo Machine > wrote: > >> I'm trying to get the username w

Re: im a newbe, i'm trying to get the username in a view

2020-11-13 Thread Barbara Leonard
make an attribute named "user" On Fri, Nov 13, 2020 at 2:27 PM Apolo Machine wrote: > I'm trying to get the username within a view(CBV), the documentation I > found says that the logged user is within the request, but when I do > > class ServiceCreateView(LoginRequiredMixin, CreateView): >

im a newbe, i'm trying to get the username in a view

2020-11-13 Thread Apolo Machine
I'm trying to get the username within a view(CBV), the documentation I found says that the logged user is within the request, but when I do class ServiceCreateView(LoginRequiredMixin, CreateView): model = Service form_class = ServiceForm user=request.user.username

Re: Trying to trigger a bulkcreation of records using a reverse relationship

2020-11-13 Thread Chetan Ganji
Welcome :) Regards, Chetan Ganji +91-900-483-4183 ganji.che...@gmail.com http://ryucoder.in On Fri, Nov 13, 2020 at 9:22 PM Dumba Classics wrote: > thank you @Chetan the solution does work and I am very grateful!! > > On Fri, Nov 13, 2020 at 5:35 PM Chetan Ganji > wrote: > >> Im not 100%

Re: Trying to trigger a bulkcreation of records using a reverse relationship

2020-11-13 Thread Dumba Classics
thank you @Chetan the solution does work and I am very grateful!! On Fri, Nov 13, 2020 at 5:35 PM Chetan Ganji wrote: > Im not 100% sure about this :P > > Instead of this - > def save(self, *args, **kwargs): > if self.records.count() <= 0: > for student in self.klass.students.all(): > self.r

Re: Trying to trigger a bulkcreation of records using a reverse relationship

2020-11-13 Thread Chetan Ganji
Im not 100% sure about this :P Instead of this - def save(self, *args, **kwargs): if self.records.count() <= 0: for student in self.klass.students.all(): self.records.create(student=student, status='present') super(Attendance, self).save(*args, **kwargs) Try with below code - def save(self, *ar

Template inheritance with dynamic content

2020-11-13 Thread Tristania W
Is it possible to make one sub-template inherit a div with dynamic content from an upper level template? For eg., Template2 extends Template1. Within Template1, there is a div XXX that depends on a variable {{ var1 }}. This variable is passed to the view *def view1*, which renders Template 1. W

Re: Numeric field widget with built-in units

2020-11-13 Thread Derek
Django Suit uses an "enclosed" widget - https://django-suit.readthedocs.io/en/develop/widgets.html#enclosedinput ; see also https://getbootstrap.com/docs/4.5/components/input-group/ On Friday, 13 November 2020 at 05:11:24 UTC+2 Mike Dewhirst wrote: > Does anyone know of a number field widget w

Trying to trigger a bulkcreation of records using a reverse relationship

2020-11-13 Thread DumbaClassics
Hello Family may you help. I am trying to create a School Attendance Module and I have a StudentClass table, the Student table, Attendance table and the AttendanceRecord table. Here is the code class StudentClass(models.Model): name = models.CharField(max_length=100) # stream =

Re: Tests: How to messages.add_message() before self.client.get() ?

2020-11-13 Thread Carsten Fuchs
Thank you very much! I'll try that! Best regards, Carsten Am 11.11.20 um 02:28 schrieb David Nugent: > Make your own request. > > I don't see the need here but incase I'm missing something: request is just a  > HTTPRequest >