Re: Package that helps update only changed fields

2019-06-24 Thread Dan Davis
Thanks, I wrote a mixin class for most of my forms that works a lot like 
this, although it combines self.changed_fields and self.model._meta.fields 
to discover which fields to update, rather than the two stages you have 
above.  

I discovered when trying to generalize this mixin that some of my forms are 
too complicated for this to be a part of Django itself.  A ModelForm may 
have non-model fields whose initial value is computed from other models in 
__init__ or using a queryset with annotations.  I've found this to be 
easier in many cases that dealing with formsets.

So, if your save method already looks something like this:

def save(self, commit=True):
with transactions.atomic():
instance = super().save()
instance.relation.fubar = self.changed_data['relation_fubar']
instance.relation.save()

Well, you might as well just figure out update_fields in that form on its 
own.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0310b0a5-05f2-4faf-8c69-a911ed82976f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: architecture for Blue/Green deployments

2019-06-24 Thread Dan Davis
A related discussion on django-developers has turned up this module, 
written by one of the participants in the discussion there:

https://github.com/aspiredu/django-safemigrate


>>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9b9dae54-adcb-46eb-b016-5ddb4215605c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django User model

2019-06-24 Thread Andrew C.
Like a profile? Try this:
https://simpleisbetterthancomplex.com/tutorial/2016/11/23/how-to-add-user-profile-to-django-admin.html

On Mon, Jun 24, 2019 at 9:13 AM AMOUSSOU Kenneth 
wrote:

> Hi everyone,
>
> Is it possible to create different class that will extend the `User` base
> class with different attributes? And use those class for authentication
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/860ecbae-0492-4f4c-8df3-459b32a46a76%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNkY6snPQ-occ1fkDLykX2%2BiyOHd17rMEDVMeqx4W%3DKDyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Internal Ranking System Application

2019-06-24 Thread Andrew C.
Np!

https://docs.djangoproject.com/en/2.2/ref/models/fields/#floatfield

Just refer to the docs. There’s FloatField and DecimalField for models.
When you show the numbers in views, just use python to round the numbers.
There are plenty of tutorials and SO (stackoverflow) questions that’ll
help. People on stack who like Django and want more rep points answer
Django tagged questions, so questions are quickly answered. Like matter of
minutes.

Yea, I think all those details are confusing me, but veerrry logical in
your mind since it’s your project. Here’re some things to keep in mind:

Queries: Use them efficiently. Using that one table, ContestScores, we can
find some scores for specific contests. We can write something like:

from .models import ContestScores

avar= ContestScores.objects.filter(contest=2)
thisvar = ContestScores.objects.filter(user=‘derek’)

Using this, we have a queryset. Any records/rows with contest ID 2 in the
ContestScores table will be in avar. In thisvar, any record that has a user
named derek will be stored.

When making a queryset needs to be ordered by some system (I think it was
descending scores), you can do this using the variables above:
avar.order_by(‘-scores’)

Signals: something I avoided for awhile, but got the hang of pretty
quickly. They have some cool little things like pre_save.

from .signals import my_func
pre_save.connect(my_func, sender=ContestScores)

#in signals.py in the apps directory

def my_func(sender, instance, **kwargs):
if instance.contest == 1:
print(‘hello, you should probably do something with this function’)
else:
 print(‘The contest for this record is Contest 1’)
if sender == ContestID:
print(‘the sender is a table, which in this case was ContestID’)
else:
print(‘hi’)


So, say someone created a new row in ContestScores. What’ll happen is,
before the object is saved in the database, it’ll go through that function
first. So if a user created a row setting the contest to be Contest 1, then
you should see “Hello, you should...” and “hi”

I imagine you could use signals for the Index(overall score. There’s
something in databases called indexes). When showing the ranks of
individuals, that’ll be done per request using the order_by method shown
above.

Regarding the semesters, I’d say just add another column to ContestScores
called semesters, then use the filter(semesters=1, user=derek) or
filter(semesters=1, contest=1).

The Django documentation is amazing, and can answer a lot of questions. I
also said to use Django REST API. You don’t need to use it, but the reason
I suggested it was because of its interface. Much smoother than the regular
Django admin, but does require a little bit more work. Of course in
production, you can disable it. I think of it as a neat debug toolbar.

gl!

On Mon, Jun 24, 2019 at 9:02 PM Derek Dong 
wrote:

> I just wanted to add a question: I want to store the indices as floats if
> possible, to at least 3 decimal places, and display them to the nearest
> integer. Is this possible?
>
>
> On Monday, June 24, 2019 at 8:38:34 PM UTC-4, Derek Dong wrote:
>>
>> Thank you so much for the incredibly in-depth response, it's clarified
>> quite a bit of how Django and databases work! I now realize how much I was
>> overcomplicating things.
>>
>> s/a is a formula: the score of an individual divided by the top-15
>> average.
>> The top-15 average is computed for each contest; as expected, it's the 15
>> highest scores, averaged.
>> Thus, it is very possible and, in fact, very common for multiple people
>> to have the same index for a single contest.
>>
>> Think of the end goal as a cumulative grade for each person.
>> So, say, for the first semester, Contests 1 and 2 could be extremely
>> important and be weighted as 25% of the total grade each, with contests 3-7
>> weighted 10% of the total grade each.
>> Then, in the second semester, Contests 1 and 2 contained material less
>> relevant to what was studied in that time, and are weighted 5% each of the
>> cumulative grade, with contests 3-7 still weighted 10% each and contests 8
>> and 9 weighted 20% each.
>>
>> (Note: These aren't "grades," so don't worry about the ethics here. It's
>> just I think this analogy works quite well to describe the system)
>>
>> I want to be able to query the rankings for the first semester and the
>> second semester. For example, there could be a dropdown menu with the
>> options "Semester 1" and "Semester 2" and if I select, say, the latter, a
>> table will show the data for the second semester (Rank, Student, Grade,
>> Overall Index, and indices for each contest contributing to that overall
>> index). If you could point me in a direction for how to do this as well, I
>> would appreciate it a lot!
>>
>> Thanks again for your care and thoroughness!
>>
>> On Monday, June 24, 2019 at 5:14:19 PM UTC-4, Yoo wrote:
>>>
>>> Gotcha. I’ll try my best to explain what you could try. And if this
>>> looks sloppy, then 

Re: Internal Ranking System Application

2019-06-24 Thread Derek Dong
I just wanted to add a question: I want to store the indices as floats if 
possible, to at least 3 decimal places, and display them to the nearest 
integer. Is this possible?

On Monday, June 24, 2019 at 8:38:34 PM UTC-4, Derek Dong wrote:
>
> Thank you so much for the incredibly in-depth response, it's clarified 
> quite a bit of how Django and databases work! I now realize how much I was 
> overcomplicating things.
>
> s/a is a formula: the score of an individual divided by the top-15 average.
> The top-15 average is computed for each contest; as expected, it's the 15 
> highest scores, averaged.
> Thus, it is very possible and, in fact, very common for multiple people to 
> have the same index for a single contest.
>
> Think of the end goal as a cumulative grade for each person. 
> So, say, for the first semester, Contests 1 and 2 could be extremely 
> important and be weighted as 25% of the total grade each, with contests 3-7 
> weighted 10% of the total grade each.
> Then, in the second semester, Contests 1 and 2 contained material less 
> relevant to what was studied in that time, and are weighted 5% each of the 
> cumulative grade, with contests 3-7 still weighted 10% each and contests 8 
> and 9 weighted 20% each.
>
> (Note: These aren't "grades," so don't worry about the ethics here. It's 
> just I think this analogy works quite well to describe the system)
>
> I want to be able to query the rankings for the first semester and the 
> second semester. For example, there could be a dropdown menu with the 
> options "Semester 1" and "Semester 2" and if I select, say, the latter, a 
> table will show the data for the second semester (Rank, Student, Grade, 
> Overall Index, and indices for each contest contributing to that overall 
> index). If you could point me in a direction for how to do this as well, I 
> would appreciate it a lot!
>
> Thanks again for your care and thoroughness!
>
> On Monday, June 24, 2019 at 5:14:19 PM UTC-4, Yoo wrote:
>>
>> Gotcha. I’ll try my best to explain what you could try. And if this looks 
>> sloppy, then I’ll make a public gist.
>>
>> So, firstly, let’s set some things straight. A database is a collection 
>> of tables. Models in Django represent one table with multiple columns. 
>> Tables do not need to have the same columns. What you’ve given is one table 
>> and appending lots of new attributes. That’s a non-relational database that 
>> I advise you stay away from. 
>>
>> Here’s what I have in mind: there is a profile table. All users in this 
>> table are in all contests.
>>
>> We’re gonna first ignore the Profile model from that link. That’ll be the 
>> thing that houses student’s grade. Django has its OWN Users model which the 
>> Profile table extends from. Again, let’s ignore the Profile, for now. First 
>> import the Django user model:
>>
>> from django.contrib.auth.models import Users
>>
>> Then,  based on what I’m imagining,  we’re going to make one table called 
>> ContestID that can include Contest name(optional) and the main behemoth, 
>> ContestScore:
>>
>> import uuid
>>
>> class ContestID(models.Model): 
>> id = models.AutoField(primary_key=True)
>> name = models.CharField(max_length=True)
>>
>> # You don’t have to have the id field since Django automatically enables 
>> it if another attribute/column isn’t specified as primary key. I just 
>> wanted to show everything
>>
>> class ContestScores(models.Model):
>> id = models.UUIDField(primary_key=True, default=uuid.uuid4, 
>> editable=False)
>> contest = models.ForeignKey(ContestID, on_delete=models.CASCADE) 
>> user = models.ForeignKey(User, on_delete=models.SET_NULL)
>> score = models.PositiveIntegerField(default=0)
>> 
>> Alr, here’s what’s goin’ on. We have multiple contests listed in 
>> ContestID. If they don’t have names, you can delete the names 
>> column/line-of-code.
>>
>> Then in the table ContestScores, we have an id field called UUIDField. In 
>> regular relational databases, row ids are unique. In your spreadsheet, each 
>> record/row was unique by an incrementing row number. For us, this might be 
>> several gazillionbillionakfhwjbxin rows, so we wanna be safe with this 
>> thing called Universally Unique Identifier.
>>
>> The contest column is a foreign key. This means the that this row belongs 
>> to Contest 1 or Contest 2, etc.
>>
>> The score column is this user’s score based on a certain contest. The 
>> user column specifies which user this record of scores belongs to.
>>
>> So in its entirety, the Contest table would “read” like this: in Contest 
>> 1, the user Derek received a score of 94. We can find this record at the 
>> id: ajbi02-kebo... (it’s 32 chars long).
>>  
>> Ok, it looks pretty useless right now. 
>>
>> Now, let’s implement that Profile table:
>>
>> class Profile(models.Model):
>> user = models.OneToOneField(User, on_delete=models.CASCADE, 
>> primary_key=True) 
>> grade = models.PositiveSmallIntegerField()
>> index 

Re: Internal Ranking System Application

2019-06-24 Thread Derek Dong
Thank you so much for the incredibly in-depth response, it's clarified 
quite a bit of how Django and databases work! I now realize how much I was 
overcomplicating things.

s/a is a formula: the score of an individual divided by the top-15 average.
The top-15 average is computed for each contest; as expected, it's the 15 
highest scores, averaged.
Thus, it is very possible and, in fact, very common for multiple people to 
have the same index for a single contest.

Think of the end goal as a cumulative grade for each person. 
So, say, for the first semester, Contests 1 and 2 could be extremely 
important and be weighted as 25% of the total grade each, with contests 3-7 
weighted 10% of the total grade each.
Then, in the second semester, Contests 1 and 2 contained material less 
relevant to what was studied in that time, and are weighted 5% each of the 
cumulative grade, with contests 3-7 still weighted 10% each and contests 8 
and 9 weighted 20% each.

(Note: These aren't "grades," so don't worry about the ethics here. It's 
just I think this analogy works quite well to describe the system)

I want to be able to query the rankings for the first semester and the 
second semester. For example, there could be a dropdown menu with the 
options "Semester 1" and "Semester 2" and if I select, say, the latter, a 
table will show the data for the second semester (Rank, Student, Grade, 
Overall Index, and indices for each contest contributing to that overall 
index). If you could point me in a direction for how to do this as well, I 
would appreciate it a lot!

Thanks again for your care and thoroughness!

On Monday, June 24, 2019 at 5:14:19 PM UTC-4, Yoo wrote:
>
> Gotcha. I’ll try my best to explain what you could try. And if this looks 
> sloppy, then I’ll make a public gist.
>
> So, firstly, let’s set some things straight. A database is a collection of 
> tables. Models in Django represent one table with multiple columns. Tables 
> do not need to have the same columns. What you’ve given is one table and 
> appending lots of new attributes. That’s a non-relational database that I 
> advise you stay away from. 
>
> Here’s what I have in mind: there is a profile table. All users in this 
> table are in all contests.
>
> We’re gonna first ignore the Profile model from that link. That’ll be the 
> thing that houses student’s grade. Django has its OWN Users model which the 
> Profile table extends from. Again, let’s ignore the Profile, for now. First 
> import the Django user model:
>
> from django.contrib.auth.models import Users
>
> Then,  based on what I’m imagining,  we’re going to make one table called 
> ContestID that can include Contest name(optional) and the main behemoth, 
> ContestScore:
>
> import uuid
>
> class ContestID(models.Model): 
> id = models.AutoField(primary_key=True)
> name = models.CharField(max_length=True)
>
> # You don’t have to have the id field since Django automatically enables 
> it if another attribute/column isn’t specified as primary key. I just 
> wanted to show everything
>
> class ContestScores(models.Model):
> id = models.UUIDField(primary_key=True, default=uuid.uuid4, 
> editable=False)
> contest = models.ForeignKey(ContestID, on_delete=models.CASCADE) 
> user = models.ForeignKey(User, on_delete=models.SET_NULL)
> score = models.PositiveIntegerField(default=0)
> 
> Alr, here’s what’s goin’ on. We have multiple contests listed in 
> ContestID. If they don’t have names, you can delete the names 
> column/line-of-code.
>
> Then in the table ContestScores, we have an id field called UUIDField. In 
> regular relational databases, row ids are unique. In your spreadsheet, each 
> record/row was unique by an incrementing row number. For us, this might be 
> several gazillionbillionakfhwjbxin rows, so we wanna be safe with this 
> thing called Universally Unique Identifier.
>
> The contest column is a foreign key. This means the that this row belongs 
> to Contest 1 or Contest 2, etc.
>
> The score column is this user’s score based on a certain contest. The user 
> column specifies which user this record of scores belongs to.
>
> So in its entirety, the Contest table would “read” like this: in Contest 
> 1, the user Derek received a score of 94. We can find this record at the 
> id: ajbi02-kebo... (it’s 32 chars long).
>  
> Ok, it looks pretty useless right now. 
>
> Now, let’s implement that Profile table:
>
> class Profile(models.Model):
> user = models.OneToOneField(User, on_delete=models.CASCADE, 
> primary_key=True) 
> grade = models.PositiveSmallIntegerField()
> index = models.PositiveIntegerField()
>
> Before I move on, I just need to clarify something: what is the index? Is 
> it s/a, and is the index unique for each student. Is “a” the average of all 
> scores across all contests?
>
> The ranking system, if I’m not mistaken, is ranking the players the ENTIRE 
> TIME. So the number one person should have the highest index, s/a. 
>

Re: Display ManyToManyField value or a select_related query in an html object list

2019-06-24 Thread Ricardo Daniel Quiroga
Hi,

model.many_to_many_atribute.all()
model.many_to_many_atribute.find(name="carl")


El lun., 24 jun. 2019 a las 19:18, Charlotte Wood (<
charlotte.w...@epiccharterschools.org>) escribió:

> HELP!
>
> Do ManyToManyFields just not print?
>
> I see them in my form selection.
>
> Everything works fine, but when I try to put the linked item on a list
> form, i get:  project.model.none for the value.  I cannot figure out how to
> make all the values print.  HELP!  PLEASE!!
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ec36b6b0-dc7a-4534-9af3-ae0a173fa493%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Ricardo Daniel Quiroga

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO2-wHbGHpgzBdqzsvj%3DVuC-AF3%2BXKGkVpmnKhTtoV-5irSYjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Display ManyToManyField value or a select_related query in an html object list

2019-06-24 Thread Charlotte Wood
HELP!

Do ManyToManyFields just not print?

I see them in my form selection.

Everything works fine, but when I try to put the linked item on a list 
form, i get:  project.model.none for the value.  I cannot figure out how to 
make all the values print.  HELP!  PLEASE!!

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec36b6b0-dc7a-4534-9af3-ae0a173fa493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why I cannot save records into database?

2019-06-24 Thread Aldian Fazrihady
How do you render your form? Can I see the content of the template file?

Regards,

Aldian Fazrihady

On Mon, 24 Jun 2019, 20:14 Alexandru Caplat,  wrote:

> I have a form that in past works good but after I change some data in the 
> models and add image field it doesn't work.
>
> From admin I can add new records but I think is a problem with form id. When 
> I inspect in google chrome the admin page,
>
> form id is porumbei_form and when I inspect my template, the form id is not 
> showing.
>
> #My view @login_required(login_url='/login/')def porumbelnou(request):
> if request.method == "POST":
> form = AdaugaPorumbel(request.POST, request.FILES)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect('/porumbei/')
> else:
> form = AdaugaPorumbel()
> context = {
> 'form': form,
> }
> template = loader.get_template("adaugare_porumbel.html")
> return HttpResponse(template.render(context, request))
> #My formclass AdaugaPorumbel(forms.ModelForm):
> class Meta:
> model = Porumbei
> fields = ['data_adaugare', 'serie_inel', 'anul', 'culoare', 'crescator', 
> 'culoare_ochi', 'sex', 'ecloziune',
>   'rasa', 'linie', 'nume', 'tata',
>   'mama', 'compartiment', 'status', 'data', 'vaccinat', 'info', 
> 'imagine', 'imagine_ochi']
> widgets = {
> 'ecloziune': forms.DateInput(format='%d/%m/%Y',
>  attrs={'class': 'form-control', 'type': 
> 'date'}),
> 'data': forms.DateInput(format='%d/%m/%Y',
> attrs={'class': 'form-control', 'type': 
> 'date'}),
> 'vaccinat': forms.DateInput(format='%d/%m/%Y',
> attrs={'class': 'form-control', 'type': 
> 'date'}),
>
> 'info': forms.Textarea(attrs={'class': 'form-control mt-15', 'rows': 
> '3',
>   'placeholder': 'Vor apărea în 
> pedigree'}),
> }
> #My model
> class Porumbei(models.Model):
> id_porumbel = models.AutoField(primary_key=True)
> data_adaugare = models.DateTimeField(default=datetime.now())
> crescator = models.ForeignKey(settings.AUTH_USER_MODEL, 
> on_delete=models.CASCADE)
> serie_inel = models.CharField(max_length=25, null=False, blank=False, 
> unique=True)
> anul = models.CharField(max_length=4, null=False, blank=False)
> culoare = models.ForeignKey(CuloriPorumbei, on_delete=models.CASCADE, 
> null=False, blank=False, )
> culoare_ochi = models.ForeignKey(CuloriOchi, on_delete=models.CASCADE, 
> nullhttps://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN7EoAZBaxyz8P-0oZ-52ajpy0R4d%3D_DvG7JdzARsDJTpWfuMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating a log for any changes in any model data i.e creation, updation and deletion??

2019-06-24 Thread Jani Tiainen
Hi.

Note that there are still ways to modify data withouth signals getting
fired. Nor save or delete is called.


ma 24. kesäk. 2019 klo 18.54 Abhishek Tiwari  kirjoitti:

> That is the approach i have in mind.. Thank you..
>
> On Monday, 24 June 2019 20:08:06 UTC+5:30, Brandon Rosenbloom wrote:
>>
>> Try using Django signals
>> https://docs.djangoproject.com/en/2.2/topics/signals/
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e286a8ea-b2d6-45ed-a7fa-f4a0f5478274%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oef-PW0LiEbFYvy5yapCyp6HHQqW1ViWaV1HUTJ-Ad1Nw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Internal Ranking System Application

2019-06-24 Thread Andrew C.
Gotcha. I’ll try my best to explain what you could try. And if this looks
sloppy, then I’ll make a public gist.

So, firstly, let’s set some things straight. A database is a collection of
tables. Models in Django represent one table with multiple columns. Tables
do not need to have the same columns. What you’ve given is one table and
appending lots of new attributes. That’s a non-relational database that I
advise you stay away from.

Here’s what I have in mind: there is a profile table. All users in this
table are in all contests.

We’re gonna first ignore the Profile model from that link. That’ll be the
thing that houses student’s grade. Django has its OWN Users model which the
Profile table extends from. Again, let’s ignore the Profile, for now. First
import the Django user model:

from django.contrib.auth.models import Users

Then,  based on what I’m imagining,  we’re going to make one table called
ContestID that can include Contest name(optional) and the main behemoth,
ContestScore:

import uuid

class ContestID(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=True)

# You don’t have to have the id field since Django automatically enables it
if another attribute/column isn’t specified as primary key. I just wanted
to show everything

class ContestScores(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4,
editable=False)
contest = models.ForeignKey(ContestID, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.SET_NULL)
score = models.PositiveIntegerField(default=0)

Alr, here’s what’s goin’ on. We have multiple contests listed in ContestID.
If they don’t have names, you can delete the names column/line-of-code.

Then in the table ContestScores, we have an id field called UUIDField. In
regular relational databases, row ids are unique. In your spreadsheet, each
record/row was unique by an incrementing row number. For us, this might be
several gazillionbillionakfhwjbxin rows, so we wanna be safe with this
thing called Universally Unique Identifier.

The contest column is a foreign key. This means the that this row belongs
to Contest 1 or Contest 2, etc.

The score column is this user’s score based on a certain contest. The user
column specifies which user this record of scores belongs to.

So in its entirety, the Contest table would “read” like this: in Contest 1,
the user Derek received a score of 94. We can find this record at the id:
ajbi02-kebo... (it’s 32 chars long).

Ok, it looks pretty useless right now.

Now, let’s implement that Profile table:

class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE,
primary_key=True)
grade = models.PositiveSmallIntegerField()
index = models.PositiveIntegerField()

Before I move on, I just need to clarify something: what is the index? Is
it s/a, and is the index unique for each student. Is “a” the average of all
scores across all contests?

The ranking system, if I’m not mistaken, is ranking the players the ENTIRE
TIME. So the number one person should have the highest index, s/a.

I’m clear on what the index is utilized for: ranking. I’m just not so clear
on how the index is calculated.

If you decide you wanna learn this yourself, the best way is to learn what
a relational database is, like MySQL or PostgreSQL or SQLite. Just a small
visual explanation or just seeing a database like those will help you in
the long run.

But if you decide not to learn too much, because sometimes Django becomes a
lot too quickly, just clarify what the index is, and we’ll keep going.

On Mon, Jun 24, 2019 at 3:31 PM Derek Dong 
wrote:

> I'd like to specify my main problem a bit more.
>
> The biggest issue is how to implement the ranking system's calculations
> and input. The way it is currently done is manually on a Spreadsheet, which
> is functional but cumbersome in the event of a slight human error, as well
> as fact that the members change a bit. The way I implemented a Java app to
> deal with it is:
>
> The database is stored in a CSV file, in the form of a spreadsheet, with
> columns labeled: Rank, Name, Grade, Index (Overall score), Contest 1 score,
> Contest 2 score, etc.
>
> To add a new contest's scores:
> For every participating student:
> Enter the student's name
> Enter the student's grade
> Enter the student's score, s
> End for
> Find the top 15 scores' average, a
> For every participating student:
> Compute s/a, find the student in the CSV, and append the result
> For every student not added:
> If the student has a score for that contest already
> Leave it
> Else
> Append 0
> If it's the student's first contest:
> Append a row with the student's name, grade, and 0's for all previous
> contests, completed with that student's index, s/a
> For every student:
> Replace their Index with the average of all their contest scores
> Sort the students by Index in decreasing 

Re: action in a form

2019-06-24 Thread Kai Kobschätzki
Well, perhaps there is my misunderstanding: I thought if I press "save"
it pass through the functions journal_booking_view and then it call the
action-argument. Otherwise there is no action-argument it calls the
journal_booking_view for saving the view. I'm confused.

Greetings

bengoshi


On 6/24/19 10:39 PM, Sebastian Jung wrote:
> You send your Form to function journal_overview_view. There are
> nothing with save()
>
> Regards
>
> Kai Kobschätzki  > schrieb am Mo., 24. Juni 2019, 21:14:
>
> Hi Sebastian,
>
> here is the code:
>
> urls.py:
>
> from django.contrib import admin
> from django.urls import path
> from rewe.views import account_overview_view, journal_booking_view, 
> journal_overview_view
> from crm.views import member_overview_view, member_create_view
>
> urlpatterns = [
> path('', journal_overview_view),
> path('overview_account', account_overview_view),
> path('overview_member', member_overview_view),
> path('member_create', member_create_view, name='member_create'),
> path('booking', journal_booking_view),
> path('journal', journal_overview_view),
> path('admin/', admin.site.urls),
> ]
>
> views.py
>
> from .models import Account, Journal
> from crm.models import Member
> from .forms import BookingForm
>
>
> def journal_booking_view(request):
> form = BookingForm(request.POST or None)
> if form.is_valid():
> form.save()
> form = BookingForm()
> context = {
> 'form' : form
> }
> return render(request, "rewe/rewe_journal_booking.html", context)
>
>
>
> def journal_overview_view(request):
> journal_entrys = Journal.objects.all()
> context = {
> 'journal'   : journal_entrys
> }
> return render(request, "rewe/rewe_journal_overview.html", context)
>
>
> forms.py
>
> from django import forms
> from .models import Journal
>
> class BookingForm(forms.ModelForm):
> class Meta:
> model = Journal
> fields = [
> 'amount',
> 'date',
> 'posting_text'
> ]
>
>
>
> Thanks and Greetings
>
> bengoshi
>
>
>
> On 6/24/19 9:15 AM, Sebastian Jung wrote:
>> Hello,
>>
>> Please Post us your url.py template and the related function from
>> view.py
>>
>> Regards
>>
>> bengoshi > > schrieb am So., 23. Juni
>> 2019, 22:36:
>>
>> Thanks for your responses. I didn't describe it well.. if I
>> write
>>
>> 
>> it calls the url journal and this is the my requested result. All 
>> fine.
>> Without the attribute "action" the form save the input in the 
>> database - the requested result, great.
>> With "action" it doesn't. That is the point which I don't understand 
>> becauce in my understanding
>> action should not have any effect for saving data.
>>
>> Greetings
>> bengoshi
>>
>>
>> Am Sonntag, 23. Juni 2019 19:31:05 UTC+2 schrieb Sipum:
>>
>> Hello,
>>
>> In action use the url associated with that view then it
>> will work for you. 
>> If not then kindly tell what errors you are getting. 
>>
>> Thanks. 
>>
>> On Sun, 23 Jun, 2019, 10:17 PM Sebastian Jung,
>>  wrote:
>>
>> Hello,
>>
>> You must Put in Action not a Name from a function.
>> You must Put a url dir example action="/newurl/"
>>
>> And in your url a Link from /newurl/ to the function
>>
>> Regards
>>
>> bengoshi  schrieb am So., 23.
>> Juni 2019, 17:57:
>>
>> Hi,
>> I tried to write a form:
>>
>> ###
>>
>> {% extends 'base.html' %}
>> {% block content %}
>> Test
>> 
>> {% csrf_token %}
>> {{ form.as_p }}
>> 
>> 
>> {% endblock %}
>> ###
>>
>> and it works. But if I replace it with
>>
>> >
>> "journal" is a view for shown the saved data which work, 
>> too. If I click to "Save" it change to "journal" but won't save the data 
>> anymoren.
>>
>> Could anybody explain me please this behavior?
>>
>> Thanks and Greetings
>>
>> bengoshi
>>
>>
>> -- 
>> You received this message because you are
>> subscribed to the Google Groups "Django users" group.
>> To unsubscribe from this 

Re: action in a form

2019-06-24 Thread Sebastian Jung
You send your Form to function journal_overview_view. There are nothing
with save()

Regards

Kai Kobschätzki  schrieb am Mo., 24. Juni 2019,
21:14:

> Hi Sebastian,
>
> here is the code:
>
> urls.py:
>
> from django.contrib import admin
> from django.urls import path
> from rewe.views import account_overview_view, journal_booking_view, 
> journal_overview_view
> from crm.views import member_overview_view, member_create_view
>
> urlpatterns = [
> path('', journal_overview_view),
> path('overview_account', account_overview_view),
> path('overview_member', member_overview_view),
> path('member_create', member_create_view, name='member_create'),
> path('booking', journal_booking_view),
> path('journal', journal_overview_view),
> path('admin/', admin.site.urls),
> ]
>
> views.py
>
> from .models import Account, Journal
> from crm.models import Member
> from .forms import BookingForm
>
>
> def journal_booking_view(request):
> form = BookingForm(request.POST or None)
> if form.is_valid():
> form.save()
> form = BookingForm()
> context = {
> 'form' : form
> }
> return render(request, "rewe/rewe_journal_booking.html", context)
>
>
>
> def journal_overview_view(request):
> journal_entrys = Journal.objects.all()
> context = {
> 'journal'   : journal_entrys
> }
> return render(request, "rewe/rewe_journal_overview.html", context)
>
>
> forms.py
>
> from django import forms
> from .models import Journal
>
> class BookingForm(forms.ModelForm):
> class Meta:
> model = Journal
> fields = [
> 'amount',
> 'date',
> 'posting_text'
> ]
>
>
>
> Thanks and Greetings
>
> bengoshi
>
>
>
>
> On 6/24/19 9:15 AM, Sebastian Jung wrote:
>
> Hello,
>
> Please Post us your url.py template and the related function from view.py
>
> Regards
>
> bengoshi  schrieb am So., 23. Juni 2019,
> 22:36:
>
>> Thanks for your responses. I didn't describe it well.. if I write
>>
>> 
>> it calls the url journal and this is the my requested result. All fine.
>> Without the attribute "action" the form save the input in the database - the 
>> requested result, great.
>> With "action" it doesn't. That is the point which I don't understand becauce 
>> in my understanding
>> action should not have any effect for saving data.
>>
>> Greetings
>> bengoshi
>>
>>
>> Am Sonntag, 23. Juni 2019 19:31:05 UTC+2 schrieb Sipum:
>>>
>>> Hello,
>>>
>>> In action use the url associated with that view then it will work for
>>> you.
>>> If not then kindly tell what errors you are getting.
>>>
>>> Thanks.
>>>
>>> On Sun, 23 Jun, 2019, 10:17 PM Sebastian Jung, 
>>> wrote:
>>>
 Hello,

 You must Put in Action not a Name from a function. You must Put a url
 dir example action="/newurl/"

 And in your url a Link from /newurl/ to the function

 Regards

 bengoshi  schrieb am So., 23. Juni 2019, 17:57:

> Hi,
> I tried to write a form:
>
> ###
>
> {% extends 'base.html' %}
> {% block content %}Test
> {% csrf_token %}
> {{ form.as_p }}
> 
> {% endblock %}
> ###
>
> and it works. But if I replace it with
>
> 
> "journal" is a view for shown the saved data which work, too. If I click 
> to "Save" it change to "journal" but won't save the data anymoren.
>
> Could anybody explain me please this behavior?
>
> Thanks and Greetings
>
> bengoshi
>
>
>
> --
> 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 post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e153dd08-3678-4620-8f1d-dae1fa1b978f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
 --
 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 post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAKGT9mxSq-ZKdQc_zUdHZmqZ5g%2Bfr8YVn0Upm%3DWru9SD6%3DwWkg%40mail.gmail.com
 

Re: Internal Ranking System Application

2019-06-24 Thread Derek Dong
I'd like to specify my main problem a bit more.

The biggest issue is how to implement the ranking system's calculations and 
input. The way it is currently done is manually on a Spreadsheet, which is 
functional but cumbersome in the event of a slight human error, as well as 
fact that the members change a bit. The way I implemented a Java app to 
deal with it is:

The database is stored in a CSV file, in the form of a spreadsheet, with 
columns labeled: Rank, Name, Grade, Index (Overall score), Contest 1 score, 
Contest 2 score, etc.

To add a new contest's scores:
For every participating student:
Enter the student's name
Enter the student's grade
Enter the student's score, s
End for
Find the top 15 scores' average, a
For every participating student:
Compute s/a, find the student in the CSV, and append the result
For every student not added:
If the student has a score for that contest already
Leave it
Else
Append 0
If it's the student's first contest:
Append a row with the student's name, grade, and 0's for all previous 
contests, completed with that student's index, s/a
For every student:
Replace their Index with the average of all their contest scores
Sort the students by Index in decreasing order
Replace the CSV file with the new, completed data

The problem with the Java program is it's cumbersome to store the numbers 
in a CSV and reread it each time, plus we already have a website, which 
combined with all the flexibility the ability to give each student a 
Profile makes the Django app so appealing.

Does anyone have more specific ideas about how to implement this?

As far the Django REST Framework goes, I'm not sure if making an API is 
really what I want to be doing here. As you can tell by how this app will 
be used, I'm a student who doesn't have much experience with "real-world" 
programming, especially those users can interact with easily. Sorry again 
if I'm not being clear, I'll try harder to specify what I mean if you need 
more.


On Sunday, June 16, 2019 at 9:49:07 PM UTC-4, Yoo wrote:
>
> Based off the context:
>
> https://simpleisbetterthancomplex.com/tutorial/2016/11/23/how-to-add-user-profile-to-django-admin.html
>
> I'm somewhat confused regarding where this is supposed to go, so here're 
> some random ideas which hopefully might help you start off with some Google 
> searches:
>
> The above link is implementing a Profile model, which kinda extends the 
> User model if that can help based off the context. Once you finish the 
> tutorial above, runserver and access the admin at 127.0.0.1:8000/admin 
> and enter the user model to see all the fields you added to the Profile 
> model.
>
> When processing the numbers, you can define a function based on PUT 
> (update) requests. Or, whenever an object is created, a Django signal can 
> be sent out to do some action like updating another table. (Unfortunately, 
> I'm not too well-educated on signals...). 
>
> Indexes will have everything ordered based off your liking for improved 
> querying; otherwise, ordering will do the trick when using a queryset 
> (basically when you query for several tables, the server returns an 
> ordering you specify e.g. ordered dates, numbers, letters, etc.). 
>
> Regarding authenticating users, you''ll have token authentication and some 
> Django decorators that'll allow you to specify when an Authenticated User 
> is allowed to do action X, Y, or Z. Unauthenticated users would be blocked 
> from certain pages by utilizing the templates/html's with tags {% if 
> user.is_authenticated %} then your HTML then another tag {% else %} with 
> other tags. There are plenty of other ways such as redirecting a user in 
> the views.py and yada yada if the user is NOT authenticated.
>
> Something I think would help you is to utilize Django-rest-framework. It's 
> designed as an API, but I think you'll understand Django much better 
> through it. It's well-documented and there are plenty of tutorials 
> (including those with Token authentication which I think you're seeking).
>
> On Sunday, June 16, 2019 at 8:13:05 PM UTC-4, Derek Dong wrote:
>>
>> How can I integrate OAuth with a ranking system in a Django application?
>> I'm not too familiar with Django design philosophy, which is why I'm 
>> asking these questions.
>> The way I understand it, OAuth doesn't let you manipulate information on 
>> the server authenticating a user, so I would still need a User model with 
>> information like "name." Is this right?
>> Some quick context:
>> Each user has float scores for each event (of which there are multiple); 
>> the average (or possibly total if that's easier) of these scores composes 
>> their overall score. Overall scores are used to rank all the users.
>> Should I have separate models for things like "score," "ranking," and/or 
>> "event?" 
>> Where should processing the numbers go? I assume I should make a form to 
>> input scores for each event, possibly with an 

Re: action in a form

2019-06-24 Thread Kai Kobschätzki
Hi Sebastian,

here is the code:

urls.py:

from django.contrib import admin
from django.urls import path
from rewe.views import account_overview_view, journal_booking_view, 
journal_overview_view
from crm.views import member_overview_view, member_create_view

urlpatterns = [
path('', journal_overview_view),
path('overview_account', account_overview_view),
path('overview_member', member_overview_view),
path('member_create', member_create_view, name='member_create'),
path('booking', journal_booking_view),
path('journal', journal_overview_view),
path('admin/', admin.site.urls),
]

views.py

from .models import Account, Journal
from crm.models import Member
from .forms import BookingForm


def journal_booking_view(request):
form = BookingForm(request.POST or None)
if form.is_valid():
form.save()
form = BookingForm()
context = {
'form' : form
}
return render(request, "rewe/rewe_journal_booking.html", context)



def journal_overview_view(request):
journal_entrys = Journal.objects.all()
context = {
'journal'   : journal_entrys
}
return render(request, "rewe/rewe_journal_overview.html", context)


forms.py

from django import forms
from .models import Journal

class BookingForm(forms.ModelForm):
class Meta:
model = Journal
fields = [
'amount',
'date',
'posting_text'
]



Thanks and Greetings

bengoshi



On 6/24/19 9:15 AM, Sebastian Jung wrote:
> Hello,
>
> Please Post us your url.py template and the related function from view.py
>
> Regards
>
> bengoshi  > schrieb am So., 23. Juni 2019, 22:36:
>
> Thanks for your responses. I didn't describe it well.. if I write
>
> 
> it calls the url journal and this is the my requested result. All fine.
> Without the attribute "action" the form save the input in the database - 
> the requested result, great.
> With "action" it doesn't. That is the point which I don't understand 
> becauce in my understanding
> action should not have any effect for saving data.
>
> Greetings
> bengoshi
>
>
> Am Sonntag, 23. Juni 2019 19:31:05 UTC+2 schrieb Sipum:
>
> Hello,
>
> In action use the url associated with that view then it will
> work for you. 
> If not then kindly tell what errors you are getting. 
>
> Thanks. 
>
> On Sun, 23 Jun, 2019, 10:17 PM Sebastian Jung,
>  wrote:
>
> Hello,
>
> You must Put in Action not a Name from a function. You
> must Put a url dir example action="/newurl/"
>
> And in your url a Link from /newurl/ to the function
>
> Regards
>
> bengoshi  schrieb am So., 23. Juni
> 2019, 17:57:
>
> Hi,
> I tried to write a form:
>
> ###
>
> {% extends 'base.html' %}
> {% block content %}
> Test
> 
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
> {% endblock %}
> ###
>
> and it works. But if I replace it with
>
> 
> "journal" is a view for shown the saved data which work, too. 
> If I click to "Save" it change to "journal" but won't save the data anymoren.
>
> Could anybody explain me please this behavior?
>
> Thanks and Greetings
>
> bengoshi
>
>
> -- 
> 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 post to this group, send email to
> django...@googlegroups.com.
> Visit this group at
> https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/django-users/e153dd08-3678-4620-8f1d-dae1fa1b978f%40googlegroups.com
> 
> .
> For more options, visit
> https://groups.google.com/d/optout.
>
> -- 
> 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 post to this group, send email to
> django...@googlegroups.com.
> Visit this group at
> 

Re: Django-MQTT

2019-06-24 Thread Sabuhi Shukurov
Hello Eric!

Thanks for your reply, sorry for late response I was busy with another 
project.
I am doing the same job currently, I should transfer datas real-time using 
websockets (django channels) involves here. Do you have any suggestion for 
this? subscibed topic should print datas all in real time.

On Tuesday, 21 May 2019 12:20:21 UTC+4, PASCUAL Eric wrote:
>
> Hi Sabuhi,
>
> I wrote something similar a couple years ago, not involving Arduinos but 
> using MQTT anyway. 
>
> The selected approach consisted in having a MQTT listener, based on 
> paho-mqtt lib (https://pypi.org/project/paho-mqtt/), acting as a gateway 
> to a REST API on the Django side, based on Django REST Framework. It worked 
> pretty well and I have no special remembering of difficulties or trouble.
>
> Hope this helps.
>
> Eric
>
> --
> *From:* django...@googlegroups.com  <
> django...@googlegroups.com > on behalf of Sabuhi Shukurov <
> sabuhi@gmail.com >
> *Sent:* Monday, May 20, 2019 15:01
> *To:* Django users
> *Subject:* Django-MQTT 
>  
> Hello Python Community!
> I would like to to create a connection between the device(Arduino) and web 
> server by using the MQTT protocol. As tools, we will use RabbitMQ, Django, 
> and  Django-channels for web socket. The device should communicate to the 
> server by means of message broker in order to pass data to interface and 
> should be possible to get back subscription by in case of any change on the 
> interface.
> I know them theoretically and cannot apply practically to Django.
>
> -- 
> 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 post to this group, send email to djang...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/53b73716-5aeb-4b86-9240-5af2a0be4275%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a8e37c29-79e3-4e19-ad98-ecb2d476e822%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create Different Graphs and PDF Reports

2019-06-24 Thread Joel Mathew
You can use reportlab for pdf generation

On Mon, 24 Jun, 2019, 9:18 PM Balaji Shetty,  wrote:

> HI
> can anyone suggest How to create Different Graphs and PDF Reports in
> Django Admin Panel itself which work on Models with relation.
> It there any library.
>
>
>
> --
>
>
> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
> *Official: bsshe...@sggs.ac.in  *
> *  Mobile: +91-9270696267*
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAECSbOvi0sAta%3Do%2BmBf%2BVTBbTcAU6ZmZZBvWKoaU1T4-TFf2jw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA%3Diw__%3DM6XKNwu40og2wtrUDtk87K4%3DdXFet8ytas4Sa1rybA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Anyone is able to delete or update other's post through url

2019-06-24 Thread Jarret Minkler
Relying on the front end is not a secure solution.

On Mon, Jun 24, 2019 at 10:37 AM Brandon Rosenbloom <
brandonrosenbl...@gmail.com> wrote:

> I’m kind of new to this as well but figured I would take a stab at this.
> It seems to me that if you wanted to prevent users from deleting posts that
> weren’t theirs, the appropriate course of action would be to simply remove
> their ability to access the delete method in the first place. I would
> recommend placing logic in the front end that only shows the delete option
> to logged in users who are the original authors of the post.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/25b558ad-9811-4705-84b4-93dce71d30fb%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jarret Minkler

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB5FS97EAYNyBX%2BkJnV06LS65LG7iFwyeyc7fTPZbE03zi7aFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create Different Graphs and PDF Reports

2019-06-24 Thread ABHISHEK RAJ
Yes, you can use Fusion Charts   library.
Here is the link
https://www.fusioncharts.com/blog/creating-charts-in-django/

On Mon 24 Jun, 2019, 9:18 PM Balaji Shetty,  wrote:

> HI
> can anyone suggest How to create Different Graphs and PDF Reports in
> Django Admin Panel itself which work on Models with relation.
> It there any library.
>
>
>
> --
>
>
> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
> *Official: bsshe...@sggs.ac.in  *
> *  Mobile: +91-9270696267*
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAECSbOvi0sAta%3Do%2BmBf%2BVTBbTcAU6ZmZZBvWKoaU1T4-TFf2jw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEz5wc65Fga7GxMQyiWF%3D62cd73OKKXhpeH8vvHPP8koOUtgfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Anyone is able to delete or update other's post through url

2019-06-24 Thread Kasper Laudrup
On June 24, 2019 4:35:45 PM GMT+02:00, Brandon Rosenbloom 
 wrote:
>I would recommend placing logic in the front end that only shows
>the delete option to logged in users who are the original authors of
>the post.

That would be good for usability (don't give the user options that she cannot 
use), but is definitely not good enough in terms of security.

Any slightly competent attacker would still be able to delete the post. Rule #0 
in security is never to trust the client.

I might have misunderstood you though, just thought this was important to point 
out.

Kind regards,

Kasper

Hi Brandon,

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AAD8D0F6-B92B-417C-BB9A-F9922D90BCD9%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Creating a log for any changes in any model data i.e creation, updation and deletion??

2019-06-24 Thread Abhishek Tiwari
That is the approach i have in mind.. Thank you..

On Monday, 24 June 2019 20:08:06 UTC+5:30, Brandon Rosenbloom wrote:
>
> Try using Django signals 
> https://docs.djangoproject.com/en/2.2/topics/signals/

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e286a8ea-b2d6-45ed-a7fa-f4a0f5478274%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to create Different Graphs and PDF Reports

2019-06-24 Thread Balaji Shetty
HI
can anyone suggest How to create Different Graphs and PDF Reports in Django
Admin Panel itself which work on Models with relation.
It there any library.



-- 


*Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
*SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
*Official: bsshe...@sggs.ac.in  *
*  Mobile: +91-9270696267*

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAECSbOvi0sAta%3Do%2BmBf%2BVTBbTcAU6ZmZZBvWKoaU1T4-TFf2jw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Anyone is able to delete or update other's post through url

2019-06-24 Thread Gaurav Sahu
Thanks, It works. Also, other people are able to access the draft posts 
detail view through URL. I thought of a solution that I will provide only 
the list of drafts and if the user clicks on it will take to the edit page 
of that post. But I am not able to implement this thing.

On Monday, June 24, 2019 at 8:39:26 PM UTC+5:30, Aldian Fazrihady wrote:
>
> I would implement get_queryset method that filter blog post by 
> author=self.request.user
>
> Regards, 
>
> Aldian Fazrihady
>
> On Sun, 23 Jun 2019, 20:55 Gaurav Sahu, > 
> wrote:
>
>> Hy, I am developing a  Django Blog application. In this application, I 
>> have a PostEdit view to edit the post, Delete post view to delete the post. 
>> These operations can only be performed by the user who has created that 
>> post. I used Delete view as a functional view and edit view as CBV. Now 
>> what is happening is that any user is able to delete or edit the others 
>> post through URL. In my delete post view since it is a functional based 
>> view, I have used if condition to prevent another user to prevent deleting 
>> someone else post. But since for post edit, I am using CBV, I am not able 
>> to find a way to prevent a user from editing someone else's post.
>> So how can I prevent doing another user to edit someone else post?
>>
>>
>> class PostUpdateView(LoginRequiredMixin ,UpdateView):
>> model = Post
>> template_name = 'blog/post_form.html'
>> form_class = PostForm
>>
>> def get_context_data(self, **kwargs):
>> context = super().get_context_data(**kwargs)
>> context['title'] = 'Update'
>> return context
>>
>> def form_valid(self, form):
>> form.instance.author = self.request.user
>> form.save()
>> return super().form_valid(form)
>>
>>
>> @login_required
>> def post_delete(request, slug):
>> post = get_object_or_404(Post, slug=slug)
>> if (request.user == post.author):
>> post.delete()
>> return redirect('blog:post_list')
>> else:
>> return redirect('blog:post_detail', slug=slug)
>>
>>
>>
>>
>>
>> -- 
>> 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 post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/9b38d4e0-a30a-43ed-9af6-6c9ac545024f%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/efb6c007-9aaa-48aa-af6e-2f18f0dff523%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Anyone is able to delete or update other's post through url

2019-06-24 Thread Aldian Fazrihady
I would implement get_queryset method that filter blog post by
author=self.request.user

Regards,

Aldian Fazrihady

On Sun, 23 Jun 2019, 20:55 Gaurav Sahu,  wrote:

> Hy, I am developing a  Django Blog application. In this application, I
> have a PostEdit view to edit the post, Delete post view to delete the post.
> These operations can only be performed by the user who has created that
> post. I used Delete view as a functional view and edit view as CBV. Now
> what is happening is that any user is able to delete or edit the others
> post through URL. In my delete post view since it is a functional based
> view, I have used if condition to prevent another user to prevent deleting
> someone else post. But since for post edit, I am using CBV, I am not able
> to find a way to prevent a user from editing someone else's post.
> So how can I prevent doing another user to edit someone else post?
>
>
> class PostUpdateView(LoginRequiredMixin ,UpdateView):
> model = Post
> template_name = 'blog/post_form.html'
> form_class = PostForm
>
> def get_context_data(self, **kwargs):
> context = super().get_context_data(**kwargs)
> context['title'] = 'Update'
> return context
>
> def form_valid(self, form):
> form.instance.author = self.request.user
> form.save()
> return super().form_valid(form)
>
>
> @login_required
> def post_delete(request, slug):
> post = get_object_or_404(Post, slug=slug)
> if (request.user == post.author):
> post.delete()
> return redirect('blog:post_list')
> else:
> return redirect('blog:post_detail', slug=slug)
>
>
>
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9b38d4e0-a30a-43ed-9af6-6c9ac545024f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN7EoAYzVc1Ub5HFj08imS_YLvWrEVGHE4LPpuvdr2%3D191PWYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django mysqlclient

2019-06-24 Thread göktürk sığırtmaç
Thank you i solved according to that 

https://github.com/PyMySQL/mysqlclient-python/issues/169

24 Haziran 2019 Pazartesi 17:14:40 UTC+3 tarihinde N'BE SORO yazdı:
>
> Hi
> install mysql on your computer then reassure you to have access to mysql at 
> command prompt.
>
> once it's Ok active mysql and install mysql client
>
>
> Le lun. 24 juin 2019 à 13:14, göktürk sığırtmaç  > a écrit :
>
>> Hi guys. When i install mysqlclient for will use mysql database on my 
>> django project i have that. 
>>
>>
>> [image: Ekran Resmi 2019-06-24 16.02.28.png]
>>
>>
>>
>> How can i solve that.
>>
>> -- 
>> 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 post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0ae0f4c4-5abd-4f13-99f6-e4c19ce042c8%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59deaa27-9298-4b67-9bcc-239f6766e947%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: WORKFLOWS

2019-06-24 Thread ramadhan ngallen
Thanks a lot
On 24 Jun 2019, 17:37 +0300, Brandon Rosenbloom , 
wrote:
> I know of developers which have used viewflow to accomplish this. Here’s a 
> link:
> https://github.com/viewflow/viewflow
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/0ddcd4dc-63e5-4045-824a-cf45712290fb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4bc5ed41-205a-4bb0-a4e2-fad564c2972f%40Spark.
For more options, visit https://groups.google.com/d/optout.


Creating a log for any changes in any model data i.e creation, updation and deletion??

2019-06-24 Thread Brandon Rosenbloom
I did this using Django signals. Here’s the documentation:
https://docs.djangoproject.com/en/2.2/topics/signals/

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00295487-d34c-4067-8c57-8be1b23225f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


WORKFLOWS

2019-06-24 Thread Brandon Rosenbloom
I know of developers which have used viewflow to accomplish this. Here’s a link:
https://github.com/viewflow/viewflow

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ddcd4dc-63e5-4045-824a-cf45712290fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Anyone is able to delete or update other's post through url

2019-06-24 Thread Brandon Rosenbloom
I’m kind of new to this as well but figured I would take a stab at this. It 
seems to me that if you wanted to prevent users from deleting posts that 
weren’t theirs, the appropriate course of action would be to simply remove 
their ability to access the delete method in the first place. I would recommend 
placing logic in the front end that only shows the delete option to logged in 
users who are the original authors of the post.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25b558ad-9811-4705-84b4-93dce71d30fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Creating a log for any changes in any model data i.e creation, updation and deletion??

2019-06-24 Thread Brandon Rosenbloom
Try using Django signals
https://docs.djangoproject.com/en/2.2/topics/signals/

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6732d1a1-5014-4fd6-b918-f0a0d2c900bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


invalid literal for int() with base 10: 'admin'

2019-06-24 Thread Harshit Agarwal
 Hi guys,
I am currently working on a working on a project. Everything is working
fine but i am not able to access my admin. How can i solve this?
Here is my Stack Trace
Traceback:

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\core\handlers\exception.py"
in inner
  34. response = get_response(request)

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\core\handlers\base.py"
in _get_response
  126. response = self.process_exception_by_middleware(e,
request)

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\core\handlers\base.py"
in _get_response
  124. response = wrapped_callback(request, *callback_args,
**callback_kwargs)

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\views\generic\base.py"
in view
  68. return self.dispatch(request, *args, **kwargs)

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\views\generic\base.py"
in dispatch
  88. return handler(request, *args, **kwargs)

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\views\generic\detail.py"
in get
  106. self.object = self.get_object()

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\views\generic\detail.py"
in get_object
  36. queryset = queryset.filter(pk=pk)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\query.py"
in filter
  844. return self._filter_or_exclude(False, *args, **kwargs)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\query.py"
in _filter_or_exclude
  862. clone.query.add_q(Q(*args, **kwargs))

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\sql\query.py"
in add_q
  1263. clause, _ = self._add_q(q_object, self.used_aliases)

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\sql\query.py"
in _add_q
  1287. split_subq=split_subq,

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\sql\query.py"
in build_filter
  1225. condition = self.build_lookup(lookups, col, value)

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\sql\query.py"
in build_lookup
  1096. lookup = lookup_class(lhs, rhs)

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\lookups.py" in
__init__
  20. self.rhs = self.get_prep_lookup()

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\lookups.py" in
get_prep_lookup
  70. return self.lhs.output_field.get_prep_value(self.rhs)

File
"C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\fields\__init__.py"
in get_prep_value
  965. return int(value)

Exception Type: ValueError at /admin/
Exception Value: invalid literal for int() with base 10: 'admin'

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE%2BC-X-o7sW8m2-DMx4R5CnGrYbYS%2B%2Bx_cYi-BL%3DHwK_b%2BdrHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django User model

2019-06-24 Thread AMOUSSOU Kenneth
Hi everyone,

Is it possible to create different class that will extend the `User` base 
class with different attributes? And use those class for authentication
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/860ecbae-0492-4f4c-8df3-459b32a46a76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to I create download link of some file using django

2019-06-24 Thread Nishant Boro


You can use this simple module:

https://github.com/nishant-boro/django-rest-framework-download-expert

This module provides a simple way to serve files for download in django 
rest framework using Apache module Xsendfile. It also has an additional 
feature of serving downloads only to users belonging to a particular group

On Thursday, May 26, 2011 at 3:04:20 PM UTC+5:30, Kann wrote:
>
> Dear all, 
>
> I am new to django and still kinda confused about how to handle 
> download link using django. What I did up to now was having a file 
> handle and point that handle to django's File object. So, now I have 
> django file object but I don't know how to incorporate that file 
> object into my template. Doing somefile.name will only give the file 
> name on the template, though; but how do I create a downloadable link 
> for that file from that on my template? 
>
> Best, 
>
> Kann

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ccf23f0-c2ec-4d62-a030-a3b7cf92e029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [novice question] Render a list of objects

2019-06-24 Thread Sudeep Gopal
Update  This worked for me..Thanks a lot for your help:- 

 FIELD1 FIELD2 FIELD3 FIELD4 
FIELD5 FIELD6 FIELD7 FIELD8 * {% for r in 
ret_list %} *   {{r.field1}}   {{r.field2}}   
{{r.field3}}   {{r.field4}}  {{r.field5}}   
{{r.field6}}   {{r.field7}}   {{r.field8 }}   * 
{% endfor %} *



On Sunday, June 23, 2019 at 8:15:58 PM UTC-4, Sudeep Gopal wrote:
>
> Thank you so much Joe...
>
> I was actually able to go forward. 
>
> With the below code  :-
>
> 
>   {% for r in list1 %}
> {% cycle '' '' '' '' '' '' '' ''%}
>   {{r}}
> {% cycle '' '' '' '' '' '' '' '' %}
>   {% endfor %}
>
>
>
> The {{r}} in the above code , gives only the reference or the pointer 
> value. For eg, template cannot recognize it is field1 which I want to 
> display or something,,,
> How do we get the value of that reference ?
>
> My result look like this :-
>
> field1 field2 field3 field4 field5 field6 field7 
>  
>  object at 0x0581B550>  object at 0x0581B278>  object at 0x05413908>  object at 0x053C27F0>  object at 0x053C20B8>  object at 0x053C2278> 
>  
>  object at 0x05413668>  object at 0x05413358>  object at 0x05413DA0>  object at 0x054DDF98>  object at 0x053C2978>  object at 0x055943C8> 
>
> I want it to look at the content 
>
> CARRIER1 230 128 QPSK 1000 125 155 
> CARRIER2 230 256 QAM 1000 125 155 
>
>
>
> On Saturday, June 22, 2019 at 9:03:19 AM UTC-4, Joe Reitman wrote:
>>
>> The example code you provided will create a  on the first iteration 
>> of the loop and  tag every 4th iteration of the loop. This cycle will 
>> continue resulting in a table with 4 columns of data. Example:
>>
>> results = [ 1, 2, 3, 4, 5, 6, 7, 8 ]
>>
>>
>> 
>>   
>> 1
>> 2
>> 3
>> 4
>>   
>>   
>> 5
>> 6
>> 7
>> 8
>>   
>>
>>
>>
>> If you have 2 lists, render them from your view like return render(
>> request, 'polls/detail.html', {'list1': list1, 'list2': list2})
>> In your template create an 8 column table:
>>
>> 
>>   {% for r in list1 %}
>> {% cycle '' '' '' '' '' '' '' ''%}
>>   {{r}}
>> {% cycle '' '' '' '' '' '' '' '' %}
>>   {% endfor %}
>>
>> {% for r in list2 %}
>> {% cycle '' '' '' '' '' '' '' ''%}
>>   {{r}}
>> {% cycle '' '' '' '' '' '' '' '' %}
>>   {% endfor %}
>>
>> 
>>
>>
>> Hope this helps
>>
>> On Friday, June 21, 2019 at 5:58:21 PM UTC-5, Sudeep Gopal wrote:
>>>
>>> Hello, 
>>>
>>> I am new to django. 
>>>
>>> I am using django forms in my project and I am not using django models. 
>>>
>>> From the user,  my django form asks for 4 inputs :- signal_to_noise_1 , 
>>> signal_to_noise_2, bandwidth1 and bandwidth2. 
>>>
>>> Based on these values I use my  look up table and I create a results 
>>> which are 2 lists of records.
>>>  Each list has approximately 40 to 50 records. Each record has 8 fields. 
>>> (field1,...field8) ...
>>>
>>> *Each list *looks like this (if my description is not clear) field1 is 
>>> unique. 
>>>
>>> field1  field2  field3 
>>>
>>>
>>>
>>> field8
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Both the lists (with each list having about 50 records) are in my django 
>>> view. 
>>>
>>> From what I read online, I can use the render() method which has a 
>>> *dictionary 
>>> *called context. (
>>> https://docs.djangoproject.com/en/2.2/ref/templates/api/#rendering-a-context
>>>  
>>> 
>>> )
>>>
>>> I am not sure how to convert these list of record objects to this 
>>> dictionary format which has {"name":value} pair. 
>>>
>>> Even the django tables requires it in the dictionary format.
>>>
>>> The nearest thing which I found was 
>>> https://stackoverflow.com/questions/9388064/django-template-turn-array-into-html-table
>>>  
>>>
>>> But I did not understand what exactly the below syntax does and how I 
>>> can customize it to my usecase any input would be greatly appreciated 
>>> ...
>>>
>>> 
>>>   {% for r in results %}
>>> {% cycle '' '' '' '' %}
>>>   {{r.content}}
>>> {% cycle '' '' '' '' %}
>>>   {% endfor %}
>>>
>>>
>>>
>>>
>>>
>>>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8331c29f-97ce-4ec6-9aa9-67c36c0997ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Model, ORM] Disabling a field before actually removing it

2019-06-24 Thread Matthieu Rudelle
>From the tests we conducted, even fields that are nullable and that are not 
used in the code require the underlying column to be present on DB. 

So as soon as the new release migrates the DB and gets rid of the column. 
The previous release (that is still running on this DB) complains that the 
table is missing with a 500.

On Monday, June 24, 2019 at 2:20:38 PM UTC+2, Vinicius Assef wrote:
>
> I would, before everything, deploy code to stop using the field.
>
> After that, I would make it nullable and, then, remove it from the table.
>
> On Mon, 24 Jun 2019 at 05:32, Matthieu Rudelle  > wrote:
>
>> Yep, that's what we're planning on doing. 
>>
>> It's kind of hacky though, it requires to warn all contributors to not 
>> makemigrations or to manually remove the field removal from the generated 
>> migration until the new release (and to ignore the screams of CI/CD tools 
>> ^^).
>>
>> Thanks for your response, I'll follow up with a feature request ticket 
>> and post it here.
>>
>> On Friday, June 21, 2019 at 3:50:48 PM UTC+2, george wrote:
>>>
>>> The answer is indeed to split this into steps.
>>>
>>> First step is to allow the field to be nullable if it's not already. 
>>> Deploy.
>>>
>>> Then you create a new deploy (not PR) that stops using the field 
>>> altogether from all the codebase. You can remove the reference to the field 
>>> or comment it out. Do not `makemigrations`. Deploy.
>>>
>>> Create the last step, which is the migration to drop the field from the 
>>> database.
>>>
>>> On Thu, Jun 20, 2019 at 6:20 PM Matthieu Rudelle  
>>> wrote:
>>>
 Thank you for the quick answer, although I am not sure what the second 
 step mean and how it actually solves the problem?

 The missing column error appears even when no backward migration is 
 called. Both version of the app run side by side, both connected to a 
 single DB migrated with the new code. So when the 3 step is called, the 
 older release will fail.

 Best,
 Matthieu

 On Thursday, June 20, 2019 at 3:07:54 PM UTC+2, Aldian Fazrihady wrote:
>
> My solution to this problem was by adding more migrations steps:
> 1. Step to make the field nullable. 
> 2. Backward step to fill value to the removed field. 
> 3. Step to remove the field. 
>
> Regards, 
>
> Aldian Fazrihady
>
>
> On Thu, 20 Jun 2019, 19:37 Matthieu Rudelle,  
> wrote:
>
>> Hi there!
>>
>> I am about to file a feature request but I figured this might have 
>> been discussed (although I can't find where).
>>
>> The use case is when removing fields in a production environment. We 
>> run our django migrations without downtimes, such that basically, from 
>> time 
>> to time we have an old release working on an DB migrated by the new 
>> release.
>>
>> And when we remove a field it breaks. So we're thinking there should 
>> be a way to flag a field as "disabled", its value will not be requested 
>> on 
>> the DB and default to a hardcoded value. No migration should remove the 
>> column yet. Once the field is actually removed the column can be safely 
>> removed without breaking the old version.
>>
>> What do you guys think? Is there a better way to solve this?
>>
>> *Note: a slightly different usecase that it could solve, the third 
>> item on this wishlist: *
>> https://pankrat.github.io/2015/django-migrations-without-downtimes/#django-wishlist
>>
>> Best,
>> Matthieu
>>
>> -- 
>> 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 post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CANP1NSx%3DRu63c2vR4R%3DfbtBEHV3WRqf1XxWtN%3Dd23j3VoA-ZZw%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
 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 post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/420f1671-2c31-428b-b96b-02f840df2df5%40googlegroups.com
  
 

Re: libssl.so.1.1 / OPENSSL_1_1_1 not found after upgrade (ubuntu server 18.04 / apache / mod_wsgi)

2019-06-24 Thread Volker Kraut
Luke! That did the trick! Many thanks.

Am Mo., 24. Juni 2019 um 01:19 Uhr schrieb Luke :

> Hah! Found it!
>
> The psycopg2-binary module needed to be reinstalled (now version 2.8.3)
>
> I believe the old one must have been compiled against libssl1.1.0, which
> was replaced by 1.1.1 in the upgrade which broke things.
>
> On Monday, June 24, 2019 at 11:11:11 AM UTC+12, Luke wrote:
>>
>> I'm having the same problem, totally unable to find a resolution so far.
>>
>> I get no error messages of any use, even with all logging set to DEBUG.
>> The only thing i'm seeing is "Truncated or oversized response headers
>> received from daemon process" in the apache error log.
>>
>> Works fine when using the Django development server. Broke last week
>> after updating the system python and openssl packages.
>>
>> Anyone else having this problem?
>>
>> On Friday, June 14, 2019 at 1:31:29 PM UTC+12, Volker wrote:
>>>
>>> Two days ago my django app which runs on an Ubuntu 18.04.2 LTS server
>>> with apache 2.4 (from repo9 and mod_wsgi in an venv with Python 3.6 throws
>>> an exception after https login - as it seems - after a package upgrade.
>>> To my understanding libssl/openssl is causing the error. The error
>>> message below states that openssl_1_1_1 is not found. Though it seems to be
>>> installed.
>>>
>>> Could you guys give me a pointer? Please let me know if I need to
>>> provide additional information.
>>>
>>> Thanks and cheers!
>>>
>>>
>>>
>>> Two days ago following packages where upgraded:
>>> =
>>> libelf1:amd64 0.170-0.4 => 0.170-0.4ubuntu0.1
>>> libglib2.0-0:amd64 2.56.4-0ubuntu0.18.04.2 => 2.56.4-0ubuntu0.18.04.3
>>> libglib2.0-data:all 2.56.4-0ubuntu0.18.04.2 =>
>>> 2.56.4-0ubuntu0.18.04.3
>>> libnss-systemd:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
>>> libpam-systemd:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
>>> libpython3.6-minimal:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
>>> libpython3.6-stdlib:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
>>> libpython3.6:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
>>> libssl1.1:amd64 1.1.0g-2ubuntu4.3 => 1.1.1-1ubuntu2.1~18.04.1
>>> libsystemd0:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
>>> libudev1:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
>>> openssl:amd64 1.1.0g-2ubuntu4.3 => 1.1.1-1ubuntu2.1~18.04.1
>>> python3-cryptography:amd64 2.1.4-1ubuntu1.2 => 2.1.4-1ubuntu1.3
>>> python3-distutils:all 3.6.7-1~18.04 => 3.6.8-1~18.04
>>> python3-gdbm:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04
>>> python3-lib2to3:all 3.6.7-1~18.04 => 3.6.8-1~18.04
>>> python3.6-minimal:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
>>> python3.6-venv:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
>>> python3.6:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
>>> systemd-sysv:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
>>> systemd:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
>>> udev:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
>>>
>>> Login Implementation
>>> 
>>> Im using djangos login views:
>>> settings.py:
>>> LOGIN_URL = '/accounts/login/'
>>> urls.py:
>>> path('accounts/', include('django.contrib.auth.urls')),
>>>
>>> Error after Login Page of application / and django admin:
>>> 
>>> "Internal Server Error
>>> The server encountered an internal error or misconfiguration and was
>>> unable to complete your request."
>>>
>>> Error in Apache Log
>>> ==
>>> [Thu Jun 13 18:58:10.555937 2019] [wsgi:error] [pid 1274:tid
>>> 140451378087680] [client 77.8.21.189:48212] mod_wsgi (pid=1274):
>>> Request data read error when proxying data to daemon process: Connection
>>> reset by peer.
>>> [Thu Jun 13 20:46:51.186545 2019] [wsgi:error] [pid 1274:tid
>>> 140451252197120] [client 217.18.178.226:61510] Truncated or oversized
>>> response headers received from daemon process 'fotobau.ourdomain.de':
>>> /srv/fotobau/djangoprojekt/wsgi.py, referer:
>>> https://www.fotobau.ourdomain/accounts/login/
>>>
>>> Unfortunately I failed to obtain a core dump till now.
>>>
>>> Though right now I suspect the problem occurs when django tries to
>>> receive the https/encrypted user and password. I suspect this because I got
>>> another error message!
>>>
>>> Another Error in Django Log
>>> 
>>> Here I got a new error message: The first one ('Exception' is not JSON
>>> serializable) is fairly common - though I didn´t manage to fix it till now,
>>> it never really bothered.
>>> Though after the package upgrade it raises a new error message (which
>>> will raise itself again for 3 times) below - the one with "ImportError:
>>> /usr/lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1":
>>>
>>> ERROR 2019-06-12 19:57:17,638 log 505 Internal Server Error:
>>> /restservice/v1/fotos/
>>> Traceback (most recent call last):
>>>   File
>>> "/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/core/handlers/exception.py",
>>> line 34, in 

Re: [Model, ORM] Disabling a field before actually removing it

2019-06-24 Thread Vinicius Assef
I would, before everything, deploy code to stop using the field.

After that, I would make it nullable and, then, remove it from the table.

On Mon, 24 Jun 2019 at 05:32, Matthieu Rudelle  wrote:

> Yep, that's what we're planning on doing.
>
> It's kind of hacky though, it requires to warn all contributors to not
> makemigrations or to manually remove the field removal from the generated
> migration until the new release (and to ignore the screams of CI/CD tools
> ^^).
>
> Thanks for your response, I'll follow up with a feature request ticket and
> post it here.
>
> On Friday, June 21, 2019 at 3:50:48 PM UTC+2, george wrote:
>>
>> The answer is indeed to split this into steps.
>>
>> First step is to allow the field to be nullable if it's not already.
>> Deploy.
>>
>> Then you create a new deploy (not PR) that stops using the field
>> altogether from all the codebase. You can remove the reference to the field
>> or comment it out. Do not `makemigrations`. Deploy.
>>
>> Create the last step, which is the migration to drop the field from the
>> database.
>>
>> On Thu, Jun 20, 2019 at 6:20 PM Matthieu Rudelle 
>> wrote:
>>
>>> Thank you for the quick answer, although I am not sure what the second
>>> step mean and how it actually solves the problem?
>>>
>>> The missing column error appears even when no backward migration is
>>> called. Both version of the app run side by side, both connected to a
>>> single DB migrated with the new code. So when the 3 step is called, the
>>> older release will fail.
>>>
>>> Best,
>>> Matthieu
>>>
>>> On Thursday, June 20, 2019 at 3:07:54 PM UTC+2, Aldian Fazrihady wrote:

 My solution to this problem was by adding more migrations steps:
 1. Step to make the field nullable.
 2. Backward step to fill value to the removed field.
 3. Step to remove the field.

 Regards,

 Aldian Fazrihady


 On Thu, 20 Jun 2019, 19:37 Matthieu Rudelle, 
 wrote:

> Hi there!
>
> I am about to file a feature request but I figured this might have
> been discussed (although I can't find where).
>
> The use case is when removing fields in a production environment. We
> run our django migrations without downtimes, such that basically, from 
> time
> to time we have an old release working on an DB migrated by the new 
> release.
>
> And when we remove a field it breaks. So we're thinking there should
> be a way to flag a field as "disabled", its value will not be requested on
> the DB and default to a hardcoded value. No migration should remove the
> column yet. Once the field is actually removed the column can be safely
> removed without breaking the old version.
>
> What do you guys think? Is there a better way to solve this?
>
> *Note: a slightly different usecase that it could solve, the third
> item on this wishlist: *
> https://pankrat.github.io/2015/django-migrations-without-downtimes/#django-wishlist
>
> Best,
> Matthieu
>
> --
> 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 post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANP1NSx%3DRu63c2vR4R%3DfbtBEHV3WRqf1XxWtN%3Dd23j3VoA-ZZw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
 --
>>> 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 post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/420f1671-2c31-428b-b96b-02f840df2df5%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> George R. C. Silva
>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To 

Re: [Model, ORM] Disabling a field before actually removing it

2019-06-24 Thread Matthieu Rudelle
Yep, that's what we're planning on doing. 

It's kind of hacky though, it requires to warn all contributors to not 
makemigrations or to manually remove the field removal from the generated 
migration until the new release (and to ignore the screams of CI/CD tools 
^^).

Thanks for your response, I'll follow up with a feature request ticket and 
post it here.

On Friday, June 21, 2019 at 3:50:48 PM UTC+2, george wrote:
>
> The answer is indeed to split this into steps.
>
> First step is to allow the field to be nullable if it's not already. 
> Deploy.
>
> Then you create a new deploy (not PR) that stops using the field 
> altogether from all the codebase. You can remove the reference to the field 
> or comment it out. Do not `makemigrations`. Deploy.
>
> Create the last step, which is the migration to drop the field from the 
> database.
>
> On Thu, Jun 20, 2019 at 6:20 PM Matthieu Rudelle  > wrote:
>
>> Thank you for the quick answer, although I am not sure what the second 
>> step mean and how it actually solves the problem?
>>
>> The missing column error appears even when no backward migration is 
>> called. Both version of the app run side by side, both connected to a 
>> single DB migrated with the new code. So when the 3 step is called, the 
>> older release will fail.
>>
>> Best,
>> Matthieu
>>
>> On Thursday, June 20, 2019 at 3:07:54 PM UTC+2, Aldian Fazrihady wrote:
>>>
>>> My solution to this problem was by adding more migrations steps:
>>> 1. Step to make the field nullable. 
>>> 2. Backward step to fill value to the removed field. 
>>> 3. Step to remove the field. 
>>>
>>> Regards, 
>>>
>>> Aldian Fazrihady
>>>
>>>
>>> On Thu, 20 Jun 2019, 19:37 Matthieu Rudelle,  wrote:
>>>
 Hi there!

 I am about to file a feature request but I figured this might have been 
 discussed (although I can't find where).

 The use case is when removing fields in a production environment. We 
 run our django migrations without downtimes, such that basically, from 
 time 
 to time we have an old release working on an DB migrated by the new 
 release.

 And when we remove a field it breaks. So we're thinking there should be 
 a way to flag a field as "disabled", its value will not be requested on 
 the 
 DB and default to a hardcoded value. No migration should remove the column 
 yet. Once the field is actually removed the column can be safely removed 
 without breaking the old version.

 What do you guys think? Is there a better way to solve this?

 *Note: a slightly different usecase that it could solve, the third item 
 on this wishlist: *
 https://pankrat.github.io/2015/django-migrations-without-downtimes/#django-wishlist

 Best,
 Matthieu

 -- 
 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 post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/CANP1NSx%3DRu63c2vR4R%3DfbtBEHV3WRqf1XxWtN%3Dd23j3VoA-ZZw%40mail.gmail.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>> 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 post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/420f1671-2c31-428b-b96b-02f840df2df5%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> George R. C. Silva
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec538dd2-5497-4500-8079-6b48469af56f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: action in a form

2019-06-24 Thread Sebastian Jung
Hello,

Please Post us your url.py template and the related function from view.py

Regards

bengoshi  schrieb am So., 23. Juni 2019, 22:36:

> Thanks for your responses. I didn't describe it well.. if I write
>
> 
> it calls the url journal and this is the my requested result. All fine.
> Without the attribute "action" the form save the input in the database - the 
> requested result, great.
> With "action" it doesn't. That is the point which I don't understand becauce 
> in my understanding
> action should not have any effect for saving data.
>
> Greetings
> bengoshi
>
>
> Am Sonntag, 23. Juni 2019 19:31:05 UTC+2 schrieb Sipum:
>>
>> Hello,
>>
>> In action use the url associated with that view then it will work for
>> you.
>> If not then kindly tell what errors you are getting.
>>
>> Thanks.
>>
>> On Sun, 23 Jun, 2019, 10:17 PM Sebastian Jung, 
>> wrote:
>>
>>> Hello,
>>>
>>> You must Put in Action not a Name from a function. You must Put a url
>>> dir example action="/newurl/"
>>>
>>> And in your url a Link from /newurl/ to the function
>>>
>>> Regards
>>>
>>> bengoshi  schrieb am So., 23. Juni 2019, 17:57:
>>>
 Hi,
 I tried to write a form:

 ###

 {% extends 'base.html' %}
 {% block content %}
 Test
 
 {% csrf_token %}
 {{ form.as_p }}
 
 
 {% endblock %}
 ###

 and it works. But if I replace it with

 >>>
 "journal" is a view for shown the saved data which work, too. If I click 
 to "Save" it change to "journal" but won't save the data anymoren.

 Could anybody explain me please this behavior?

 Thanks and Greetings

 bengoshi


 --
 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 post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/e153dd08-3678-4620-8f1d-dae1fa1b978f%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>>> 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 post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKGT9mxSq-ZKdQc_zUdHZmqZ5g%2Bfr8YVn0Upm%3DWru9SD6%3DwWkg%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3ffc7b93-4536-4c29-9998-1d4b10e380dc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9mx%3DgiWjD%3DLWqrN09Oxhu2EvhwoKNOss2V0uEgLu%3DWkZfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: action in a form

2019-06-24 Thread Kai Kobschätzki
Hi Sipum,
yes, you are right!

Best Greetings

bengoshi

Am Mo., 24. Juni 2019 um 08:45 Uhr schrieb Sipum Mishra :

> Hi bengoshi,
>
> If i m not wrong, your concern is when you add action ='journal' then data
> are not saved.
> Right?
>
> Thanks.
>
>
> On Mon, 24 Jun, 2019, 2:07 AM bengoshi, 
> wrote:
>
>> Thanks for your responses. I didn't describe it well.. if I write
>>
>> 
>> it calls the url journal and this is the my requested result. All fine.
>> Without the attribute "action" the form save the input in the database - the 
>> requested result, great.
>> With "action" it doesn't. That is the point which I don't understand becauce 
>> in my understanding
>> action should not have any effect for saving data.
>>
>> Greetings
>> bengoshi
>>
>>
>> Am Sonntag, 23. Juni 2019 19:31:05 UTC+2 schrieb Sipum:
>>>
>>> Hello,
>>>
>>> In action use the url associated with that view then it will work for
>>> you.
>>> If not then kindly tell what errors you are getting.
>>>
>>> Thanks.
>>>
>>> On Sun, 23 Jun, 2019, 10:17 PM Sebastian Jung, 
>>> wrote:
>>>
 Hello,

 You must Put in Action not a Name from a function. You must Put a url
 dir example action="/newurl/"

 And in your url a Link from /newurl/ to the function

 Regards

 bengoshi  schrieb am So., 23. Juni 2019, 17:57:

> Hi,
> I tried to write a form:
>
> ###
>
> {% extends 'base.html' %}
> {% block content %}
> Test
> 
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
> {% endblock %}
> ###
>
> and it works. But if I replace it with
>
> 
> "journal" is a view for shown the saved data which work, too. If I click 
> to "Save" it change to "journal" but won't save the data anymoren.
>
> Could anybody explain me please this behavior?
>
> Thanks and Greetings
>
> bengoshi
>
>
> --
> 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 post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e153dd08-3678-4620-8f1d-dae1fa1b978f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
 --
 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 post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAKGT9mxSq-ZKdQc_zUdHZmqZ5g%2Bfr8YVn0Upm%3DWru9SD6%3DwWkg%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3ffc7b93-4536-4c29-9998-1d4b10e380dc%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGHZBzx6CbvXyqD3Z5HnEh3f3FYd5AmyEJDVNEunzyp4X3dfuA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
herz-jesu-jugend.de
jetzt neu: 

Re: action in a form

2019-06-24 Thread Sipum Mishra
Hi bengoshi,

If i m not wrong, your concern is when you add action ='journal' then data
are not saved.
Right?

Thanks.


On Mon, 24 Jun, 2019, 2:07 AM bengoshi,  wrote:

> Thanks for your responses. I didn't describe it well.. if I write
>
> 
> it calls the url journal and this is the my requested result. All fine.
> Without the attribute "action" the form save the input in the database - the 
> requested result, great.
> With "action" it doesn't. That is the point which I don't understand becauce 
> in my understanding
> action should not have any effect for saving data.
>
> Greetings
> bengoshi
>
>
> Am Sonntag, 23. Juni 2019 19:31:05 UTC+2 schrieb Sipum:
>>
>> Hello,
>>
>> In action use the url associated with that view then it will work for
>> you.
>> If not then kindly tell what errors you are getting.
>>
>> Thanks.
>>
>> On Sun, 23 Jun, 2019, 10:17 PM Sebastian Jung, 
>> wrote:
>>
>>> Hello,
>>>
>>> You must Put in Action not a Name from a function. You must Put a url
>>> dir example action="/newurl/"
>>>
>>> And in your url a Link from /newurl/ to the function
>>>
>>> Regards
>>>
>>> bengoshi  schrieb am So., 23. Juni 2019, 17:57:
>>>
 Hi,
 I tried to write a form:

 ###

 {% extends 'base.html' %}
 {% block content %}
 Test
 
 {% csrf_token %}
 {{ form.as_p }}
 
 
 {% endblock %}
 ###

 and it works. But if I replace it with

 >>>
 "journal" is a view for shown the saved data which work, too. If I click 
 to "Save" it change to "journal" but won't save the data anymoren.

 Could anybody explain me please this behavior?

 Thanks and Greetings

 bengoshi


 --
 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 post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/e153dd08-3678-4620-8f1d-dae1fa1b978f%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>>> 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 post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKGT9mxSq-ZKdQc_zUdHZmqZ5g%2Bfr8YVn0Upm%3DWru9SD6%3DwWkg%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3ffc7b93-4536-4c29-9998-1d4b10e380dc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGHZBzx6CbvXyqD3Z5HnEh3f3FYd5AmyEJDVNEunzyp4X3dfuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.